Execute a query pipeline
curl --request POST \
--url https://api.dune.com/api/v1/query/{query_id}/pipeline/execute \
--header 'Content-Type: application/json' \
--header 'X-Dune-Api-Key: <x-dune-api-key>' \
--data '
{
"query_parameters": {}
}
'import requests
url = "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute"
payload = { "query_parameters": {} }
headers = {
"X-Dune-Api-Key": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dune-Api-Key': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_parameters: {}})
};
fetch('https://api.dune.com/api/v1/query/{query_id}/pipeline/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query_parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dune-Api-Key: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute"
payload := strings.NewReader("{\n \"query_parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/query/{query_id}/pipeline/execute")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/query/{query_id}/pipeline/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"pipeline_execution_id": "01HKZJ2683PHF9Q9PHHQ8FW4Q1"
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Executions and Results
Execute Query Pipeline
Builds a query pipeline from the specified query and executes it. A pipeline allows you to chain multiple queries together and execute them as a single unit.
POST
/
v1
/
query
/
{query_id}
/
pipeline
/
execute
Execute a query pipeline
curl --request POST \
--url https://api.dune.com/api/v1/query/{query_id}/pipeline/execute \
--header 'Content-Type: application/json' \
--header 'X-Dune-Api-Key: <x-dune-api-key>' \
--data '
{
"query_parameters": {}
}
'import requests
url = "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute"
payload = { "query_parameters": {} }
headers = {
"X-Dune-Api-Key": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dune-Api-Key': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_parameters: {}})
};
fetch('https://api.dune.com/api/v1/query/{query_id}/pipeline/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query_parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dune-Api-Key: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/query/{query_id}/pipeline/execute"
payload := strings.NewReader("{\n \"query_parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/query/{query_id}/pipeline/execute")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/query/{query_id}/pipeline/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"pipeline_execution_id": "01HKZJ2683PHF9Q9PHHQ8FW4Q1"
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Minimum required API key scope:
ReadWhat is a Query Pipeline?
A query pipeline enables you to create a chain of dependencies between queries, where:- Each query in the pipeline can depend on the results of previous queries
- The pipeline executes queries in the correct order based on their dependencies
- All queries are executed as a single atomic operation
Use Cases
Query pipelines are ideal for:- Complex Data Transformations: Breaking down complex analysis into smaller, manageable queries
- Data Lineage: Maintaining clear dependencies between related queries
- Coordinated Updates: Ensuring multiple queries are executed together
- Incremental Processing: Building data pipelines where each step depends on the previous one
Response
The endpoint returns apipeline_execution_id which you can use to:
- Check the status of the pipeline execution using the Get Pipeline Execution Status endpoint
- Monitor the progress of individual nodes in the pipeline
- Retrieve results from each query in the pipeline once execution completes
- Credits are consumed based on actual compute resources used for each query in the pipeline
- Use the
performanceparameter to specify execution tier (medium or large) - Query parameters can be passed to parameterize queries in the pipeline
Example Workflow
# 1. Execute the pipeline
curl -X POST "https://api.dune.com/api/v1/query/1234567/pipeline/execute" \
-H "X-Dune-Api-Key: YOUR_API_KEY"
# Response: { "pipeline_execution_id": "01HZABC123..." }
# 2. Check pipeline status
curl "https://api.dune.com/api/v1/pipelines/executions/01HZABC123.../status" \
-H "X-Dune-Api-Key: YOUR_API_KEY"
Related Endpoints
- Get Query Pipeline - Inspect pipeline structure before execution
- Get Pipeline Status - Check pipeline execution status
- Execute Pipeline - Execute a lineage-based pipeline
Headers
API Key for the service
Path Parameters
Unique identifier of the query
Query Parameters
Alternative to using the X-Dune-Api-Key header
Body
application/json
Query pipeline execution request
Response
OK
Unique identifier for the pipeline execution. Use this ID to check the status and retrieve results of the pipeline execution.
Example:
"01HKZJ2683PHF9Q9PHHQ8FW4Q1"
Was this page helpful?