Natural-language → grounded, validated SQL
POST/v1/analytics/generate-sql
Turn a natural-language question into grounded, validated, read-only SQL —
the same NL-to-SQL agent the in-product dataset builder uses.
mode controls how far it goes: validate (the default) self-corrects the
query against an EXPLAIN and a LIMIT 5 probe, preview also returns sample
rows, and generate_only never touches the database. The agent is grounded in
your organization's real schema, enum values and custom-field references, so
it produces columns that actually exist.
Feed the returned sql to POST /v1/analytics/datasets or
POST /v1/analytics/run-query. This call runs an LLM and draws AI credits.
Requires the analytics:read scope.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 422
- 429
Successful Response
Error
Error
Error
Error
Validation Error
Error