> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Dune

> Onchain analytics from Dune: results of saved SQL queries over blockchain data, fetched from the query's latest run.

![](https://mintcdn.com/webrouter/gPu3tCeozwRcDBjt/logo/data-apis/dune.webp?fit=max\&auto=format\&n=gPu3tCeozwRcDBjt\&q=85\&s=f6d73d1e2307225cfbd96442a491bc66)

[Web Catalog · Finance](https://docs.webrouter.net/data-apis.md?category=finance)

Needs&#x20;

`DUNE_API_KEY`

Endpoints

4

Auth

Key in header

[Vendor docs](https://docs.dune.com/api-reference/apis/quickstart-dashboards)

&#x20;·&#x20;

[Pricing](https://dune.com/pricing)

## Setup

| Variable | | What it is |
| - | - | - |
| `DUNE_API_KEY` | required | A Dune API key with at least Read scope (dune.com settings > API). Sent in the X-Dune-Api-Key header. |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* API access needs a trial or paid plan; free accounts are view-only.
* Credits: runs are charged for compute used (by engine tier); fetching results is charged per MB exported (2 credits/MB on Plus, 10 on Analyst).
* Rate limits on Plus: 70 requests/minute for runs, 200/minute for reads; Enterprise from 350 and 1000.
* Results stored over 32 GB are truncated; ask with allow\_partial\_results to read them.
* Running a query (POST /v1/query/\{query\_id}/execute) is not in this entry: it starts a billed run. The execution calls read runs started elsewhere, such as in the Dune app.

## Endpoints

GET

Get a query's latest result

Rows of the latest finished run of a saved query (public or yours), from the app or the API.

[Open](#dune-query-latest-result)

GET

Check a query run's status

State of an execution (pending, executing, completed, failed...), with timing and credits used.

[Open](#dune-execution-status)

GET

Get a query run's results

Rows of one execution, once it has completed.

[Open](#dune-execution-results)

GET

Read a saved query

SQL text, parameters, name, tags and state of a saved query.

[Open](#dune-query-get)

### Get a query's latest result

GET

`/v1/query/{query_id}/results`

`dune.query.latest_result`

Rows of the latest finished run of a saved query (public or yours), from the app or the API.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`query_id` required</td><td>string</td><td>path</td><td>Saved query ID, the number in dune.com/queries/\<id>. Example `3567562`</td></tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Rows to return; with offset for paging. Not with sample\_count.
      </td>
    </tr>

    <tr>
      <td>
        `offset`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        First row to return, from 0.
      </td>
    </tr>

    <tr>
      <td>
        `columns`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated columns to return; fewer columns cost fewer credits.
      </td>
    </tr>

    <tr>
      <td>
        `filters`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        SQL WHERE-like row filter, e.g. block\_time > '2024-01-01'. Not with sample\_count.
      </td>
    </tr>

    <tr>
      <td>
        `sort_by`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        SQL ORDER BY-like expression, e.g. amount\_usd desc.
      </td>
    </tr>

    <tr>
      <td>
        `sample_count`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Return a random uniform sample of this many rows.
      </td>
    </tr>

    <tr>
      <td>
        `allow_partial_results`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Return the truncated part of a result over the 32 GB storage limit instead of failing.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://docs.dune.com/api-reference/executions/endpoint/get-query-result) · Same job: [CMS Open Payments](https://docs.webrouter.net/data-apis/cms-open-payments.md#cms-open-payments-datastore-query), [CMS Data (data.cms.gov)](https://docs.webrouter.net/data-apis/data-cms.md#data-cms-dataset-rows), [data.gov.au](https://docs.webrouter.net/data-apis/data-gov-au.md#data-gov-au-rows-search), [Latvian Open Data Portal (data.gov.lv)](https://docs.webrouter.net/data-apis/data-gov-lv.md#data-gov-lv-rows-search), [data.gov.ua](https://docs.webrouter.net/data-apis/data-gov-ua.md#data-gov-ua-rows-search), [FINRA API Platform](https://docs.webrouter.net/data-apis/finra.md#finra-datasets-query)

```python Python theme={null}
router.call_data_api("dune.query.latest_result", {'query_id': '3567562'})
```

```text MCP theme={null}
call_data_api(endpoint="dune.query.latest_result", params={"query_id": "3567562"})
```

> [!NOTE]
>
> * Does not run the query, but costs credits per MB of result returned.
> * 404 when the query's SQL changed since its last run: run it again in Dune first.
> * Page with limit and offset; the response carries next\_offset while rows remain.

### Check a query run's status

GET

`/v1/execution/{execution_id}/status`

`dune.execution.status`

State of an execution (pending, executing, completed, failed...), with timing and credits used.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `execution_id`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Execution ID of a run started in Dune or through its API.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://docs.dune.com/api-reference/executions/endpoint/get-execution-status) · Same job: [AI Ark](https://docs.webrouter.net/data-apis/aiark.md#aiark-people-find-emails-status), [AnyAPI](https://docs.webrouter.net/data-apis/anyapi.md#anyapi-requests-get), [Anymail Finder](https://docs.webrouter.net/data-apis/anymailfinder.md#anymailfinder-bulk-get), [Apify](https://docs.webrouter.net/data-apis/apify.md#apify-actors-list), [Aviato](https://docs.webrouter.net/data-apis/aviato.md#aviato-marketmap-get), [BounceBan](https://docs.webrouter.net/data-apis/bounceban.md#bounceban-single-status)

> [!NOTE]
>
> * Done when state is QUERY\_STATE\_COMPLETED; also QUERY\_STATE\_FAILED, \_CANCELED, \_EXPIRED or \_COMPLETED\_PARTIAL.

### Get a query run's results

GET

`/v1/execution/{execution_id}/results`

`dune.execution.results`

Rows of one execution, once it has completed.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `execution_id`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Execution ID of a run started in Dune or through its API.
      </td>
    </tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Rows to return; with offset for paging. Not with sample\_count.
      </td>
    </tr>

    <tr>
      <td>
        `offset`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        First row to return, from 0.
      </td>
    </tr>

    <tr>
      <td>
        `columns`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated columns to return; fewer columns cost fewer credits.
      </td>
    </tr>

    <tr>
      <td>
        `filters`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        SQL WHERE-like row filter, e.g. block\_time > '2024-01-01'. Not with sample\_count.
      </td>
    </tr>

    <tr>
      <td>
        `sort_by`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        SQL ORDER BY-like expression, e.g. amount\_usd desc.
      </td>
    </tr>

    <tr>
      <td>
        `sample_count`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Return a random uniform sample of this many rows.
      </td>
    </tr>

    <tr>
      <td>
        `allow_partial_results`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Return the truncated part of a result over the 32 GB storage limit instead of failing.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://docs.dune.com/api-reference/executions/endpoint/get-execution-result) · Same job: [BetterContact](https://docs.webrouter.net/data-apis/bettercontact.md#bettercontact-contacts-enrich-result), [Bright Data](https://docs.webrouter.net/data-apis/brightdata.md#brightdata-datasets-snapshot-download), [Clay](https://docs.webrouter.net/data-apis/clay.md#clay-routines-results), [Decodo](https://docs.webrouter.net/data-apis/decodo.md#decodo-task-results), [Forager](https://docs.webrouter.net/data-apis/forager.md#forager-person-work-email-result), [FullEnrich](https://docs.webrouter.net/data-apis/fullenrich.md#fullenrich-contact-enrich-result)

> [!NOTE]
>
> * Costs credits per MB of result returned.

### Read a saved query

GET

`/v1/query/{queryId}`

`dune.query.get`

SQL text, parameters, name, tags and state of a saved query.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`queryId` required</td><td>integer</td><td>path</td><td>Saved query ID. Example `1215383`</td></tr>
  </tbody>
</table>

[Vendor docs](https://docs.dune.com/api-reference/queries/endpoint/read) · Same job: [Affinity](https://docs.webrouter.net/data-apis/affinity.md#affinity-companies-fields), [ArcGIS Online](https://docs.webrouter.net/data-apis/arcgis.md#arcgis-items-get), [Attio](https://docs.webrouter.net/data-apis/attio.md#attio-attributes-list), [Bank of Canada](https://docs.webrouter.net/data-apis/bankofcanada.md#bankofcanada-series-get), [US Bureau of Economic Analysis](https://docs.webrouter.net/data-apis/bea.md#bea-parameters-list), [Bright Data](https://docs.webrouter.net/data-apis/brightdata.md#brightdata-datasets-metadata)

```python Python theme={null}
router.call_data_api("dune.query.get", {'queryId': 1215383})
```

```text MCP theme={null}
call_data_api(endpoint="dune.query.get", params={"queryId": 1215383})
```

> [!NOTE]
>
> * Queries endpoints need the Plus or Enterprise plan. Private queries are readable only with their owner's key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.