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
| Parameter | Type | Description |
|---|---|---|
doc_id | integer | Document ID to add the version to. |
Form fields
| Field | Type | Required | Description |
|---|---|---|---|
file | binary | Required | The new file version. |
Response
200 OK| Field | Type | Description |
|---|---|---|
doc_id | integer | Document ID. |
linked_file_id | integer | ID of the new file record (now the active version). |
image_name | string | System-generated storage filename. |
Errors
| Status | Reason |
|---|---|
| 401 | Invalid or expired token |
| 404 | Document not found or access denied |
| 423 | Document 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"
}