Data Export
The Export API lets you create reusable export configurations, execute them on demand, and retrieve data in JSON, CSV, or Excel format. Exports can be accessed externally via time-limited tokens, making it easy to feed Optimaite data into BI tools, CRM systems, or accounting software.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v1/exports/configs | List all export configurations |
POST | /api/v1/exports/configs | Create an export configuration |
GET | /api/v1/exports/configs/{id} | Get an export configuration |
PUT | /api/v1/exports/configs/{id} | Update an export configuration |
DELETE | /api/v1/exports/configs/{id} | Delete an export configuration |
GET | /api/v1/exports/configs/{id}/execute | Execute an export (returns data) |
GET | /api/v1/exports/configs/{id}/preview | Preview export data (limited rows) |
POST | /api/v1/exports/configs/{id}/generate-token | Generate external access token |
GET | /api/v1/exports/configs/{id}/retrieve | Retrieve export via token (public) |
Required scope: reports:read for listing and executing exports, reports:write for creating configurations.
The Export Configuration Object
{
"id": "exp_01ABCDEFG",
"name": "Monthly Revenue Report",
"description": "Revenue grouped by case for the current month",
"source": "invoices",
"format": "xlsx",
"filters": {
"date_from": "2026-05-01",
"date_to": "2026-05-31",
"status": "paid"
},
"columns": [
{ "field": "invoice_number", "label": "Invoice #" },
{ "field": "case_name", "label": "Case" },
{ "field": "party_name", "label": "Client" },
{ "field": "total_gross", "label": "Amount (EUR)" },
{ "field": "paid_at", "label": "Paid Date" }
],
"schedule": null,
"last_executed_at": "2026-05-20T08:00:00Z",
"created_at": "2026-01-15T10:00:00Z"
}
Create an Export Configuration
POST /api/v1/exports/configs
{
"name": "Monthly Revenue Report",
"source": "invoices",
"format": "xlsx",
"filters": {
"date_from": "2026-05-01",
"date_to": "2026-05-31"
},
"columns": [
{ "field": "invoice_number", "label": "Invoice #" },
{ "field": "case_name", "label": "Case" },
{ "field": "total_gross", "label": "Amount (EUR)" }
]
}
Execute an Export
GET /api/v1/exports/configs/{config_id}/execute
Returns the export data in the configured format. The response Content-Type depends on the format:
| Format | Content-Type | Extension |
|---|---|---|
json | application/json | .json |
csv | text/csv | .csv |
xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | .xlsx |
Example: JSON Response
{
"meta": {
"config_id": "exp_01ABCDEFG",
"executed_at": "2026-05-27T09:00:00Z",
"row_count": 42
},
"data": [
{
"invoice_number": "RE-2026-042",
"case_name": "Smith v. Jones",
"total_gross": 2677.50
}
]
}
Preview an Export
GET /api/v1/exports/configs/{config_id}/preview
Returns a limited preview (first 10 rows) of the export data. Useful for validating configuration before running a full export.
External Access (Token-Authenticated)
Generate a time-limited token to allow external systems to retrieve exports without an API key:
POST /api/v1/exports/configs/{config_id}/generate-token
{
"expires_in_hours": 24
}
Response
{
"token": "exp_tok_abc123def456",
"expires_at": "2026-05-28T09:00:00Z"
}
External systems can then retrieve the export:
GET /api/v1/exports/configs/{config_id}/retrieve?token=exp_tok_abc123def456
Use token-authenticated exports to feed data into BI dashboards (Metabase, Tableau), accounting software (DATEV, SevDesk), or CRM systems (Salesforce, HubSpot) via scheduled HTTP requests.
Available Export Sources
| Source | Description | Key Filters |
|---|---|---|
invoices | Invoice data | date, status, case, party |
time_entries | Time tracking data | date, user, case, billable |
cases | Case metadata | status, type, dezernat, date |
parties | Contact data | type, date |
documents | Document metadata | date, case, folder |
deadlines | Deadline data | date, status, case |
Error Responses
| Status | Code | Meaning |
|---|---|---|
| 400 | INVALID_SOURCE | Export source not supported |
| 400 | INVALID_FILTER | Filter value is not valid for the source |
| 403 | AUTH_INSUFFICIENT_SCOPE | Missing reports:read scope |
| 404 | CONFIG_NOT_FOUND | Export configuration does not exist |
| 410 | TOKEN_EXPIRED | External access token has expired |