← all AgentPay tools

dune_query

Run any Dune Analytics query and return live onchain results by query ID. Use fast_only=True for live bots — returns cached result instantly or raises immediately, never blocks..

Free data x402 protocol no API key · no wallet

When agents use this

You need deep onchain analytics from a specific Dune query — protocol revenue, user counts, custom metrics.

Parameters

nametyperequireddescription
limitintegernoMaximum rows to return (default 25)
query_idintegeryesDune Analytics query ID (visible in the query URL)
query_parametersobjectnoOptional named parameters to pass to the Dune query

Returns

rows[], columns[], row_count, generated_at from the Dune Analytics query result

Example response

{
  "query_id": 3810512,
  "row_count": 2,
  "columns": [
    "protocol",
    "revenue_usd"
  ],
  "rows": [
    {
      "protocol": "Uniswap V3",
      "revenue_usd": 1243800.0
    },
    {
      "protocol": "Aave V3",
      "revenue_usd": 987200.0
    }
  ],
  "generated_at": "2026-03-22T00:00:00Z",
  "source": "dune"
}

Call it — HTTP (x402)

curl -X POST https://agentpay.tools/tools/dune_query/call \
  -H 'Content-Type: application/json' \
  -d '{"parameters": {"query_id": "Dune Analytics query ID (visible in the query URL)"}, "agent_address": "<your wallet or any identifier>"}'

Call it — Python SDK

from agentpay import quickstart  # pip install agentpay-x402

s = quickstart(max_spend=0.10)   # hard budget cap; mints a wallet, no funding needed
r = s.call("dune_query", {"query_id": "Dune Analytics query ID (visible in the query URL)"})
print(r.data)                    # + r.cost, r.tx, r.network — full receipt

Call it — MCP

npx -y @romudille/agentpay-mcp   # keyless; exposes dune_query to any MCP agent runtime
All tools · x402 delivery scores · Receipt ledger · Guides · llms.txt · AgentPay