Upload Document
POST/apiv2/pub/documents/uploaddocuments_write
Creates a new document record and uploads a file in a single request. The document is placed into the specified folder and assigned to the token user's groups.
Request
Content-Type: multipart/form-data
Form fields
| Field | Type | Required | Description |
|---|---|---|---|
file | binary | Required | The file to upload. Any file type is accepted. |
folder_id | integer | Required | Folder to place the document in. Use List Folders to discover IDs. |
description | string | Optional | Document title. Doubles as the default filename when downloading. Defaults to the uploaded filename. Max 400 chars. |
doc_type | string | Optional | Document type (e.g. "Invoice", "Report"). Must match an existing type. Max 60 chars. |
doc_status | string | Optional | Initial status (e.g. "Draft", "Final"). Max 50 chars. |
account_number | string | Optional | Account or project number. Max 255 chars. |
reference_number | string | Optional | Reference identifier — external or internally generated. Max 255 chars. |
date | string | Optional | Document date in ISO 8601 (e.g. "2025-01-15"). Business date, not upload date. |
from_entity | string | Optional | Sending organisation name. Max 255 chars. |
to_entity | string | Optional | Receiving organisation name. Max 255 chars. |
rev_number | string | Optional | Revision identifier (e.g. "A", "01"). Max 10 chars. |
privileged | boolean | Optional | Metadata flag. Purely informational — no effect on access control. |
doc_number_prefix | string | Optional | If provided, generates a sequential document number with this prefix (e.g. "INV" → "INV-00042"). |
Response
200 OK| Field | Type | Description |
|---|---|---|
doc_id | integer | Unique ID of the created document. Use in all subsequent calls. |
linked_file_id | integer | ID of the created file record. |
image_name | string | System-generated storage filename. |
description | string | Document description that was saved. |
doc_number | string or null | Auto-generated document number (if doc_number_prefix was provided). |
Errors
| Status | Reason |
|---|---|
| 400 | Missing file or folder_id |
| 401 | Invalid or expired token |
| 403 | Token lacks documents_write scope |
| 404 | Folder not found or not accessible |
cURL
curl -X POST "https://portal.docwize.com/apiv2/pub/documents/upload" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-F "file=@invoice.pdf" \
-F "folder_id=42" \
-F "description=January Invoice" \
-F "doc_type=Invoice"
{
"doc_id": 1542,
"linked_file_id": 3801,
"image_name": "1542_a7f2c.pdf",
"description": "January Invoice",
"doc_number": "INV-00042"
}