Ledga
POST /reports/custom/{savedReport}/export

Export a saved custom report

Exports the report's transactions as CSV or XLSX, with its columns, sort and totals, as of the request: later transactions are left out and relative dates resolve to the ledger's current day. Poll GET /api/v1/exports/{export} until completed, then download. The body holds only format and an optional idempotency_key (or Idempotency-Key header). The same key on this ledger, for the same report and format, returns that export with meta.replayed: true; otherwise it is refused on idempotency_key. A broken report returns INVALID_REFERENCE.

Parameters

NameInTypeDescription
savedReportrequired path string
uuid
Idempotency-Key header string
max length: 255

Request bodyrequired

FieldTypeDescription
formatrequired string
enum: csv | xlsx
idempotency_key string
max length: 255 · nullable

Responses

200A replay of an idempotency key: the export it started, with meta.replayed: true
{
  "success": true,
  "meta": {
    "replayed": true
  },
  "data": {
    "id": "01997c1e-4d2a-7c3e-9a1b-2f0e8c6d4b5a",
    "export_type": "transactions",
    "format": "csv",
    "status": "pending",
    "as_of": null,
    "start_date": null,
    "end_date": null,
    "definition": null,
    "row_count": null,
    "file_size": null,
    "error_message": null,
    "download_url": null,
    "created_at": "2026-01-15T10:30:00Z",
    "completed_at": null,
    "failed_at": null
  }
}
202The export, started
{
  "success": true,
  "meta": {
    "replayed": true
  },
  "data": {
    "id": "01997c1e-4d2a-7c3e-9a1b-2f0e8c6d4b5a",
    "export_type": "transactions",
    "format": "csv",
    "status": "pending",
    "as_of": null,
    "start_date": null,
    "end_date": null,
    "definition": null,
    "row_count": null,
    "file_size": null,
    "error_message": null,
    "download_url": null,
    "created_at": "2026-01-15T10:30:00Z",
    "completed_at": null,
    "failed_at": null
  }
}
404Not this ledger's, or unknown
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
409EXPORTS_IN_PROGRESS: the ledger, or this key, has as many exports in progress as it may
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
422INVALID_REFERENCE for a broken report; AMOUNT_NOT_READY or SEARCH_NOT_READY as for a search; a format other than CSV or XLSX, any other body member, or an idempotency key used for another export
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}
429The export limit
{
  "success": false,
  "message": "Validation failed",
  "code": "VALIDATION_ERROR"
}

Examples

curl -X POST https://ledga.io/api/v1/reports/custom/{savedReport}/export \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret" \
  -H "Content-Type: application/json" \
  -d '{
  "format": "csv"
}'

← All endpoints