Create a document, from an upload or without a file.
POST/api/v1/documentsdocuments:write
upload_id is a completed upload session with purpose document; without it the document is made with its details only and gets its file later (create_document_version). The document is numbered under document_prefix_id (default: your user name), granted to you and the company's default users and groups, filed in folder_ids, and processed as a Portal upload: PDF conversion, text, OCR, embeddings and indexing follow. Needs Create Documents, and sight of every folder and the project.
| Scope | documents:write |
| Asynchronous | No |
| MCP tool | create_document |
| Portal permissions | create_documents |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Docwize-Version | header | string (date) | Optional | |
Idempotency-Key | header | string | Optional | max 255 |
Request body
| Content type | Type |
|---|---|
application/json | DocumentCreateInput |
Responses
| Status | Description | Body |
|---|---|---|
201 | Success. | application/json Document or object |
400 | invalid_version, malformed_json | application/problem+json Problem |
401 | token_expired, unauthenticated | application/problem+json Problem |
403 | forbidden, insufficient_scope, token_owner_inactive | application/problem+json Problem |
405 | method_not_allowed | application/problem+json Problem |
406 | not_acceptable | application/problem+json Problem |
409 | conflict, idempotency_in_progress | application/problem+json Problem |
413 | payload_too_large | application/problem+json Problem |
415 | unsupported_media_type | application/problem+json Problem |
421 | wrong_region | application/problem+json Problem |
422 | idempotency_key_reused, validation_failed | application/problem+json Problem |
500 | internal_error | application/problem+json Problem |
503 | tenant_unavailable, unavailable | application/problem+json Problem |
504 | timeout | application/problem+json Problem |
Errors
The problem codes this operation can answer with. Each code links to its page.
Schemas
AdditionalField
| Field | Type | Required | Description |
|---|---|---|---|
label | string or null | Required | |
value | string or null | Required |
AdditionalFieldInput
| Field | Type | Required | Description |
|---|---|---|---|
label | string or null | Optional | |
value | string or null | Optional |
AdditionalFields
| Field | Type | Required | Description |
|---|---|---|---|
additional_field_3 | AdditionalField | Required | |
additional_field_4 | AdditionalField | Required | |
additional_field_5 | AdditionalField | Required | |
additional_field_6 | AdditionalField | Required |
AdditionalFieldsInput
| Field | Type | Required | Description |
|---|---|---|---|
additional_field_3 | AdditionalFieldInput | Optional | |
additional_field_4 | AdditionalFieldInput | Optional | |
additional_field_5 | AdditionalFieldInput | Optional | |
additional_field_6 | AdditionalFieldInput | Optional |
BlankFileInput
| Field | Type | Required | Description |
|---|---|---|---|
extension | string | Required | The Office type of the empty file: docx, xlsx or pptx. |
file_name | string or null | Optional | The file's name, ending with the extension. Default: the document's description (or Document) and the extension. |
CarbonCopyInputInput
| Field | Type | Required | Description |
|---|---|---|---|
contact | object or null | Optional | A contact; its organisation comes with it. |
organisation | object or null | Optional | An organisation, for a copy that names no person. Leave out when contact is given. |
Document
| Field | Type | Required | Description |
|---|---|---|---|
actual_submission_date | string or null | Required | |
additional_fields | AdditionalFields | Required | |
created_at | string (date-time) or null | Required | |
created_by | UserRef or null | Required | |
custom_field_rows | array of DocumentCustomFieldRow | Required | The register rows the document is linked to that the caller may read, one entry per row in link order. |
description | string or null | Required | |
document_date | string or null | Required | |
document_id | string | Required | |
document_number | string or null | Required | |
document_status | object or null | Required | The status shown as Status in the Portal (lookup_actionstatus). |
document_sub_type | object or null | Required | |
document_type | object or null | Required | |
duplicate_of | string or null | Required | The number of the document this one duplicates (the Portal's Duplicate Of). |
file | DocumentFile or null | Required | The current file; null when the document has none. |
folders | array of DocumentFolder | Required | The folders the document is filed in that the caller can see. |
from_contact | object or null | Required | |
from_organisation | object or null | Required | |
is_latest_revision | boolean | Required | |
is_locked | boolean | Required | |
is_privileged | boolean | Required | |
main_document_date | string or null | Required | |
owner | UserRef or null | Required | |
page_end | number or null | Required | Last page of the range this document covers in its file. |
page_start | number or null | Required | First page of the range this document covers in its file. |
post_review_status | object or null | Required | |
project | object or null | Required | The stored project number text, with the project's ID when one matches. |
project_organisation | object or null | Required | |
reference_number | string or null | Required | |
relevance | number or null | Required | 1 is relevant (the default), 0 is irrelevant (the Portal's Irrelevant switch). |
responded_with | string or null | Required | The reference of the document that responded to this one (the Portal's Responded With). |
response_date | string or null | Required | |
response_due_date | string or null | Required | |
revision_number | string or null | Required | |
to_contact | object or null | Required | |
to_organisation | object or null | Required |
DocumentCreateInput
| Field | Type | Required | Description |
|---|---|---|---|
actual_submission_date | string or null | Optional | The Portal's Received/Delivered date. |
additional_fields | AdditionalFieldsInput or null | Optional | Additional fields 3 to 6, each as {value}. |
blank_file | BlankFileInput or null | Optional | An empty .docx, .xlsx or .pptx for the document to hold, to open in Office Online. Not with upload_id. |
ccs | array of CarbonCopyInputInput | Optional | The people to copy the document to, in order; each a contact or an organisation. |
description | string or null | Optional | Default: the file name without its extension; empty for a document without a file. |
document_date | string or null | Optional | Default: now. |
document_prefix_id | string or null | Optional | The prefix the document number is made under (PREFIX/00001). Default: your user name. |
document_status | object or null | Optional | |
document_sub_type | object or null | Optional | A sub type of document_type; needs document_type. |
document_type | object or null | Optional | |
duplicate_of | string or null | Optional | |
extract_archive | boolean or null | Optional | true expands an uploaded .zip, .pst or .ost into documents once it is stored (the Portal's Extract archive on upload). Needs a file of that kind. Default false. |
folder_ids | array of string | Optional | The folders to file the document in; you must see each one. |
from_contact | object or null | Optional | A contact; its organisation becomes from_organisation. |
from_organisation | object or null | Optional | |
immediate_processing | boolean or null | Optional | true runs the text extraction and AI processing at once instead of in the background queue's turn (the Portal's Immediate processing). Default false. |
is_privileged | boolean or null | Optional | |
location_ids | array of string | Optional | The locations to file the document in (needs View Locations). |
page_end | number or null | Optional | |
page_start | number or null | Optional | |
post_review_status | object or null | Optional | |
project | object or null | Optional | A project you can see; its client becomes the project organisation. |
reference_number | string or null | Optional | A reference number and revision another document already has is a warning, not a refusal. |
relevance | number or null | Optional | 0 to 1: 1 is relevant (the default), 0 is irrelevant. |
responded_with | string or null | Optional | |
response_date | string or null | Optional | |
response_due_date | string or null | Optional | |
revision_number | string or null | Optional | |
to_contact | object or null | Optional | A contact; its organisation becomes to_organisation. |
to_organisation | object or null | Optional | |
upload_id | string | Optional | A completed upload session with purpose document. Absent (and no blank_file) creates the document without a file (metadata first, file later): give it one with create_document_version. |
DocumentCustomFieldRow
| Field | Type | Required | Description |
|---|---|---|---|
custom_field_template_id | string | Required | The register the row belongs to. |
row_id | string | Required | |
values | object | Required | The row's field values, keyed by field name. |
DocumentFile
| Field | Type | Required | Description |
|---|---|---|---|
content_type | string or null | Required | |
file_hash | string or null | Required | The hash the Portal stored for the file's content; null when none was recorded. |
file_name | string | Required | |
has_pdf | boolean | Required | Whether a PDF rendition of the file is ready (an Office file converts on demand, so false only means not yet). |
is_indexed | boolean | Required | Whether the file's text has been indexed for search. |
page_count | integer or null | Required | The pages the file has, once the Portal has counted them; null before. |
size_bytes | string or null | Required | |
version_id | string | Required |
DocumentFolder
| Field | Type | Required | Description |
|---|---|---|---|
folder_id | string | Required | |
path | string or null | Required |
UserRef
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string | Required | |
kind | string: user, system, integration or string | Required | |
user_id | string or null | Required |