Skip to main content
POST
Run SQL query
Queries are read-only. Only SELECT statements are permitted — any write, DDL, or transaction-control statement is rejected.

Writing queries

  • Human-readable names. Reference tables and fields by the same names you see in the Zite SDK, not physical column names (e.g. SELECT "Name" FROM "Orders").
  • Bind parameters. Pass user-supplied values in params and reference them with positional placeholders ($1, $2, …). This is safer than interpolating values into the SQL string.
  • Linked records. Join through link tables to traverse relationships. Use Get SQL Schema to discover table names, field names, and link tables.

Limits

If truncated is true, narrow the query with a WHERE clause or add your own LIMIT/OFFSET to page through results.

Authorizations

Authorization
string
header
required

Enter your Zite API key. Format: Bearer <api_key>

Path Parameters

databaseId
string
required

The unique identifier of the database

Body

application/json
sql
string
required

The read-only SELECT statement to execute. Reference tables and fields by their human-readable names (the same names used by the Zite SDK), not physical column names. Bind user-supplied values with positional placeholders ($1, $2, ...) rather than string interpolation.

Maximum string length: 50000
params
any[]

Ordered bind values for the $1, $2, ... placeholders in sql.

Maximum array length: 1000

A JSON value (string, number, boolean, or null) bound to the matching $1, $2, ... placeholder.

statementTimeoutMs
integer
default:10000

Per-statement timeout in milliseconds. Defaults to 10000 (10 seconds). Capped at 60000 (60 seconds).

Required range: 1 <= x <= 60000

Response

Query results

rows
object[]
required

The result rows. Each row is an object keyed by result column name.

columns
object[]
required

Ordered metadata describing each result column.

rowCount
integer
required

The number of rows returned (after any truncation).

truncated
boolean
required

True when the result exceeded the 2000-row cap and was truncated. Narrow the query or add a LIMIT to avoid truncation.