Query Runs
See the queries run in a database, with their SQL, status, timing and result ID.
List query runs
GET
/v1/query-runsList the query runs in the database named by the X-Database-Id header, newest first, one page at a time. If has_more is true, pass next_cursor as cursor to get the next page.
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Runs per page. Default 100, maximum 1000. |
cursor | string | The next_cursor from the previous page |
status | string | Filter by status, comma-separated, for example status=running,failed. Values: running, succeeded, failed, interrupted. |
saved_query_id | string | Filter by saved query ID |
Headers
| Name | Type | Description |
|---|---|---|
X-Database-Id (required) | string | Database ID. Required. |
Response 200 — List of query runs
| Name | Type | Description |
|---|---|---|
count (required) | integer | |
has_more (required) | boolean | |
limit (required) | integer | |
next_cursor | string | |
query_runs (required) | QueryRunInfo[] |
Fields of query_runs
| Name | Type | Description |
|---|---|---|
query_runs[].bytes_scanned | integer | Bytes the query read from storage. Cached data is not counted, so a repeated query often reports 0; null when the query read no table. |
query_runs[].completed_at | string | |
query_runs[].created_at (required) | string | |
query_runs[].error_message | string | Why the run failed. |
query_runs[].execution_time_ms | integer | |
query_runs[].id (required) | string | |
query_runs[].result_id | string | ID of the saved result, ready to fetch once status is succeeded. Absent when no result was saved; warning_message then says why. |
query_runs[].rollup | RollupUsage | |
query_runs[].row_count | integer | Number of rows in the full result. |
query_runs[].rows_scanned | integer | Rows the query read, before filtering or aggregation. Null when the query read no table. |
query_runs[].saved_query_id | string | ID of the saved query this run executed, if any. |
query_runs[].saved_query_version | integer | Version of the saved query this run executed, if any. |
query_runs[].server_processing_ms | integer | Time from query start until the result was ready, in milliseconds. Excludes network time. |
query_runs[].snapshot_id (required) | string | |
query_runs[].sql_hash (required) | string | |
query_runs[].sql_text (required) | string | |
query_runs[].status (required) | string | running, succeeded, failed or interrupted. An interrupted run stopped before finishing and is safe to retry. |
query_runs[].trace_id | string | |
query_runs[].user_public_id | string | Account that ran the query, taken from the access token. A credential with no account gets a stable user_-prefixed ID instead. |
query_runs[].warning_message | string | A problem that did not fail the run, such as a result that could not be saved. |
Example response
{
"count": 0,
"has_more": true,
"limit": 0,
"next_cursor": "string",
"query_runs": [
{
"bytes_scanned": 0,
"completed_at": "2026-01-01T00:00:00Z",
"created_at": "2026-01-01T00:00:00Z",
"error_message": "string",
"execution_time_ms": 0,
"id": "string",
"result_id": "string",
"rollup": "used",
"row_count": 0,
"rows_scanned": 0,
"saved_query_id": "string",
"saved_query_version": 0,
"server_processing_ms": 0,
"snapshot_id": "string",
"sql_hash": "string",
"sql_text": "string",
"status": "string",
"trace_id": "string",
"user_public_id": "string",
"warning_message": "string"
}
]
}
Errors
| Status | Description |
|---|---|
400 | Missing or malformed X-Database-Id header |
404 | Database not found |
Get query run
GET
/v1/query-runs/{id}Get a query run's status and details. Send the X-Database-Id header of the database the query ran in.
Path parameters
| Name | Type | Description |
|---|---|---|
id (required) | string | Query run ID |
Headers
| Name | Type | Description |
|---|---|---|
X-Database-Id (required) | string | ID of the database the query ran in. Required. |
Response 200 — Query run details
| Name | Type | Description |
|---|---|---|
bytes_scanned | integer | Bytes the query read from storage. Cached data is not counted, so a repeated query often reports 0; null when the query read no table. |
completed_at | string | |
created_at (required) | string | |
error_message | string | Why the run failed. |
execution_time_ms | integer | |
id (required) | string | |
result_id | string | ID of the saved result, ready to fetch once status is succeeded. Absent when no result was saved; warning_message then says why. |
rollup | RollupUsage | |
row_count | integer | Number of rows in the full result. |
rows_scanned | integer | Rows the query read, before filtering or aggregation. Null when the query read no table. |
saved_query_id | string | ID of the saved query this run executed, if any. |
saved_query_version | integer | Version of the saved query this run executed, if any. |
server_processing_ms | integer | Time from query start until the result was ready, in milliseconds. Excludes network time. |
snapshot_id (required) | string | |
sql_hash (required) | string | |
sql_text (required) | string | |
status (required) | string | running, succeeded, failed or interrupted. An interrupted run stopped before finishing and is safe to retry. |
trace_id | string | |
user_public_id | string | Account that ran the query, taken from the access token. A credential with no account gets a stable user_-prefixed ID instead. |
warning_message | string | A problem that did not fail the run, such as a result that could not be saved. |
Example response
{
"bytes_scanned": 0,
"completed_at": "2026-01-01T00:00:00Z",
"created_at": "2026-01-01T00:00:00Z",
"error_message": "string",
"execution_time_ms": 0,
"id": "string",
"result_id": "string",
"rollup": "used",
"row_count": 0,
"rows_scanned": 0,
"saved_query_id": "string",
"saved_query_version": 0,
"server_processing_ms": 0,
"snapshot_id": "string",
"sql_hash": "string",
"sql_text": "string",
"status": "string",
"trace_id": "string",
"user_public_id": "string",
"warning_message": "string"
}
Errors
| Status | Description |
|---|---|
400 | Missing or malformed X-Database-Id header |
404 | Query run or database not found |