Dune Analytics Query API

The Query API from Dune Analytics — 2 operation(s) for query.

Operations 2

POST /query/{query_id}/execute Execute a saved Dune query #
GET /query/{query_id}/results Get latest results for a saved query #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dune-analytics-query-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dune-analytics-query-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Dune Analytics Execution Query API
  description: 'REST endpoints for executing pre-saved Dune SQL queries, polling

    execution status, and paginating results. Authentication via the

    X-Dune-API-Key header. This specification is a best-effort,

    documentation-derived description and may omit fields.

    '
  version: 1.0.0
  contact:
    name: Dune Analytics
    url: https://docs.dune.com/
servers:
- url: https://api.dune.com/api/v1
  description: Production
security:
- DuneApiKey: []
tags:
- name: Query
paths:
  /query/{query_id}/execute:
    post:
      summary: Execute a saved Dune query
      operationId: executeQuery
      parameters:
      - $ref: '#/components/parameters/QueryId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                query_parameters:
                  type: object
                  additionalProperties: true
                  description: Parameter values for the saved query.
                performance:
                  type: string
                  enum:
                  - small
                  - medium
                  - large
                  default: medium
                  description: Compute tier for the execution.
      responses:
        '200':
          description: Execution accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionAccepted'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
      tags:
      - Query
  /query/{query_id}/results:
    get:
      summary: Get latest results for a saved query
      operationId: getLatestQueryResults
      parameters:
      - $ref: '#/components/parameters/QueryId'
      - in: query
        name: limit
        schema:
          type: integer
      - in: query
        name: offset
        schema:
          type: integer
      responses:
        '200':
          description: Latest cached result set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionResults'
        '401':
          $ref: '#/components/responses/Unauthorized'
      tags:
      - Query
components:
  responses:
    RateLimited:
      description: Rate limit or credit allowance exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    ExecutionAccepted:
      type: object
      properties:
        execution_id:
          type: string
        state:
          type: string
          example: QUERY_STATE_PENDING
    ExecutionResults:
      type: object
      properties:
        execution_id:
          type: string
        query_id:
          type: integer
        state:
          type: string
        result:
          type: object
          properties:
            rows:
              type: array
              items:
                type: object
                additionalProperties: true
            metadata:
              type: object
              additionalProperties: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
            metadata:
              type: object
              additionalProperties: true
  parameters:
    QueryId:
      in: path
      name: query_id
      required: true
      schema:
        type: integer
      description: Numeric ID of the saved Dune query.
  securitySchemes:
    DuneApiKey:
      type: apiKey
      in: header
      name: X-Dune-API-Key