Run Custom Report
POST/api/v2/custom-reports/:customReport/run
Run a saved report you can see.
reports:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body:
limit(integer, optional): row cap, max 5000; defaults to the definition'slimit, else 500
Builder reports: columns (one entry per definition column with id, kind, entity, field, label, alias, aggregation, formula, format, decimals), rows (objects keyed by each column's alias, which is entity__field), row_count, sql (the generated query with ? placeholders), raw_sql (the same query with its values inlined, ready to use as the starting point of an SQL report) and took_ms. When the database estimates the query will scan more than 500,000 rows it runs in the background instead: the response is 202 with queued, tracked_job_log_id and estimated_rows, and the finished file is available from that background job's results.
SQL reports (mode = sql): the response has the SQL result shape — columns (name, type, native_type), rows, row_count, truncated, duration_ms, warnings, sql_executed. Anyone who can see the report may run it; the statement is re-validated on every run and executes under the same read-only safeguards as Run SQL Statement. SQL reports are rate limited per user: by default 30 runs and exports combined per minute; over the limit the endpoint returns 429 with a Retry-After header (seconds).
Returns 404 if the report is not found and 422 if its definition is invalid.
Authentication: Bearer token (Personal Access Token). Personal access tokens need the reports:write scope.
Request
Responses
- 200
- 202
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Accepted
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
Response Headers
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Too Many Requests