Queries
Queries all have aquery id which is returned when you read/create a query. You can also find it within a url, i.e. https://dune.com/queries/<query_id>/<visualization_id>.
Each query comes with fields you can edit such as:
name: query name textdescription: query description textquery_sql: the raw sql textparams: parameters within the query, using the{{ foo }}syntax. See the section below for more details.is_private: boolean for if query is private or not. Private queries cannot be found or queried by others.archived: boolean for if query is archived or not. Archived queries cannot be run or edited by anyone.
Query Parameters
There are four kinds of parameters you can use in a Dune query (these are not API parameters).- number
- text
- date
- enum (called a list in the UI)
datetime parameter type requires you use the syntax timestamp '{{block_time_start}}' to cast the parameter to a timestamp.
If you are using bytearrays/binary (0x1234...), then you will still pass it as text through the API but ensure your SQL text puts the parameter without any quotes around it.
Endpoints
| Endpoint Title | Endpoint | Description |
|---|---|---|
| List Queries | GET /v1/queries | Retrieves a paginated list of queries |
| Get Query Pipeline | GET /v1/query/{query_id}/pipeline | Retrieves the pipeline definition for a query, including dependencies and execution order |
| Read Query | GET /v1/query/{query_id} | Fetches details of a specific query by ID |
| Create Query | POST /v1/query | Creates a new query with specified parameters |
| Update Query | PATCH /v1/query/{query_id} | Updates an existing query’s properties |
| Archive Query | PATCH /v1/query/{query_id}/archive | Archives a query, preventing it from being run or edited |
| Unarchive Query | PATCH /v1/query/{query_id}/unarchive | Unarchives a previously archived query |
| Make Query Private | PATCH /v1/query/{query_id}/private | Makes a query private, restricting access |
| Make Query Public | PATCH /v1/query/{query_id}/unprivate | Makes a private query public |