Documents

Create and manage instance documents backed by Cargo.

Documents object

Attributes

object

String

String representing the object's type

id

String

status

Enum

title

String

content

String

file_id

String

parent_document_id

StringNullable

current_version_id

StringNullable

created_by

ObjectNullable

created_at

Date

updated_at

Date
{
"object": "document",
"status": "active",
"created_by": {
"type": "organization_actor",
"organization_actor": {
"object": "organization.actor",
"id": "omem_5fGhJkLmNpQrStUv",
"type": "member",
"organization_id": "org_7hNkPqRsTuVwXyZa",
"name": "Alex Chen",
"email": "[email protected]",
"image_url": "https://avatar-cdn.metorial.com/aimg_1234567890",
"teams": [
{
"id": "tm_3eFgHjKlMnPqRsTu",
"name": "Engineering",
"slug": "engineering",
"assignment_id": "tmas_8jKlMnPqRsTuVwXy"
},
{
"id": "tm_3eFgHjKlMnPqRsTu",
"name": "Engineering",
"slug": "engineering",
"assignment_id": "tmas_8jKlMnPqRsTuVwXy"
}
]
},
"consumer": {
"object": "consumer"
}
}
}

List documents

Returns a paginated list of documents owned by the instance.

Query Parameters

limit

NumberOptional

after

StringOptional

before

StringOptional

cursor

StringOptional

order

EnumOptional

id

UnionOptional

Filter by document ID

file_id

UnionOptional

Filter by file ID

store_id

UnionOptional

Filter by store ID

parent_document_id

UnionOptional

Filter by parent document ID

created_at

ObjectOptional

Filter Filter by creation time by date range

updated_at

ObjectOptional

Filter Filter by update time by date range

GEThttp://api.metorial.com/documents
curl -X GET "https://api.metorial.com/documents" \
-H "Authorization: Bearer metorial_sk_..."

Create document

Creates a new document for the instance.

Request Body

title

String

content

String
POSThttp://api.metorial.com/documents
curl -X POST "https://api.metorial.com/documents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"title": "example_title",
"content": "example_content"
}'

Get document by ID

Retrieves a document by its ID.

URL Parameters

document_id

String

The unique identifier for the document

GEThttp://api.metorial.com/documents/:document_id
curl -X GET "https://api.metorial.com/documents/doc_Rm4Mnheq2bfEPhBhP7SY" \
-H "Authorization: Bearer metorial_sk_..."

Get document permissions

Returns the effective Cargo permissions for the current actor on a specific document.

URL Parameters

document_id

String

The unique identifier for the document

GEThttp://api.metorial.com/documents/:document_id/permissions
curl -X GET "https://api.metorial.com/documents/doc_Rm4Mnheq2bfEPhBhP7SY/permissions" \
-H "Authorization: Bearer metorial_sk_..."

Update document by ID

Updates a specific document.

URL Parameters

document_id

String

The unique identifier for the document

Request Body

title

StringOptional

content

StringOptional
PATCHhttp://api.metorial.com/documents/:document_id
curl -X PATCH "https://api.metorial.com/documents/doc_Rm4Mnheq2bfEPhBhP7SY" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"title": "example_title",
"content": "example_content"
}'

Delete document by ID

Deletes a specific document.

URL Parameters

document_id

String

The unique identifier for the document

DELETEhttp://api.metorial.com/documents/:document_id
curl -X DELETE "https://api.metorial.com/documents/doc_Rm4Mnheq2bfEPhBhP7SY" \
-H "Authorization: Bearer metorial_sk_..."

Clone document by ID

Clones a specific document.

URL Parameters

document_id

String

The unique identifier for the document

Request Body

target_document_id

StringOptional

title

StringOptional
POSThttp://api.metorial.com/documents/:document_id/clone
curl -X POST "https://api.metorial.com/documents/doc_Rm4Mnheq2bfEPhBhP7SY/clone" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"target_document_id": "example_target_document_id",
"title": "example_title"
}'