Skip to main content

Download Document

Download a specified original document file. Usually, you first get the filepath and filename via the Document List, then call this endpoint.

Try It

GET/documents/download_document?doc_file_path=%2Fdata%2Fuploads%2Ftenant_1%2Fhandbook.pdf&filename=handbook.pdfhttps://api-platform.ope.ai

Authentication

Uses Bearer Token authentication.

  • Header: Authorization: Bearer <token>
  • Example: Authorization: Bearer sk-xxxxxx

Query Parameters

FieldTypeRequiredDescriptionDefault / Range
doc_file_pathstringYesThe file path of the document, recommended to use the filepath returned by the document listRequires URL encoding
filenamestringYesThe filename displayed when downloading-

Request Examples

curl -L "https://api-platform.ope.ai/documents/download_document?doc_file_path=%2Fdata%2Fuploads%2Ftenant_1%2Fhandbook.pdf&filename=handbook.pdf" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-o handbook.pdf

Response

Returns the file binary content on success. Returns error details on failure.

Error Responses

Status CodeScenarioDescription
401Authentication failedAPI Key is missing, invalid, or has insufficient permissions
422Validation faileddoc_file_path or filename is missing
404File not foundInvalid file path or the file has been deleted
500Download failedFile is inaccessible or server error occurred