REST API
Exports
Asynchronous export of company data — contacts, messages, or segments — to CSV, XLSX, or JSON. The request queues a background job and immediately returns the export object in `pending` status; readiness is polled via `GET /exports/{id}`, and the file is downloaded from `download_url` once the status is `completed`. The `messages` export type is capped at five runs per day per company.
Endpoints
| Method | Path | Summary |
|---|---|---|
| GET | /v1/exportsList exports | List exports |
| POST | /v1/exportsCreate an export | Create an export |
| GET | /v1/exports/{export}Get an export (status, size, row count) | Get an export (status, size, row count) |
| GET | /v1/exports/{export}/downloadDownload the finished export file | Download the finished export file |
| DELETE | /v1/exports/{export}Delete an export | Delete an export |
Examples
Create a contacts export
Request
bash
curl -X POST https://api.aisar.app/v1/exports \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "contacts",
"format": "csv",
"filters": { "segment_id": 12 }
}'Response
json
{
"data": {
"message": "Export started.",
"export": {
"id": 301,
"uuid": "9f1c2e40-6b3a-4e9e-9d2a-1f7a8c0b5d21",
"type": "contacts",
"name": "Contacts export",
"format": "csv",
"status": "pending",
"filters": { "segment_id": 12 },
"row_count": null,
"file_size": null,
"error_message": null,
"download_url": null,
"expires_at": "2026-03-22T10:00:00.000000Z",
"created_at": "2026-03-15T10:00:00.000000Z",
"updated_at": "2026-03-15T10:00:00.000000Z"
}
}
}Poll export status
Request
bash
curl https://api.aisar.app/v1/exports/301 \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
json
{
"data": {
"id": 301,
"uuid": "9f1c2e40-6b3a-4e9e-9d2a-1f7a8c0b5d21",
"type": "contacts",
"name": "Contacts export",
"format": "csv",
"status": "completed",
"filters": { "segment_id": 12 },
"row_count": 340,
"file_size": 48213,
"error_message": null,
"download_url": "https://api.aisar.app/v1/exports/301/download",
"expires_at": "2026-03-22T10:00:00.000000Z",
"created_at": "2026-03-15T10:00:00.000000Z",
"updated_at": "2026-03-15T10:02:31.000000Z"
}
}