Skip to content

Execute Query

POST
/api/v1/query/execute
curl --request POST \
--url https://example.com/api/v1/query/execute \
--header 'Content-Type: application/json' \
--data '{ "query": "example", "parameters": {}, "cache_ttl": 300 }'

Execute a read-only analytics SQL query.

Queries are validated (single read-only statement, no direct datasource access), scoped to the caller’s projects via the events CTE, rate limited per principal, resource-capped (timeout + row limit), and cached per cache_ttl.

Media typeapplication/json
QueryRequest

Request model for analytics queries.

object
query
required
Query

Read-only SQL statement to run against analytics data

string
parameters
Parameters

Query-context overrides (allowed: [‘populateCache’, ‘sqlOuterLimit’, ‘sqlTimeZone’, ‘timeout’, ‘useCache’])

object
key
additional properties
any
cache_ttl
Cache Ttl

Cache TTL in seconds

integer
default: 300 <= 3600

Successful Response

Media typeapplication/json
QueryResponse

Response model for query results.

object
success
required
Success
boolean
rows
required
Rows
Array<object>
object
key
additional properties
any
row_count
required
Row Count
integer
execution_time_ms
required
Execution Time Ms
number
cached
Cached
boolean
Example
{
"cached": false
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}