ai

SQL query generator

Write a SQL query from a plain-language question, for PostgreSQL, MySQL, SQLite, SQL Server or BigQuery. Give it the table layout (CREATE TABLE statements or a description of the columns) and the question; it returns the query, an explanation, the assumptions it had to make about your schema, and warnings such as a missing index or an ambiguous join. Read-only by default: it will not write DELETE or UPDATE unless the question asks for a change, and it says so when it does. Costs 10 credits per call with an API key or a signed-in session, drawn from the same monthly balance as REST calls (1 credit) and renders (25). Without either, a small free demo allowance per day. Also available on the MCP server as generate_sql.

post/api/v1/ai/sql-from-question

Request

  • Base URL: https://toolforte.com
  • URL: https://toolforte.com/api/v1/ai/sql-from-question
  • Auth: one of:
    • HTTP bearer
    • none

Request body

questionstring required

The question in plain words, for example 'customers who ordered twice in March but not since'.

dialect'postgres' | 'mysql' | 'sqlite' | 'sqlserver' | 'bigquery' required

The database the query must run on.

schemastring

Optional: CREATE TABLE statements or a description of the tables and columns.

Response

The tool's answer plus metering

okboolean

Changes

No recorded changes to this operation across all 1 revision of this API.