Skip to main content

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.

Scopedocuments:write
AsynchronousNo
MCP toolcreate_document
Portal permissionscreate_documents

Parameters​

NameInTypeRequiredDescription
Docwize-Versionheaderstring (date)Optional
Idempotency-KeyheaderstringOptionalmax 255

Request body​

Content typeType
application/jsonDocumentCreateInput

Responses​

StatusDescriptionBody
201Success.application/json Document or object
400invalid_version, malformed_jsonapplication/problem+json Problem
401token_expired, unauthenticatedapplication/problem+json Problem
403forbidden, insufficient_scope, token_owner_inactiveapplication/problem+json Problem
405method_not_allowedapplication/problem+json Problem
406not_acceptableapplication/problem+json Problem
409conflict, idempotency_in_progressapplication/problem+json Problem
413payload_too_largeapplication/problem+json Problem
415unsupported_media_typeapplication/problem+json Problem
421wrong_regionapplication/problem+json Problem
422idempotency_key_reused, validation_failedapplication/problem+json Problem
500internal_errorapplication/problem+json Problem
503tenant_unavailable, unavailableapplication/problem+json Problem
504timeoutapplication/problem+json Problem

Errors​

The problem codes this operation can answer with. Each code links to its page.

Schemas​

AdditionalField​

FieldTypeRequiredDescription
labelstring or nullRequired
valuestring or nullRequired

AdditionalFieldInput​

FieldTypeRequiredDescription
labelstring or nullOptional
valuestring or nullOptional

AdditionalFields​

FieldTypeRequiredDescription
additional_field_3AdditionalFieldRequired
additional_field_4AdditionalFieldRequired
additional_field_5AdditionalFieldRequired
additional_field_6AdditionalFieldRequired

AdditionalFieldsInput​

FieldTypeRequiredDescription
additional_field_3AdditionalFieldInputOptional
additional_field_4AdditionalFieldInputOptional
additional_field_5AdditionalFieldInputOptional
additional_field_6AdditionalFieldInputOptional

BlankFileInput​

FieldTypeRequiredDescription
extensionstringRequiredThe Office type of the empty file: docx, xlsx or pptx.
file_namestring or nullOptionalThe file's name, ending with the extension. Default: the document's description (or Document) and the extension.

CarbonCopyInputInput​

FieldTypeRequiredDescription
contactobject or nullOptionalA contact; its organisation comes with it.
organisationobject or nullOptionalAn organisation, for a copy that names no person. Leave out when contact is given.

Document​

FieldTypeRequiredDescription
actual_submission_datestring or nullRequired
additional_fieldsAdditionalFieldsRequired
created_atstring (date-time) or nullRequired
created_byUserRef or nullRequired
custom_field_rowsarray of DocumentCustomFieldRowRequiredThe register rows the document is linked to that the caller may read, one entry per row in link order.
descriptionstring or nullRequired
document_datestring or nullRequired
document_idstringRequired
document_numberstring or nullRequired
document_statusobject or nullRequiredThe status shown as Status in the Portal (lookup_actionstatus).
document_sub_typeobject or nullRequired
document_typeobject or nullRequired
duplicate_ofstring or nullRequiredThe number of the document this one duplicates (the Portal's Duplicate Of).
fileDocumentFile or nullRequiredThe current file; null when the document has none.
foldersarray of DocumentFolderRequiredThe folders the document is filed in that the caller can see.
from_contactobject or nullRequired
from_organisationobject or nullRequired
is_latest_revisionbooleanRequired
is_lockedbooleanRequired
is_privilegedbooleanRequired
main_document_datestring or nullRequired
ownerUserRef or nullRequired
page_endnumber or nullRequiredLast page of the range this document covers in its file.
page_startnumber or nullRequiredFirst page of the range this document covers in its file.
post_review_statusobject or nullRequired
projectobject or nullRequiredThe stored project number text, with the project's ID when one matches.
project_organisationobject or nullRequired
reference_numberstring or nullRequired
relevancenumber or nullRequired1 is relevant (the default), 0 is irrelevant (the Portal's Irrelevant switch).
responded_withstring or nullRequiredThe reference of the document that responded to this one (the Portal's Responded With).
response_datestring or nullRequired
response_due_datestring or nullRequired
revision_numberstring or nullRequired
to_contactobject or nullRequired
to_organisationobject or nullRequired

DocumentCreateInput​

FieldTypeRequiredDescription
actual_submission_datestring or nullOptionalThe Portal's Received/Delivered date.
additional_fieldsAdditionalFieldsInput or nullOptionalAdditional fields 3 to 6, each as {value}.
blank_fileBlankFileInput or nullOptionalAn empty .docx, .xlsx or .pptx for the document to hold, to open in Office Online. Not with upload_id.
ccsarray of CarbonCopyInputInputOptionalThe people to copy the document to, in order; each a contact or an organisation.
descriptionstring or nullOptionalDefault: the file name without its extension; empty for a document without a file.
document_datestring or nullOptionalDefault: now.
document_prefix_idstring or nullOptionalThe prefix the document number is made under (PREFIX/00001). Default: your user name.
document_statusobject or nullOptional
document_sub_typeobject or nullOptionalA sub type of document_type; needs document_type.
document_typeobject or nullOptional
duplicate_ofstring or nullOptional
extract_archiveboolean or nullOptionaltrue 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_idsarray of stringOptionalThe folders to file the document in; you must see each one.
from_contactobject or nullOptionalA contact; its organisation becomes from_organisation.
from_organisationobject or nullOptional
immediate_processingboolean or nullOptionaltrue 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_privilegedboolean or nullOptional
location_idsarray of stringOptionalThe locations to file the document in (needs View Locations).
page_endnumber or nullOptional
page_startnumber or nullOptional
post_review_statusobject or nullOptional
projectobject or nullOptionalA project you can see; its client becomes the project organisation.
reference_numberstring or nullOptionalA reference number and revision another document already has is a warning, not a refusal.
relevancenumber or nullOptional0 to 1: 1 is relevant (the default), 0 is irrelevant.
responded_withstring or nullOptional
response_datestring or nullOptional
response_due_datestring or nullOptional
revision_numberstring or nullOptional
to_contactobject or nullOptionalA contact; its organisation becomes to_organisation.
to_organisationobject or nullOptional
upload_idstringOptionalA 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​

FieldTypeRequiredDescription
custom_field_template_idstringRequiredThe register the row belongs to.
row_idstringRequired
valuesobjectRequiredThe row's field values, keyed by field name.

DocumentFile​

FieldTypeRequiredDescription
content_typestring or nullRequired
file_hashstring or nullRequiredThe hash the Portal stored for the file's content; null when none was recorded.
file_namestringRequired
has_pdfbooleanRequiredWhether a PDF rendition of the file is ready (an Office file converts on demand, so false only means not yet).
is_indexedbooleanRequiredWhether the file's text has been indexed for search.
page_countinteger or nullRequiredThe pages the file has, once the Portal has counted them; null before.
size_bytesstring or nullRequired
version_idstringRequired

DocumentFolder​

FieldTypeRequiredDescription
folder_idstringRequired
pathstring or nullRequired

UserRef​

FieldTypeRequiredDescription
display_namestringRequired
kindstring: user, system, integration or stringRequired
user_idstring or nullRequired