Export Ad-Hoc Report
POST/api/v2/report-builder/export
Export an unsaved report definition as an XLSX or PDF file (up to 10,000 rows). To export a saved report, use Export Custom Report.
reports:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body:
definition(object, required): a builder definition (same rules as Run Ad-Hoc Report)format(string, required):xlsxorpdfname(string, optional, max 255): used as the file name prefix and PDF title (defaultReport)pivot_grid(object, optional, XLSX only): a pre-computed pivot layout to write instead of the flat rows —headerandbodyare arrays of rows,grandTotalan optional row; each cell is{v, merge, role, numberFormat, decimals}wheremergespans columns,rolemarks labels and totals (row-label,row-total,col-total,grand-label,grand-total) andnumberFormatiscurrency,percentage,decimalornumber
Response: JSON with filename, base64-encoded content and mime_type. Returns 422 for an invalid definition.
Authentication: Bearer token (Personal Access Token). Personal access tokens need the reports:write scope.
Request
Responses
- 200
- 401
- 403
- 422
- 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.
Unprocessable Entity
Response Headers
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.