Skip to main content
GET
/
v1
/
query
/
{query_id}
/
pipeline
Get query pipeline
curl --request GET \
  --url https://api.dune.com/api/v1/query/{query_id}/pipeline \
  --header 'X-Dune-Api-Key: <x-dune-api-key>'
{
  "pipeline": {
    "nodes": [
      {
        "dependencies": [
          123
        ],
        "id": 1,
        "materialized_view_refresh": {
          "name": "mv_1",
          "performance": "medium"
        },
        "query_execution": {
          "performance": "medium",
          "query_id": 1234,
          "query_parameters": {}
        }
      }
    ]
  }
}
Retrieve the pipeline definition for a specific query, including all nested materialized views that the query depends on.

Overview

This endpoint returns the pipeline structure that would be executed for a given query, allowing you to inspect the lineage and execution order before running the pipeline. This is useful for understanding dependencies and planning pipeline executions. The pipeline definition contains all the nodes (queries and materialized view refreshes) in the correct dependency order.
The query_parameters should be passed as a URL-encoded JSON string in the query parameter, where keys are parameter names and values are parameter values.

Use Cases

Inspect Pipeline Before Execution

Check what queries and materialized views will be executed:
curl "https://api.dune.com/api/v1/query/3493826/pipeline?performance=medium" \
  -H "X-Dune-Api-Key: $DUNE_API_KEY"

Validate Dependencies with Parameters

Understand query dependencies before running a pipeline with specific parameters:
# Query parameters as JSON string
curl "https://api.dune.com/api/v1/query/3493826/pipeline?performance=large&query_parameters=%7B%22blockchain%22%3A%22ethereum%22%7D" \
  -H "X-Dune-Api-Key: $DUNE_API_KEY"

Response Structure

The response contains a pipeline object with a nodes array. Each node represents either a query execution or materialized view refresh, along with its dependencies. Example response:
{
  "pipeline": {
    "nodes": [
      {
        "id": 1,
        "dependencies": [],
        "materialized_view_refresh": {
          "name": "dune.analyst.mv_base_data",
          "performance": "medium"
        }
      },
      {
        "id": 2,
        "dependencies": [1],
        "query_execution": {
          "query_id": 3493826,
          "performance": "medium"
        }
      }
    ]
  }
}

Best Practices

Call this endpoint before executing a pipeline to understand what will be executed and in what order. This helps with planning and cost estimation.
For queries with many dependencies, use this endpoint to visualize the execution graph and identify potential bottlenecks.
When using query parameters, test the pipeline structure with different parameter values to ensure the lineage is resolved correctly.

Headers

X-Dune-Api-Key
string
required

API Key for the service

Path Parameters

query_id
integer
required

Unique identifier of the query

Query Parameters

api_key
string

Alternative to using the X-Dune-Api-Key header

performance
string

The performance engine tier. Can be either medium or large.

query_parameters
string

SQL Query parameters in json key-value pairs

Response

OK

pipeline
object

The pipeline definition containing nodes to execute