Documents

Document Download

GET
/documents/document/{documentId}/download

Downloads a previously stored document by its storage id and returns the raw file as an octet-stream. The caller must own the file (ownership is verified against the stored subscription-user metadata). Use the id returned by an upload or by document generation delivered to Storage.

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 (GUID) of the document to download, as returned by an upload or generation response.

Formatuuid

Response Body

application/octet-stream

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/documents/document/497f6eca-6276-4993-bfeb-53cbbbba6f08/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-07-14T09:32:15.000Z",  "operationId": "3a4b5c6d7e8f90112233445566778899",  "userId": "4a13376f-a14f-45d1-9670-dde64cb16aa4"}
{  "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 don't have access to this file."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-07-14T09:32:15.000Z",  "operationId": "3a4b5c6d7e8f90112233445566778899",  "userId": "eb9e706f-f4f6-4a41-8545-2d5adf102dcb"}
{  "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": "We couldn't find that file. Check the id and try again."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-07-14T09:32:15.000Z",  "operationId": "3a4b5c6d7e8f90112233445566778899",  "userId": "a46d7772-b92e-4343-8e04-07f8e1448d7d"}
{  "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 while downloading. Please try again or contact support."      }    ]  },  "origin": "GET https://api.doctavian.com/v1/documents/document/{documentId}/download",  "dateTime": "2026-07-14T09:32:15.000Z",  "operationId": "3a4b5c6d7e8f90112233445566778899",  "userId": "ad64a133-2599-4a9b-9f16-faff8caa80ea"}