Run a read-only SQL query
const url = 'https://example.com/query/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"sql":"example","restrict_tables":["example"],"row_limit":100}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/query/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "sql": "example", "restrict_tables": [ "example" ], "row_limit": 100 }'Execute one SELECT through the read-only SQL sandbox.
The statement must be a single SELECT over data.* tables you can
access, name every table in restrict_tables, and fit the sandbox’s
function allowlist and cost bounds. Rows are capped by row_limit and
execution by a server-side statement timeout.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”One read-only SELECT plus its mandatory table scope.
object
A single SELECT statement over data.* tables.
Table names (without the data. prefix) the query may touch. Required and non-empty; intersected with your access — it can only narrow what you already see, never widen it.
Maximum rows to return.
Responses
Section titled “ Responses ”Successful Response
Structured result from sandbox query execution.
Uses list-of-lists for rows (not list-of-dicts) for serialization performance.
object
Example generated
{ "rows": [ [ "example" ] ], "columns": [ "example" ], "row_count": 1, "truncated": true}Bad request — invalid query parameters or payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks access to this resource
Not found
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request