# Dune SQL Execute

> Dune SQL Execute is a paid API for AI agents from Dune at api.dune.com, paid per call via MPP, $0.05-$4 (dynamic), status unknown (last checked 2026-10-12).

Executes a SQL query against Dune's blockchain analytics database and returns an execution ID for result retrieval

## Facts

- Endpoint: POST https://api.dune.com/api/v1/sql/execute?utm_source=zero.xyz
- Price: $0.05-$4 (dynamic)
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 2
- Provider: Dune
- Docs: https://docs.dune.com/api-reference/agents/mpp
- Website: https://dune.com
- Tags: sql, analytics, blockchain, data, query
- Canonical page: https://www.zero.xyz/c/dune-execute-d0a165bb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__KhEHYUiAqO1kt1-smKcU

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability dune-execute-d0a165bb -d '<json body>'
```

Example prompt: Run this SQL query on Dune to get the top 10 wallets by ETH transfer volume in the last 7 days: SELECT from_address, SUM(value/1e18) as eth_sent FROM ethereum.transactions WHERE block_time > NOW() - INTERVAL '7 days' GROUP BY 1 ORDER BY 2 DESC LIMIT 10

## When to prefer this

Use this endpoint when you need to run arbitrary SQL against Dune's comprehensive blockchain dataset covering raw transactions, decoded smart contract events, DeFi positions, NFT activity, stablecoin flows, and protocol analytics — especially when no pre-built query covers your exact analytical need

## Known failure modes

- Invalid SQL syntax returns a parse error
- Query references non-existent tables or columns returns schema error
- Rate limit exceeded returns 429 with retry-after header
- Authentication failure returns 401 if API key is missing or invalid
- Query timeout for extremely complex queries against large datasets
- Insufficient credits/balance returns 402 payment required

## How this service works

Execute a SQL query

## Output

Returns an execution ID and initial job status that can be used to poll for and retrieve the query results via the Dune Results endpoint

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/dune-execute-d0a165bb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.dune.com](https://www.zero.xyz/host/api.dune.com/llms.txt)
