Skip to main content

Upload New Version

POST/apiv2/pub/documents/{doc_id}/versionsdocuments_write

Uploads a new file version. The current active file is archived automatically with type "replaced in portal".

Request

Content-Type: multipart/form-data

Path parameters

ParameterTypeDescription
doc_idintegerDocument ID to add the version to.

Form fields

FieldTypeRequiredDescription
filebinaryRequiredThe new file version.

Response

200 OK
FieldTypeDescription
doc_idintegerDocument ID.
linked_file_idintegerID of the new file record (now the active version).
image_namestringSystem-generated storage filename.

Errors

StatusReason
401Invalid or expired token
404Document not found or access denied
423Document is locked

cURL

curl -X POST "https://portal.docwize.com/apiv2/pub/documents/1542/versions" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-F "file=@invoice_v2.pdf"

{
"doc_id": 1542,
"linked_file_id": 3802,
"image_name": "1542_b8e3d.pdf"
}
{"detail": "Document not found or access denied"}
{"detail": "Document is locked and cannot be updated"}