Read-only SQL over the public dataset
run_sqlOne SELECT (or WITH) over the public data-layer tables. Enforced in the database, not the worker: a read-only transaction as a role that can see only those tables, a statement timeout set by the TIER, and a hard 300-row cap. No semicolons, no comments, no multi-statement.
Priced by the time it takes: one Query Unit per started 5 seconds, floor of 1 — so a query that answers quickly costs 1, which is what every query cost before this was metered. tier buys the ceiling (standard 15s, extended 60s and a paid plan); the tier maximum is HELD when the call starts and the unused part released the moment the duration is known, so usage.units_charged on the response is the settled figure. Call get_account for the tier table, or send explain_only to be quoted without running or paying for anything.
Wraps POST /v0/sql. Access: an organization API key on any plan, metered against that organization’s Query Unit balance at 1 unit per started 5 seconds of query time. A paid plan buys the longer 60-second tier, not the route. A trial key belongs to no organization and is refused with the x402 price of one query instead of being served.
Returns:
rows: Result rows.
row_count: Number of rows returned.
duration_ms: Server-side execution time. This is what the call is priced on.
authenticated: Whether a key was accepted.
tier: The CREDENTIAL:
anonymous,trial, or an organization tier.sql_tier: The QUERY: which ceiling this run was given and priced at. A separate field from
tier, which has always meant the credential.quote: What the query was quoted at before it ran: the tier's ceiling and price bounds, plus the planner's own
planner_costandplan_rows. The planner figures are ADVISORY — arbitrary units, uncalibrated against this schema — and never charge anything; settlement is from measured duration, which needs no calibration to be right.usage: What this call cost and what is left.
units_chargedis SETTLED, not the hold: the tier maximum is taken up front and the unused part released once the duration is known.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single read-only SELECT (or WITH) statement over the public dataset. No semicolons, no comments, no platform internals. Row cap 300. | |
| limit | No | Rows to return. Clamped to 300. |