Download Selected Documents
Download extracted data for one or more documents, with options for JSON, CSV, XLSX, or a QuickBooks-compatible CSV format. Multiple documents are returned in a ZIP archive.
Overview
The Download Selected Documents endpoint facilitates bulk export of processed document data. You can request data for up to 300 documents at a time. The system will convert the extracted data into the chosen format. For bank statements, both CSV and XLSX formats are supported with specific structures. Invoices and receipts also support CSV, XLSX, and a specific CSV format for easy import into QuickBooks.
If only one document is requested, the file will be returned directly. If multiple documents are requested, a ZIP archive containing individual files will be returned.
Request
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
format | string | No | The desired output format for the extracted data. Valid values are 'json', 'csv', 'xlsx', or 'quickbooks_csv'. Defaults to 'json'. |
Headers
Name | Type | Required | Description |
---|---|---|---|
X-API-Key | string | Yes | Your API key for authentication. |
Request Body
The request body must be a JSON object containing a list of document UUIDs.
- `document_ids` (array of strings [UUID]): A list of unique identifiers for the documents you want to download.
```json
{
"document_ids": [
"a1b2c3d4-e5f6-7890-1234-567890abcdef",
"b2c3d4e5-f6a7-8901-2345-67890abcdef0"
]
}
Code Examples
curl -X POST "https://api.yourapp.com/api/v1/documents/download_selected?format=csv" \
-H "X-API-Key: pk_abcd1234_secretsecretsecretsecretsecret" \
-H "Content-Type: application/json" \
-d '{ "document_ids": ["a1b2c3d4-e5f6-7890-1234-567890abcdef"] }'
Response Example
Successful response returning the requested document data as a file (JSON, CSV, XLSX, or ZIP archive).
(Binary file content: JSON, CSV, XLSX, or ZIP archive)
Response Example
Unsupported format or too many documents requested.
{
"detail": "Unsupported format: xyz"
}
Response Example
Authentication failed due to an invalid or missing API key.
{
"detail": "Invalid API key."
}
Response Example
No accessible documents found for the specified IDs or no processing results available.
{
"detail": "No accessible documents found for the specified IDs."
}
Response Example
Failed to generate any valid files for the requested format.
{
"detail": "Failed to generate any valid CSV files."
}