GET
/
v1
/
query
/
{query_id}
/
results

curl --request GET \
  --url https://api.dune.com/api/v1/query/{query_id}/results
  
{
  "execution_id": "01HKZSJAW6N2MFVCBHA3R8S64X",
  "query_id": 1252207,
  "state": "QUERY_STATE_COMPLETED",
  "is_execution_finished": true,
  "submitted_at": "2024-01-12T21:34:37.447476Z",
  "expires_at": "2024-04-11T21:34:55.737082Z",
  "execution_started_at": "2024-01-12T21:34:37.464387Z",
  "execution_ended_at": "2024-01-12T21:34:55.737081Z",
  "next_offset": 5,
  "next_uri": "https://api.dev.dune.com/api/v1/execution/01HKZSJAW6N2MFVCBHA3R8S64X/results?limit=1000&offset=5",
  "result": {
    "metadata": {
      "column_names": [
        "Rank",
        "project",
        "Total Volume",
        "7 Days Volume",
        "24 Hours Volume"
      ],
      "result_set_bytes": 310,
      "row_count": 5,
      "total_result_set_bytes": 4400,
      "total_row_count": 300,
      "datapoint_count": 25,
      "pending_time_millis": 16,
      "execution_time_millis": 18272
    },
    "rows": [
      {
        "24 Hours Volume": 8466988.095521685,
        "7 Days Volume": 39146349.94906045,
        "Rank": 1,
        "Total Volume": 38382979226.241264,
        "project": "opensea"
      },
      {
        "24 Hours Volume": 21838779.932517685,
        "7 Days Volume": 162466310.33138418,
        "Rank": 2,
        "Total Volume": 8237501261.688846,
        "project": "blur"
      },
      {
        "24 Hours Volume": 671472.4583508199,
        "7 Days Volume": 4017792.3280940033,
        "Rank": 3,
        "Total Volume": 5461953781.154043,
        "project": "x2y2"
      },
      {
        "24 Hours Volume": 1286407.4659000002,
        "7 Days Volume": 5173193.591668,
        "Rank": 4,
        "Total Volume": 2679750259.5093665,
        "project": "cryptopunks"
      },
      {
        "24 Hours Volume": 56173.5344355522,
        "7 Days Volume": 554016.6849051005,
        "Rank": 5,
        "Total Volume": 1598674364.7416763,
        "project": "looksrare"
      }
    ]
  }
}

You must pass parameter query_id.

Returns the latest execution id and results (in JSON) of that latest run, regardless of the job id/run or if it is run in the app or the api.

The query specified must either be public or a query you have ownership of (you or a team you belong to have ownership).

  • Dune internally has a maximum query result size limit (which currently is 8GB, but subject to increase in the future). If your query yields more than 8GB of data, the result will be truncated in storage. In such cases, pulling the result data (using pagination) but without specifying allow_partial_results set to true will trigger an error message: “error”: “Partial Result, please request with ‘allows_partial_results=true’“. If you wish to retrieve partial results, you can pass the parameter allow_partial_results=true. But please make sure you indeed want to fetch the truncated result.

Headers

X-DUNE-API-KEY
string
required

API Key for the service

Path Parameters

query_id
integer
required

unique identifier of the query

Query Parameters

api_key
string

API Key for the service, alternative to using the HTTP header X-DUNE-API-KEY.

limit
integer
required

Limit number of rows to return. This together with 'offset' allows easy pagination through results in an incremental and efficient way. This parameter is incompatible with sampling (sample_count).

offset
integer

Offset row number to start (inclusive, first row means offset=0) returning results from. This together with 'limit' allows easy pagination through results in an incremental and efficient way. This parameter is incompatible with sampling (sample_count).

sample_count
integer

Number of rows to return from the result by sampling the data. This is useful when you want to get a uniform sample instead of the entire result. If the result has less than the sample count, the entire result is returned. Note that this will return a randomized sample, so not every call will return the same result. This parameter is incompatible with offset, limit, and filters parameters.

filters
string

Expression to filter out rows from the results to return. This expression is similar to a SQL WHERE clause. More details about it in the Filtering section of the doc. This parameter is incompatible with sample_count.

sort_by
string

Expression to define the order in which the results should be returned. This expression is similar to a SQL ORDER BY clause. More details about it in the Sorting section of the doc.

columns
string

Specifies a comma-separated list of column names to return. If omitted, all columns are included. Tip: use this to limit the result to specific columns, reducing datapoints cost of the call.

query_parameters
object[]

SQL Query parameters in key-value pairs. Each parameter is to be provided in key-value pairs. This enables you to execute a parameterized query with the provided values for your parameter keys. Partial submission of parameters is allowed. For example, if the query expects three parameters and you only pass in two, the third one will automatically use its default value as defined in the Query Parameter Editor page.

ignore_max_datapoints_per_request
boolean

There is a default 250,000 datapoints limit to make sure you don't accidentally spend all your credits in one call. To ignore the max limit, you can add ignore_max_datapoints_per_request=true

allow_partial_results
boolean

This enables returning a query result that was too large and only a partial result is available. By default allow_partial_results is set to false and a failed state is returned.

Response

200 - application/json
execution_id
string
required

Unique identifier for the execution of the query.

query_id
integer
required

Unique identifier of the query.

state
string
required

The state of the query execution.

is_execution_finished
boolean

Whether the state of the query execution is terminal. This can be used for polling purposes.

submitted_at
string
required

Timestamp of when the query was submitted.

expires_at
string

Timestamp of when the query result expires.

execution_started_at
string

Timestamp of when the query execution started.

execution_ended_at
string

Timestamp of when the query execution ended.

cancelled_at
string

Timestamp of when the query execution was cancelled, if applicable.

next_offset
integer

Offset that can be used to retrieve the next page of results.

next_uri
string

URI that can be used to fetch the next page of results.

result
object
error
object