Build Report Definition With AI
POST/api/v2/report-builder/ai-build
Generate a builder report definition from a plain-English request using the AI assistant configured for your account. The definition is checked against the report schema (with one automatic retry) before it is returned; nothing is saved — run it with Run Ad-Hoc Report or save it with Create Custom Report.
reports:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body:
prompt(string, required, max 2000): what you want, e.g. "top 10 SKUs by net revenue last quarter"current_domain(string, optional, max 100) andcurrent_base_entity(string, optional, max 100): hints for where to starthistory(array, optional, max 20): earlier turns of the conversation, each{role: user|assistant, content}(content max 4000); only the last 10 are usedcurrent_definition(object, optional): the draft to refine instead of starting overlast_error(string, optional, max 2000): an error you saw when running the previous draft
Response: definition and a short explanation. Returns 422 with a message when the AI assistant is disabled, no API key is configured, or no valid definition could be produced.
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.