Suparse
API Documentation

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.

POST/api/v1/documents/download_selected

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

NameTypeRequiredDescription
formatstringNoThe desired output format for the extracted data. Valid values are 'json', 'csv', 'xlsx', or 'quickbooks_csv'. Defaults to 'json'.

Headers

NameTypeRequiredDescription
X-API-KeystringYesYour 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

200

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

400

Unsupported format or too many documents requested.

{
  "detail": "Unsupported format: xyz"
}
 

Response Example

401

Authentication failed due to an invalid or missing API key.

{
  "detail": "Invalid API key."
}
 

Response Example

404

No accessible documents found for the specified IDs or no processing results available.

{
  "detail": "No accessible documents found for the specified IDs."
}
 

Response Example

500

Failed to generate any valid files for the requested format.

{
  "detail": "Failed to generate any valid CSV files."
}