Documents

Document Download

Markdown for LLMs
GET
/documents/document/{documentId}/download

Downloads a file from Storage and returns its raw bytes, not JSON. The response body is the file itself as application/octet-stream, so this operation does not use the success envelope every other endpoint returns — there is no result, no origin and no operationId to quote. Only the error responses are JSON.

The id comes from documents-document-upload, or from a generation whose deliveryMethod was Storage — documents-document-generate returns it as result.data.document.urn.

The caller must own the file. A file belonging to another user is not hidden: it returns 403, which is distinguishable from the 404 you get for an id that resolves to nothing.

Storage keeps a file for 24 hours, so a download has to happen inside that window. Past it the file is gone and the id returns 404 — the most common reason for a 404 here is the window having passed rather than a wrong id.

signatures-document-download is the counterpart of this operation on the other side of the API and behaves identically.

Authorization

AuthorizationBearer <token>

JWT token to authenticate the request.

In: header

X-Api-Key<token>

API key, sent as a request header.

In: header

Path Parameters

documentId*string

Storage id of the file to download — the urn on a document record, or the id an upload returned.

Despite the parameter name this is not a document record's id. The two are different values on the same record, and passing the record id returns 404. documents-document-list shows both side by side.

Formatuuid

Response Body

application/octet-stream

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/documents/document/b1348f98-dd61-4939-9c84-d6074cd80e6d/download"
Empty
{  "error": {    "statusCode": 401,    "message": "The request could not be authenticated.",    "innerErrors": [      {        "code": "UNAUTHORIZED",        "message": "The request could not be authenticated.",        "userMessage": "Your session has expired or is invalid. Please sign in again."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-09-27T09:12:44.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "e9247b16c03a4f85ad7162b9e08c5314"}
{  "error": {    "statusCode": 403,    "message": "The requested file does not belong to the authenticated user.",    "innerErrors": [      {        "code": "FILE_ACCESS_DENIED",        "message": "The requested file does not belong to the authenticated user.",        "userMessage": "You do not have permission to download this file."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-09-27T09:12:44.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "e9247b16c03a4f85ad7162b9e08c5314"}
{  "error": {    "statusCode": 404,    "message": "No file was found for the supplied id.",    "innerErrors": [      {        "code": "NOT_FOUND_BY_ID",        "message": "No file was found for the supplied id.",        "userMessage": "That file is no longer available."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-09-27T09:12:44.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "e9247b16c03a4f85ad7162b9e08c5314"}
{  "error": {    "statusCode": 500,    "message": "Failed to read the requested file from storage.",    "innerErrors": [      {        "code": "FILE_DOWNLOAD_FAILED",        "message": "Failed to read the requested file from storage.",        "userMessage": "Something went wrong. Please try again or contact support."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-09-27T09:12:44.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "e9247b16c03a4f85ad7162b9e08c5314"}