# Natural Language to SQL Translator (Schema-Aware, Read-Only Flagged)

> Natural Language to SQL Translator (Schema-Aware, Read-Only Flagged) is a paid API for AI agents from twin.unykorn.org, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-01).

Converts a natural language question into a SQL query tailored to a user-supplied schema, supporting Postgres, MySQL, SQLite, and BigQuery dialects, with read-only safety flagging.

## Facts

- Endpoint: POST https://twin.unykorn.org/ai/text-to-sql?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/natural-language-to-sql-translator-schema-aware-read-only-flagged-466621dd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_D3iFXF_3JlWtrGRSP1fa1

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability natural-language-to-sql-translator-schema-aware-read-only-flagged-466621dd -d '<json body>'
```

Example prompt: Using my Postgres schema (with tables orders, customers, and products defined by these CREATE TABLE statements: ...), write a SQL query that answers: 'Which customers placed more than 5 orders in the last 30 days?'

## When to prefer this

Choose this endpoint when you need schema-aware, dialect-specific SQL generation grounded in your actual database structure, rather than generic SQL snippets. Prefer it over generic LLM prompting when you need read-only safety guarantees, support for a specific SQL dialect (Postgres, MySQL, SQLite, BigQuery), and a structured API contract with predictable pricing. Ideal for building natural language interfaces over existing databases in agentic pipelines.

## Known failure modes

- Schema too large — exceeds the 12,000-character limit for CREATE TABLE statements
- Question too long — exceeds the 1,000-character question limit
- Ambiguous question that cannot be mapped to schema columns without clarification
- Unsupported dialect value provided
- Schema references tables or columns not defined in the provided CREATE TABLE statements
- Payment not included or insufficient (x402 payment required at $0.01 USDC)

## How this service works

Natural language to SQL for YOUR schema (Postgres, MySQL, SQLite, BigQuery), read-only flagged — Genesis402 / UnyKorn Operator Network

## Output

Returns a generated SQL query string matched to the provided schema and dialect, phrased to answer the natural language question. The response is flagged as read-only safe, meaning the generated SQL is a SELECT statement or equivalent that will not mutate data.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "params": {
   "type": "object",
   "properties": {
    "schema": {
     "type": "string",
     "description": "required: CREATE TABLE statements, up to 12,000 chars"
    },
    "dialect": {
     "enum": [
      "postgres",
      "mysql",
      "sqlite",
      "bigquery"
     ],
     "type": "string",
     "description": "optional: postgres | mysql | sqlite | bigquery"
    },
    "question": {
     "type": "string",
     "description": "required, up to 1,000 chars"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "type": "text-to-sql",
  "receipt": {
   "tx_hash": "0x<64hex>",
   "amount_usd": 0.01,
   "receipt_id": "g402-<16hex>"
  },
  "sources": [
   {
    "ok": true,
    "name": "<source>"
   }
  ],
  "limitations": "<text>",
  "generated_at": "<iso time>",
  "evidence_hash": "sha256:<64hex>"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/natural-language-to-sql-translator-schema-aware-read-only-flagged-466621dd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from twin.unykorn.org](https://www.zero.xyz/host/twin.unykorn.org/llms.txt)
