API Reference›Query Runs
API Reference

Query Runs

See the queries run in a database, with their SQL, status, timing and result ID.

List query runs

GET/v1/query-runs

List 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

NameTypeDescription
limitintegerRuns per page. Default 100, maximum 1000.
cursorstringThe next_cursor from the previous page
statusstringFilter by status, comma-separated, for example status=running,failed. Values: running, succeeded, failed, interrupted.
saved_query_idstringFilter by saved query ID

Headers

NameTypeDescription
X-Database-Id (required)stringDatabase ID. Required.

Response 200 — List of query runs

NameTypeDescription
count (required)integer
has_more (required)boolean
limit (required)integer
next_cursorstring
query_runs (required)QueryRunInfo[]
Fields of query_runs
NameTypeDescription
query_runs[].bytes_scannedintegerBytes 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_atstring
query_runs[].created_at (required)string
query_runs[].error_messagestringWhy the run failed.
query_runs[].execution_time_msinteger
query_runs[].id (required)string
query_runs[].result_idstringID of the saved result, ready to fetch once status is succeeded. Absent when no result was saved; warning_message then says why.
query_runs[].rollupRollupUsage
query_runs[].row_countintegerNumber of rows in the full result.
query_runs[].rows_scannedintegerRows the query read, before filtering or aggregation. Null when the query read no table.
query_runs[].saved_query_idstringID of the saved query this run executed, if any.
query_runs[].saved_query_versionintegerVersion of the saved query this run executed, if any.
query_runs[].server_processing_msintegerTime 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)stringrunning, succeeded, failed or interrupted. An interrupted run stopped before finishing and is safe to retry.
query_runs[].trace_idstring
query_runs[].user_public_idstringAccount that ran the query, taken from the access token. A credential with no account gets a stable user_-prefixed ID instead.
query_runs[].warning_messagestringA 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

StatusDescription
400Missing or malformed X-Database-Id header
404Database 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

NameTypeDescription
id (required)stringQuery run ID

Headers

NameTypeDescription
X-Database-Id (required)stringID of the database the query ran in. Required.

Response 200 — Query run details

NameTypeDescription
bytes_scannedintegerBytes 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_atstring
created_at (required)string
error_messagestringWhy the run failed.
execution_time_msinteger
id (required)string
result_idstringID of the saved result, ready to fetch once status is succeeded. Absent when no result was saved; warning_message then says why.
rollupRollupUsage
row_countintegerNumber of rows in the full result.
rows_scannedintegerRows the query read, before filtering or aggregation. Null when the query read no table.
saved_query_idstringID of the saved query this run executed, if any.
saved_query_versionintegerVersion of the saved query this run executed, if any.
server_processing_msintegerTime 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)stringrunning, succeeded, failed or interrupted. An interrupted run stopped before finishing and is safe to retry.
trace_idstring
user_public_idstringAccount that ran the query, taken from the access token. A credential with no account gets a stable user_-prefixed ID instead.
warning_messagestringA 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

StatusDescription
400Missing or malformed X-Database-Id header
404Query run or database not found