Skip to content
OSINTtools.io

Dune API

Onchain data platform where you query normalised blockchain data across 100+ chains in SQL and browse community dashboards.

Base URL
https://api.dune.com/api/v1
Sign-in
API key
Free tier
Free trial
Pricing
Credits
Format
REST
Endpoints
4

Compiled by OSINTtools.io editors from docs.dune.com · updated Nov 29, 2026Work on this API? Claim it to keep these docs currentReport a mistake

Introduction

The Dune Data API runs SQL against Dune's indexed blockchain data and returns the result rows. Investigators use it to run saved queries or their own SQL over on-chain activity, then page through the results.

Calls go to https://api.dune.com/api/v1 with the key in the X-Dune-Api-Key header. A run is asynchronous: submit it, poll the status endpoint until is_execution_finished is true, then read the results.

Executions use credits based on compute used; metadata endpoints are free. The docs say free access after a trial is view-only and does not include API exports. Other documented areas not covered here: query management, data uploads, materialized views, pipelines and usage.

Quick start

  1. Get a key

    Create an account with Dune and copy your api key (free trial). Where to get it

  2. Make your first request

    Check the state of an execution.. Replace YOUR_API_KEY and run it in a terminal, or use Try it on the endpoint.

    curl 'https://api.dune.com/api/v1/execution/01EXAMPLE0000000000000000/status' \
      -H 'X-Dune-Api-Key: YOUR_API_KEY'
  3. Read the response

    A 200 response looks like this.

    {
      "execution_id": "01EXAMPLE0000000000000000",
      "query_id": 0,
      "state": "QUERY_STATE_COMPLETED",
      "is_execution_finished": true,
      "execution_cost_credits": 0.5,
      "result_metadata": {
        "column_names": [
          "col"
        ],
        "total_row_count": 1
      }
    }

Authentication

Send your API key in the X-Dune-Api-Key header of every request.

An api_key query parameter is also accepted.

Get a key from Dune

Try it on this page keeps your key in your browser; it is never sent to OSINTtools.io.

Rate limits and pricing

Not stated in the docs

Free trial. Pricing: credits.

Errors

StatusMeaning
400Bad request
401Unauthorized, such as an invalid API key
402Payment required: the request would exceed billing-cycle limits
403Forbidden: query archived, unsaved or no permission
404Not found
500Internal server error

Executions

  • Passive: the target is not contacted
  • Cost: Credits by compute used

Starts an execution of a saved query. Use the returned execution_id with the status and results endpoints. The docs' cURL sends query_parameters and performance in a JSON body while the OpenAPI spec defines them as query-string parameters.

Path parameters

query_idintegerrequired

ID of the saved query

Example: 1234567

Query parameters

performancestring

Engine tier; engine default if omitted

Example: mediumOne of: small, medium, large
query_parametersstring

JSON key-value pairs for the query's parameters; omitted ones use defaults

Example: {"param1": 24}
Response fields · 2Show

execution_idstring

ID to poll and fetch results with

statestring

Execution state, e.g. QUERY_STATE_PENDING

curl -X POST 'https://api.dune.com/api/v1/query/1234567/execute' \
  -H 'X-Dune-Api-Key: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "execution_id": "01EXAMPLE0000000000000000",
  "state": "QUERY_STATE_PENDING"
}
  • Passive: the target is not contacted
  • Cost: Credits by compute used

Executes the SQL you send. In results, query_id is always 0 for arbitrary SQL.

Request body (JSON) · 2Show

sqlstringalways present

The SQL to execute

performancestring

small, medium or large

Response fields · 2Show

execution_idstring

ID to poll and fetch results with

statestring

Execution state

curl -X POST 'https://api.dune.com/api/v1/sql/execute' \
  -H 'X-Dune-Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"sql":"SELECT 1","performance":"medium"}'
Replace YOUR_API_KEY with your key
Response
{
  "execution_id": "01EXAMPLE0000000000000000",
  "state": "QUERY_STATE_PENDING"
}

Check the state of an execution.

GET/execution/{execution_id}/status

  • Passive: the target is not contacted
  • Cost: No credit charge

Poll until is_execution_finished is true. execution_cost_credits is the source of truth for cost.

Path parameters

execution_idstringrequired

ID returned when the execution was submitted

Example: 01EXAMPLE0000000000000000
Response fields · 10Show

execution_idstring

Execution ID

query_idinteger

Query ID

statestring

PENDING, EXECUTING, COMPLETED, COMPLETED_PARTIAL, FAILED, CANCELED or EXPIRED (prefixed QUERY_STATE_)

is_execution_finishedboolean

Whether the state is terminal

submitted_atstring

Submission time

expires_atstring

When the result expires

execution_cost_creditsnumber

Credits consumed

messagestring

Error description, on failure

column_namesstring[]

Result column names

total_row_countinteger

Rows in the full result

curl 'https://api.dune.com/api/v1/execution/01EXAMPLE0000000000000000/status' \
  -H 'X-Dune-Api-Key: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "execution_id": "01EXAMPLE0000000000000000",
  "query_id": 0,
  "state": "QUERY_STATE_COMPLETED",
  "is_execution_finished": true,
  "execution_cost_credits": 0.5,
  "result_metadata": {
    "column_names": [
      "col"
    ],
    "total_row_count": 1
  }
}

Results

Read the rows of a finished execution as JSON.

GET/execution/{execution_id}/results

  • Passive: the target is not contacted

Supports paging, column selection, filtering and sorting. Results are stored for 90 days. A result over the 32 GB storage limit is truncated and needs allow_partial_results=true.

Path parameters

execution_idstringrequired

Execution ID

Example: 01EXAMPLE0000000000000000

Query parameters

limitinteger

Maximum rows to return

Example: 100
offsetinteger

Zero-based row to start from

Example: 0
columnsstring

Comma-separated columns to return

Example: col
filtersstring

WHERE-style filter; not with sample_count

Example: col > 1
sort_bystring

ORDER BY-style expression

Example: col desc
allow_partial_resultsboolean

Allow truncated results

Example: trueDefault: false
Response fields · 8Show

execution_idstring

Execution ID

statestring

Execution state

is_execution_finishedboolean

Whether the state is terminal

next_offsetinteger

Offset for the next page

next_uristring

URI of the next page

rows[]object

One object per row, column name to value

column_namesstring[]

Column names

total_row_countinteger

Rows in the full result

curl 'https://api.dune.com/api/v1/execution/01EXAMPLE0000000000000000/results' \
  -H 'X-Dune-Api-Key: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "execution_id": "01EXAMPLE0000000000000000",
  "state": "QUERY_STATE_COMPLETED",
  "is_execution_finished": true,
  "result": {
    "rows": [
      {
        "col": 1
      }
    ],
    "metadata": {
      "column_names": [
        "col"
      ],
      "total_row_count": 1
    }
  }
}