Execute SQL Query
Changed onRun a saved query. Every body field is optional: a bare POST with an empty body runs the saved query with its stored defaults and the cache enabled. Applies a per-query soft rate cap (rate_limit_rpm, clamped to the plan's hard cap) checked before the per-profile hard cap (rpm_sql_execute); cache hits are charged against a separate cached-read ceiling (rpm_sql_execute_cached).
Authentication accepts either a Profile Token (runs the query directly as its owning profile) or an Access-Management-granted analysis / Run-user token (the token must be granted the execute action on the query by id or tag; the query then runs as its owning profile). The grant authorizes execution, not filtering.
If the query uses session functions (session_user_id, session_user_tag), those values are resolved from the executing user's session at run time, after authorization and before the cache lookup: a Run user gets their own values, the profile owner gets the query's COALESCE fallbacks (a session function with no fallback is a 400), and an analysis is rejected with a 400. A resolved value that matches nothing returns empty data (zero rows, 200), never the fallback.
Request
- Base URLhttps://api.us-e1.tago.io
- AuthAPI key in header Profile-Token
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
The saved query ID.
Request body
Example request
{
"params": [
{
"key": "$1",
"value": "40"
}
],
"after_device": "62a1b3c4d5e6f7a8b9c0d1e2"
}Response
Query result envelope.
Example response
{
"status": true,
"result": {
"columns": [
{
"name": "variable",
"type": "string"
}
],
"row_count": 1,
"execution_ms": 12
}
}Changes
- info
endpoint added
- info