# Documents
A document is a structured machine-readable data object used as a unit of information exchange between the integrating parties. Documents always belong to a single workspace. Each document's body must comply with the schema for the document's type.
# Data Model
All entities used for this API follow canonical Entity Envelope data format. Body format is defined by the chosen document type.
# Search Documents
GET /v2/workspaces/{workspace_id}/documents
# Query parameters
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
workspace_id | Workspace ID | UUID | yes | |
type | Document type | string | yes | |
limit | Maximum number of records to return | integer | no | 25 |
offset | The number of records to skip | integer | no | 0 |
sort | List of comma-separated ordering criteria | string: field:asc|desc | no | "created_at:desc, id:asc" |
filter[<field name>] | Value to search for in the chosen filter field. | any | no |
# Request body
None
# Response
An array of entity envelopes with the body formatted to the given type.
# Create Document
POST /v2/workspaces/{workspace_id}/documents
# Query parameters
None
# Request body
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
type | Document type. | string | yes | |
body | Document Body. Must be formatted to satisfy the schema for the chosen document type. | body | yes |
# Response
A single entity envelopes with the body formatted to the given type.
# Bulk Create Document
POST /v2/workspaces/{workspace_id}/documents/bulk
# Query parameters
None
# Request body
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
type | Document type. | string | yes | |
body | Document Body Array. Must be formatted to satisfy the schema for the chosen document type. | body[] | yes |
# Response
An array of entity envelopes with the body formatted to the given type.
# Get Document by ID
GET /v2/workspaces/{workspace_id}/documents/{document_id}
# Request parameters
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
workspace_id | Workspace ID | UUID | yes | |
document_id | Document ID | UUID | yes | |
# Request body
None
# Response
A single entity envelopes with the body formatted to the document's type.
# Update Document
PATCH /v2/workspaces/{workspace_id}/documents/{document_id}
# Request parameters
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
workspace_id | Workspace ID | UUID | yes | |
document_id | Document ID | UUID | yes | |
# Request body
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
previous_version_id | ID of the previous version of the same entity | UUID | null if the entity has never changed. | |
body | Changes to the document body. Can be partial, be formatted to satisfy the schema for the chosen document type. | object | yes |
# Response
A single entity envelopes with the body formatted to the document's type.
# Delete Document
Permanently deletes a document. It cannot be undone.
DELETE /v2/workspaces/{workspace_id}/documents/{document_id}
# Request parameters
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
workspace_id | Workspace ID | UUID | yes | |
document_id | Document ID | UUID | yes | |
# Request body
None
# Response
The latest known version of deleted document as a single entity envelope with the body formatted to the document's type.