Developer docs

One endpoint. Natural language in, SQL out.

TTSQL is a single API call. Send a prompt and a project_id, get back SQL for the database connected to that project. Optionally execute it on the spot.

curl /api/v1
ready
curl -X POST https://ttsql.com/api/v1 \
  -H "x-api-key: $TTSQL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Revenue by plan this month",
    "project_id": 1,
    "execute": false
  }'

Tutorial

From prompt to SQL in three steps.

The whole product is one POST. Create a project in the dashboard so TTSQL knows your schema, generate an API key, then call /api/v1 with your prompt. Set execute: true to also run the generated SQL against the database connected to that project.

  1. 01 Create a project and connect its database/schema in the dashboard.
  2. 02 Generate an API key on the API Keys page.
  3. 03 POST a prompt to /api/v1 and read query from the response.
Guide 01

Make your first text-to-SQL request

Send a prompt and the project_id whose schema TTSQL should use. The response includes the generated SQL. Add execute: true to also run it against that project's connected database.

Generate SQL curl
curl -X POST https://ttsql.com/api/v1 \
  -H "x-api-key: $TTSQL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Revenue by plan this month",
    "project_id": 1,
    "execute": false
  }'

Endpoint reference

The whole API: one product endpoint, plus health and metrics.

TTSQL exposes a single text-to-SQL endpoint at POST /api/v1. Auth is via the x-api-key header. The two remaining routes are for ops: a liveness probe and Prometheus metrics.

Query

Text-to-SQL generation

The single endpoint applications call when users ask questions about data.

POST /api/v1 API key

Generate SQL from a prompt

Send a natural-language prompt and a project_id. TTSQL returns SQL. Pass execute: true to run the query against the project's connected database.

Request curl
curl -X POST https://ttsql.com/api/v1 \
  -H "x-api-key: $TTSQL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Revenue by plan this month",
    "project_id": 1,
    "execute": false
  }'
Response json
{
  "status": "success",
  "query": "SELECT plan, SUM(amount) AS revenue FROM invoices GROUP BY plan",
  "executed": false,
  "metadata": {
    "project_id": 1,
    "api_key_id": 42,
    "timestamp": "2026-05-25T14:30:00Z"
  }
}
Ops

Health & metrics

For monitors, status pages, and deploy checks.

GET /api/v1/health Public

Liveness probe

Returns 200 when the service can accept traffic.

Request curl
curl https://ttsql.com/api/v1/health
Response json
{
  "status": "ok",
  "version": "v1"
}
GET /api/metrics Public

Export Prometheus metrics

Scrape from Prometheus to collect latency, error, and request counters.

Request curl
curl https://ttsql.com/api/metrics
Response json
{
  "format": "prometheus",
  "scrape": "/api/metrics"
}

Get in touch

Bring natural-language SQL into your product.

Self-serve via the dashboard, or reach out if you want dedicated support or a tailored deployment.