Skip to main content

Setup

Put them in your environment or .env; Data APIs covers the other ways.

Notes

  • API access needs a trial or paid plan; free accounts are view-only.
  • Credits: runs are charged for compute used (by engine tier); fetching results is charged per MB exported (2 credits/MB on Plus, 10 on Analyst).
  • Rate limits on Plus: 70 requests/minute for runs, 200/minute for reads; Enterprise from 350 and 1000.
  • Results stored over 32 GB are truncated; ask with allow_partial_results to read them.
  • Running a query (POST /v1/query/{query_id}/execute) is not in this entry: it starts a billed run. The execution calls read runs started elsewhere, such as in the Dune app.

Endpoints

Get a query’s latest result

  • Does not run the query, but costs credits per MB of result returned.
  • 404 when the query’s SQL changed since its last run: run it again in Dune first.
  • Page with limit and offset; the response carries next_offset while rows remain.

Check a query run’s status

  • Done when state is QUERY_STATE_COMPLETED; also QUERY_STATE_FAILED, _CANCELED, _EXPIRED or _COMPLETED_PARTIAL.

Get a query run’s results

  • Costs credits per MB of result returned.

Read a saved query

  • Queries endpoints need the Plus or Enterprise plan. Private queries are readable only with their owner’s key.