Export Customer Statement
GET/api/customers/:customer/statement/export
Downloads the customer's statement of account as a file. format=pdf (default) returns a branded PDF document (application/pdf); format=csv returns comma-separated rows (text/csv).
Accepts the same statement parameters as the JSON statement endpoint: type (open_item default, or activity), from/to (required when type=activity), and as_at (open_item only).
The response is a file download named customer-statement-{customer-name}-{date}.pdf (or .csv) — not JSON.
CSV columns:
activity: Date, Type, Reference, Description, Debit, Credit, Running Balance — with opening and closing balance rows.open_item: Type, Document, Date, Due Date, Status, Document Currency, Total (Document Currency), Outstanding (base currency) — one row per open order, one negative row per open credit, and a final net_receivable row.
Authentication: Requires Bearer token (PAT). Requires permissions customers.show and sales_orders.index, and a token with the orders scope.
Request
Responses
- 200
- 401
- 403
- 404
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.