---
title: "Get a query"
method: GET
path: "/v1/queries/:job_key"
---

# Get a query

`GET /v1/queries/:job_key`

Get the status of a previously-submitted query

## Path parameters

- `job_key` string, required

## Query parameters

- `num_rows` string

## Response `200`

Successful response

- object — Base response envelope for all successful API responses.
  - `success` true, required
  - `request_id` string, required
  - `result` Query, required — Query status
    - `job_key` string, required — The unique identifier for the query job
    - `status` union, required — The current status of the job
      - 'running' — The query has been submitted, but the results are not ready to be fetched yet.
      - 'completed' — The query has finished, and results are ready to be fetched.
      - 'error' — The query failed during compilation, submission, or execution.
    - `error` string — An error encountered during query compilation, submission, or execution.
    - `results` object[] — URLs for query results in available formats (if completed).
      - `format` union, required — The format of the query results at this URL
        - 'csv' — A gzip-compressed CSV file.
        - 'parquet' — A [Parquet file](https://arrow.apache.org/docs/python/parquet.html) compressed using the zstd method.
        - 'arrow' — A gzip-compressed [streaming Arrow](https://arrow.apache.org/docs/python/ipc.html) file
        - 'text' — A plain text file
        - 'image' — An image file
        - 'html' — An HTML file
      - `url` string, required — A signed URL that can be used to download query results. This URL expires after 1 hour, after which a new URL can be requested using this route.
    - `result_preview` string — A preview of the first rows of the results in CSV format (if completed). By default up to 50 rows are returned, unless otherwise specified in the num_rows option.
    - `result_metadata` object — Metadata about the results (if completed)
      - `columns` object[] — The columns in the result set
        - `name` string, required — The column name
        - `type` union, required — The column data type
          - 'number' — A numeric type, including integers, floats and high-precision types.
          - 'string' — A text type
          - 'date' — A date type
          - 'datetime' — A datetime type
          - 'boolean' — A boolean type
          - 'other' — Another type, possibly database-specific
      - `duration` number — The total query duration in milliseconds
      - `num_rows` number — The number of rows in the result set
      - `row_limit` number — The row limit applied when extracting the results from the database
      - `byte_limit` number — The byte limit applied when extracting the results from the database
    - `sql` string — The executed SQL for this query (if available)

## Other responses

- `4XX` — Client error. Possible status codes include: 400 (invalid request), 401 (missing or invalid API key), 403 (insufficient permissions), 404 (resource not found), 429 (rate limit exceeded).
- `5XX` — Internal server error.

---

[API](https://skmtc.net/count/apis/count-public-api.md) · [All operations](https://skmtc.net/count/apis/count-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/count/count-public-api/versions/858ed44750ff/schema)
