Document Upload
Markdown for LLMsUploads one or more files to Storage as multipart/form-data. Accepted extensions are .docx and .pdf. They are validated by filename extension and case-sensitively. Maximum file size is 20 MB in Production and 10 MB in Staging; a file over that limit is rejected by the web server before the operation runs, so it surfaces as a 500 rather than a validation error.
Each file is assigned a storage id, returned in form-data order when several files are sent in one request. documents-document-download returns the file by that id, named in Content-Disposition, and the id works as a Storage source of documents-document-manage. The id addresses the file: it is not a document record's id.
Storage keeps an uploaded file for 24 hours, so the download or manage call has to happen within that window. Using the id as a template in documents-document-generate consumes it, as it does a template from documents-template-upload, so the id stops resolving afterwards.
A file with any other extension — .xlsx, .pptx, .csv, .txt, or .PDF in capitals — rejects the whole request with 400 INVALID_TEMPLATE_FORMAT, and no storage id is returned for any file in it. This code is shared with documents-template-upload and signatures-document-upload.
JWT token to authenticate the request.
In: header
API key, sent as a request header.
In: header
Request Body
multipart/form-data
Mandatory, as multipart/form-data with one or more file parts. A request that is not form data, or has no file in it, is rejected with 400 FORM_DATA_EXPECTED.
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/documents/document/upload" \ -F file="[ \"Signed contract.pdf\", \"Q3 report.docx\" ]"{ "result": { "statusCode": 201, "message": "Created", "data": { "files": [ { "id": "55ecc75e-5e37-45b2-b4df-bf8255aed71c", "fileName": "Signed contract.pdf" }, { "id": "d908c1db-b2ad-4272-bb3a-527882a17523", "fileName": "Q3 figures.xlsx" } ] } }, "origin": "POST https://api.doctavian.com/v1/documents/document/upload", "dateTime": "2026-10-16T11:08:12.000Z", "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5", "operationId": "9b2e4f7a1c0d43e8a6f5b3c9d1e07a24"}{ "error": { "statusCode": 400, "message": "Bad Request", "innerErrors": [ { "code": "INVALID_TEMPLATE_FORMAT", "message": "Files notes.txt are in an incorrect format. Accepted files types are .docx,.xlsx,.pptx,.pdf,.csv.", "userMessage": "Files notes.txt are in an incorrect format. Accepted files types are .docx,.xlsx,.pptx,.pdf,.csv." } ], "externalErrors": [] }, "origin": "POST https://api.doctavian.com/v1/documents/document/upload", "dateTime": "2026-10-16T11:08:14.000Z", "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5", "operationId": "4e7c1a9d2b0f45e38c6a1d5f9b2e0c73"}{ "error": { "statusCode": 401, "message": "Unauthorized", "innerErrors": [ { "code": "AUTHORIZATION_ERROR", "message": "Authorization header is missing.", "userMessage": "Authorization header is missing." } ] }, "origin": "POST https://api.doctavian.com/v1/documents/document/upload", "dateTime": "2026-10-16T11:08:16.000Z"}{ "error": { "statusCode": 500, "message": "Internal Server Error", "innerErrors": [ { "code": "FILE_UPLOAD_FAILED", "message": "Failed to persist the uploaded file to storage.", "userMessage": "Something went wrong while uploading. Please try again or contact support." } ], "externalErrors": [] }, "origin": "POST https://api.doctavian.com/v1/documents/document/upload", "dateTime": "2026-10-16T11:08:18.000Z", "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5", "operationId": "c2d8f4a61e9b47035a7c0e2d9f1b6a84"}