Skip to main content
POST
SQL query

Authorizations

Authorization
string
header
required

Cube API token (a JWT). Sent directly in the Authorization header, e.g. Authorization: <CUBE_API_TOKEN> (no "Bearer" prefix).

Body

application/json
query
string
required

The SQL query to run.

timezone
string

Time zone for the query in TZ database name format, e.g. America/Los_Angeles.

params
object[]

Values of the :name parameters in query, e.g. [{"name": "status", "value": "shipped", "type": "string"}]. number, string, time (an ISO 8601 timestamp string) and boolean values are literals of that type; a time offset is converted to UTC, and a time without one is UTC. An expr value is a SQL expression, which can't contain subqueries or parameters. A null value is SQL NULL of any type. Names are case-sensitive: :Status takes the Status value. Each name may appear only once. Every parameter in query needs a value; values not used in query are ignored, but must still match their type.

cache
enum<string>
default:stale-if-slow

In-memory cache strategy (see Cache control):

  • stale-if-slow (default): if refresh keys are up to date, return the cached value; if expired, fetch fresh data but fall back to the stale value when the source query is slow.
  • stale-while-revalidate: if expired, return stale data immediately and refresh the cache in the background.
  • must-revalidate: if expired, always wait for fresh data from the source, even if slow.
  • no-cache: skip refresh-key checks and always query the data source.
Available options:
stale-if-slow,
stale-while-revalidate,
must-revalidate,
no-cache

Response

200 - application/json

Newline-delimited JSON stream. The first line carries schema (and optionally lastRefreshTime, external and usedPreAggregations); subsequent lines carry data chunks.

schema
object[]
lastRefreshTime
string<date-time>
external
boolean
usedPreAggregations
object
data
any[][]