Export Documents
## Overview
Export multiple documents that match the specified filters and send the resulting file (for example, a CSV export) to one or more email recipients.
## Request Headers
| Attribute | Type | Option | Description |
| --- | --- | --- | --- |
| x-api-key | String | Required | API key for the tenant |
| Authorization | String | Required | Bearer access token |
## Request Body
The request body must be a JSON object with the following fields:
```json
{
"qids": [13315],
"state": ["COMPLETED"],
"labels": ["example-label"],
"docType": "CSV",
"language": "EN",
"emails": [
"user@example.com"
]
}
```
### Body Fields
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `qids` | Array(Int) | Optional | List of queue IDs to include in the export. Only documents belonging to these queues are considered. All values must be integers. |
| `state` | Array(String) | Optional | List of document states to export. Common values include `"COMPLETED"`, `"EXPORTED".` |
| `labels` | Array(String) | Optional | One or more document labels to further filter the export set. |
| `docType` | String | Required | Output format of the export file. Supported values typically include `"CSV"`. |
| `language` | String | Optional | Language code for localized export content, where applicable. For example: `"EN"`. |
| `emails` | Array(String) | Required | List of recipient email addresses. The generated export file or download link is sent to these addresses. |
Authentication
x-api-keystring
API key issued by Staple.
AuthorizationBearer
JWT obtained from the login endpoint.
Request
This endpoint expects an object.
qids
state
labels
docType
language
emails
Response
OK