Dune API

This app lets you retrieve data from Dune by providing a query ID. The ID corresponds to a specific query that you create in the Dune web interface. The following guide will walk you through the process.

1. Constructing a Dune Query

  • First, you must create your query on the Dune platform.

  • Once your query is ready, you can find its ID in the address bar of your web browser. The ID is typically a series of numbers or a combination of letters and numbers (example: https://dune.com/queries/1234567, the ID is 1234567).

2. Using the App to Retrieve Data

The app accepts input in the YAML format. At a minimum, you should provide the query_id which corresponds to the ID you found in the Dune address bar.

query_id: 1234567

Optionally, you can provide additional query parameters and specify performance preferences (like medium).

query_id: 1234567
query_parameters:
  param1: value1
  param2: value2
performance: medium # (optional, default is 'medium')

For instance, if you're querying transactions of a particular cryptocurrency token, your YAML might look like:

query_id: 1234567
query_parameters:
  token_name: "Ether"

The 'performance' parameter specifies the engine size for executing the query. Dune API currently supports only two performance tiers: 'medium' and 'large'. Unfortunately, the 'free' performance option, which might be available in the Dune interface, is not accessible via the API.

YAML Format: Ensure your input adheres to the YAML format. Any discrepancies might cause the app to fail or retrieve incorrect data.

Errors & Troubleshooting:

  • If the YAML format is invalid, the app will notify you of the error. Ensure that all fields are correctly spelled and that the structure is correct.

  • If the query_id is missing from the input, the app will return an error. Make sure you've added the ID from Dune's address bar.

  • If there are issues with the Dune API or the provided API key, the app will return an error message detailing the issue.

3. Run the Query

With the YAML formatted input ready, run the query. It will use the provided API key and the Dune API endpoint to fetch the results.

4. Best Practices

Data Size Considerations: The Dune API can be costly, especially when retrieving large datasets. Always aim to aggregate your data or filter it to ensure you aren’t retrieving millions of lines. The more specific and concise your query, the faster and cheaper the data retrieval will be.

Last updated