Dune Analytics Sql API

The Sql API from Dune Analytics — 1 operation(s) for sql.

Operations 1

POST /v1/sql/execute Execute raw SQL 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:dune-analytics-sql-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-sql-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact: {}
  description: Dune API
  title: Dune Sql API
  version: '1.0'
servers:
- url: https://api.dune.com/api
tags:
- name: sql
paths:
  /v1/sql/execute:
    post:
      description: Execute raw SQL query without requiring a stored query ID
      parameters:
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: Alternative to using the X-Dune-Api-Key header
        in: query
        name: api_key
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/models.ExecuteSQLRequest'
        description: ExecuteSQLRequest
        required: true
        x-originalParamName: body
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ExecuteQueryResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error402'
          description: Payment Required
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error403'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: Execute raw SQL query
      x-payment-info:
        amount: null
        description: Reserves $5.00; actual cost based on execution compute.
        intent: session
        method: tempo
      x-required-scope: Read
      tags:
      - sql
      operationId: postV1SqlExecute
      x-operation-id-source: derived
components:
  schemas:
    models.Error400:
      properties:
        error:
          example: Bad Request
          type: string
      type: object
    models.ExecuteSQLRequest:
      properties:
        performance:
          description: The performance engine tier the execution will be run on
          enum:
          - small
          - medium
          - large
          type: string
        sql:
          description: The SQL query to execute
          type: string
      required:
      - sql
      type: object
    models.Error403:
      properties:
        error:
          example: Not allowed to execute query. Query is archived, unsaved or not enough permissions
          type: string
      type: object
    models.Error404:
      properties:
        error:
          example: Object not found
          type: string
      type: object
    models.Error402:
      properties:
        error:
          example: This API request would exceed your configured limits per billing cycle.
          type: string
      type: object
    models.Error401:
      properties:
        error:
          example: Invalid API Key
          type: string
      type: object
    models.ExecuteQueryResponse:
      properties:
        execution_id:
          example: 01HKZJ2683PHF9Q9PHHQ8FW4Q1
          type: string
        state:
          example: QUERY_STATE_PENDING
          type: string
      required:
      - execution_id
      - state
      type: object
    models.Error500:
      properties:
        error:
          example: Internal error
          type: string
      type: object
x-service-info:
  categories:
  - data
  - compute
  docs:
    apiReference: https://docs.dune.com/api-reference/overview/introduction
    homepage: https://docs.dune.com
x-provenance:
  method: harvested
  publisher: Dune Analytics
  source: https://api.dune.com/openapi.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)