Add a version from an upload.
POST/api/v1/documents/{document_id}/versionsdocuments:write
upload_id is a completed upload session with purpose document. Its file becomes the document's current file; the file that was current is kept as an earlier version, and the new one is processed as a Portal upload. Needs an edit grant on the unlocked document.
| Scope | documents:write |
| Asynchronous | No |
| MCP tool | create_document_version |
| Portal permissions | upload_document_versions |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
document_id | path | string | Required | |
Docwize-Version | header | string (date) | Optional | |
Idempotency-Key | header | string | Optional | max 255 |
Request body
| Content type | Type |
|---|---|
application/json | VersionCreateInput |
Responses
| Status | Description | Body |
|---|---|---|
201 | Success. | application/json Version 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 |
404 | not_found | application/problem+json Problem |
405 | method_not_allowed | application/problem+json Problem |
406 | not_acceptable | application/problem+json Problem |
409 | conflict, idempotency_in_progress, locked | 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
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. |
UserRef
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string | Required | |
kind | string: user, system, integration or string | Required | |
user_id | string or null | Required |
Version
| Field | Type | Required | Description |
|---|---|---|---|
content_type | string or null | Required | |
created_at | string (date-time) or null | Required | |
created_by | UserRef or null | Required | Who stored the file; null when not recorded (archived files). |
file_hash | string or null | Required | The hash the Portal stored for the file's content; null when none was recorded. |
file_name | string or null | Required | |
has_pdf | boolean | Required | Whether a PDF rendition of this file is ready (an Office file converts on demand, so false only means not yet). |
is_current | boolean | Required | |
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. |
reason | string or null | Required | The description recorded when the file was replaced; null for the current file. |
size_bytes | string or null | Required | |
version_id | string | Required |
VersionCreateInput
| Field | Type | Required | Description |
|---|---|---|---|
blank_file | BlankFileInput or null | Optional | An empty .docx, .xlsx or .pptx as the new current file, to open in Office Online. Not with upload_id. |
extract_archive | boolean or null | Optional | true expands the new file, a .zip, .pst or .ost, into documents once it is stored. Default false. |
immediate_processing | boolean or null | Optional | true runs the text extraction and AI processing at once instead of in the background queue's turn. Default false. |
upload_id | string | Optional | A completed upload session with purpose document. Give this or blank_file. |