API: Query
Run read-only SQL against a source. All endpoints require authentication unless noted. 7 endpoints.
POST /api/query/batch
Section titled “POST /api/query/batch”Execute multiple ChartSpec queries in a single batch
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
specs |
array of object | yes | |
forceRefresh |
boolean | no |
Responses: 200
DELETE /api/query/cache/{modelId}
Section titled “DELETE /api/query/cache/{modelId}”Clear cached query results for a model
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
modelId |
string | yes |
Responses: 200 · 400 · 401 · 404
POST /api/query/card-data
Section titled “POST /api/query/card-data”Run the saved query backing a dashboard card (view-gated)
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
dashboardId |
string | yes | |
cardId |
string | yes | |
limit |
integer | no | |
filters |
array of object | no | |
distinctColumn |
string | no |
Responses: 200 · 400 · 401 · 404
POST /api/query/distinct
Section titled “POST /api/query/distinct”Get distinct values for a field (for slicers/filters)
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
modelId |
string | yes | |
sourceId |
string | yes | |
fieldId |
string | yes | |
limit |
number | no |
Responses: 200
POST /api/query/execute
Section titled “POST /api/query/execute”Execute a ChartSpec query against a semantic model
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
modelId |
string | yes | |
sourceId |
string | yes | |
xField |
object | no | |
yFields |
array of object | yes | |
colorField |
object | no | |
smallMultiples |
object | no | |
sizeField |
object | no | |
tooltipFields |
array of object | no | |
filters |
array of object | no | |
sort |
array of object | no | |
limit |
integer | no | |
offset |
integer | no | |
forceRefresh |
boolean | no |
Responses: 200 · 400 · 401 · 404
POST /api/query/raw
Section titled “POST /api/query/raw”Execute raw SQL against a data source (admin/editor only)
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
sourceId |
string | yes | |
sql |
string | yes | |
limit |
integer | no |
Responses: 200 · 400 · 401 · 404
POST /api/query/report-block-data
Section titled “POST /api/query/report-block-data”Run the saved query backing a report block (view-gated)
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
reportId |
string | yes | |
savedQueryId |
string | yes | |
limit |
integer | no |
Responses: 200 · 400 · 401 · 404