Skip to main content
POST
Minimum required API key scope: Read
Run arbitrary SQL queries via API. This endpoint allows you to execute SQL directly without first creating a query object, perfect for dynamic analysis and automated workflows.
When executing arbitrary SQL queries (queries not saved in Dune), the query_id in the response will always be 0. This is a placeholder value since these queries are not stored in the Dune database.

Pricing

This endpoint is usage-based and consumes credits based on the computational resources used during execution.

Headers

X-Dune-Api-Key
string
required

API Key for the service

Query Parameters

api_key
string

Alternative to using the X-Dune-Api-Key header

Body

*/*

ExecuteSQLRequest

sql
string
required

The SQL query to execute

performance
enum<string>

The performance engine tier the execution will be run on

Available options:
small,
medium,
large

Response

OK

execution_id
string
Example:

"01HKZJ2683PHF9Q9PHHQ8FW4Q1"

state
string
Example:

"QUERY_STATE_PENDING"