> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dune.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

<Info>
  Minimum required API key scope: `Read`
</Info>

This endpoint 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.

## What 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 a `pipeline_execution_id` which you can use to:

1. Check the status of the pipeline execution using the [Get Pipeline Execution Status](/api-reference/pipelines/endpoint/get-pipeline-status) endpoint
2. Monitor the progress of individual nodes in the pipeline
3. Retrieve results from each query in the pipeline once execution completes

<Note>
  * Credits are consumed based on actual compute resources used for each query in the pipeline
  * Use the `performance` parameter to specify execution tier (medium or large)
  * Query parameters can be passed to parameterize queries in the pipeline
</Note>

## Example Workflow

```bash theme={null}
# 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](/api-reference/queries/endpoint/get-query-pipeline) - Inspect pipeline structure before execution
* [Get Pipeline Status](/api-reference/pipelines/endpoint/get-pipeline-status) - Check pipeline execution status
* [Execute Pipeline](/api-reference/pipelines/endpoint/execute-pipeline) - Execute a lineage-based pipeline


## OpenAPI

````yaml POST /v1/query/{query_id}/pipeline/execute
openapi: 3.0.1
info:
  contact: {}
  description: Dune API
  title: DuneAPI
  version: '1.0'
servers:
  - url: https://api.dune.com/api
security: []
paths:
  /v1/query/{query_id}/pipeline/execute:
    post:
      summary: Execute a query pipeline
      description: >-
        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.
      parameters:
        - description: API Key for the service
          in: header
          name: X-Dune-Api-Key
          required: true
          schema:
            type: string
        - description: Alternative to using the X-Dune-Api-Key header
          in: query
          name: api_key
          schema:
            type: string
        - description: Unique identifier of the query
          in: path
          name: query_id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/models.ExecuteQueryPipelineRequest'
        description: Query pipeline execution request
        required: true
        x-originalParamName: body
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ExecuteQueryPipelineResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
components:
  schemas:
    models.ExecuteQueryPipelineRequest:
      properties:
        performance:
          enum:
            - small
            - medium
            - large
          type: string
        query_parameters:
          description: >-
            SQL Query parameters in json key-value pairs. Each parameter is to
            be provided in key-value pairs. This enables you to execute a
            parameterized query with the provided values for your parameter
            keys.
          type: object
      required:
        - performance
      type: object
    models.ExecuteQueryPipelineResponse:
      properties:
        pipeline_execution_id:
          description: >-
            Unique identifier for the pipeline execution. Use this ID to check
            the status

            and retrieve results of the pipeline execution.
          example: 01HKZJ2683PHF9Q9PHHQ8FW4Q1
          type: string
      type: object
    models.Error400:
      properties:
        error:
          example: Bad Request
          type: string
      type: object
    models.Error401:
      properties:
        error:
          example: Invalid API Key
          type: string
      type: object
    models.Error404:
      properties:
        error:
          example: Object not found
          type: string
      type: object
    models.Error500:
      properties:
        error:
          example: Internal error
          type: string
      type: object

````