Skip to main content
POST
Run report SQL

Authorizations

Authorization
string
header
required

An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.

Body

application/json
sql
string
required

Send one SELECT (WITH, UNION, INTERSECT and EXCEPT are fine) over the report views GET /v1/reports/sources lists, named without a schema. Only listed functions run: aggregates; window functions; common date, number, text, array and conditional functions; and JSON field access (->, ->>, #>, #>>). JSON-building functions (such as json_agg) and operators such as ~*, @> and && aren't available. Any other function, a table that isn't a report view, another schema, or a setting is refused with a 422 listing each problem.

Required string length: 1 - 20000
limit
integer
default:100

The most rows to return

Required range: 1 <= x <= 1000

Response

200 - application/json

Successful Response

columns
ReportQueryColumn · object[]
required
rows
any[][]
required

Each row's values, in the columns' order

sql
string
required

Your statement as it ran: checked, without comments or your workspace's schema name, and with some spellings normalized (now() reads CURRENT_TIMESTAMP, x::text reads CAST(x AS TEXT)). limit is applied around it

truncated
boolean
required

Whether the query had more rows than limit