> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-add-new-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Pipeline

> Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response modes.



## OpenAPI

````yaml /en/api-reference/openapi_knowledge.json post /datasets/{dataset_id}/pipeline/run
openapi: 3.0.1
info:
  title: Knowledge API
  description: >-
    API for managing knowledge bases, documents, chunks, metadata, and tags,
    including creation, retrieval, and configuration. **Note:** A single
    Knowledge Base API key has permission to operate on all visible knowledge
    bases under the same account. Please pay attention to data security.
  version: 1.0.0
servers:
  - url: '{apiBaseUrl}'
    description: The base URL for the Knowledge API.
    variables:
      apiBaseUrl:
        default: https://api.dify.ai/v1
        description: Actual base URL of the API
security:
  - ApiKeyAuth: []
tags:
  - name: Knowledge Bases
    description: >-
      Operations for managing knowledge bases, including creation,
      configuration, and retrieval.
  - name: Documents
    description: >-
      Operations for creating, updating, and managing documents within a
      knowledge base.
  - name: Chunks
    description: Operations for managing document chunks and child chunks.
  - name: Metadata
    description: >-
      Operations for managing knowledge base metadata fields and document
      metadata values.
  - name: Tags
    description: Operations for managing knowledge base tags and tag bindings.
  - name: Models
    description: Operations for retrieving available models.
  - name: Knowledge Pipeline
    description: >-
      Operations for managing and running knowledge pipelines, including
      datasource plugins and pipeline execution.
paths:
  /datasets/{dataset_id}/pipeline/run:
    post:
      tags:
        - Knowledge Pipeline
      summary: Run Pipeline
      description: >-
        Execute the full knowledge pipeline for a knowledge base. Supports both
        streaming and blocking response modes.
      operationId: runPipeline
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Knowledge base ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inputs
                - datasource_type
                - datasource_info_list
                - start_node_id
                - is_published
                - response_mode
              properties:
                inputs:
                  type: object
                  additionalProperties: true
                  description: Input variables for the pipeline.
                datasource_type:
                  type: string
                  enum:
                    - online_document
                    - local_file
                    - website_crawl
                    - online_drive
                  description: Type of the datasource.
                datasource_info_list:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                  description: >-
                    List of datasource information objects for the pipeline to
                    process.
                start_node_id:
                  type: string
                  description: ID of the node to start pipeline execution from.
                is_published:
                  type: boolean
                  description: >-
                    Whether to run the published or draft version of the
                    pipeline. `true` runs the published version, `false` runs
                    the draft.
                response_mode:
                  type: string
                  enum:
                    - streaming
                    - blocking
                  description: >-
                    Response mode for the pipeline execution. `streaming`
                    returns a Server-Sent Events stream, `blocking` waits and
                    returns the complete result.
      responses:
        '200':
          description: >-
            Pipeline execution result. Format depends on `response_mode`:
            streaming returns a `text/event-stream`, blocking returns a JSON
            object.
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  Server-Sent Events stream containing pipeline execution
                  progress and results. Returned when `response_mode` is
                  `streaming`.
            application/json:
              schema:
                type: object
                description: >-
                  Complete pipeline execution result. Returned when
                  `response_mode` is `blocking`.
                additionalProperties: true
              examples:
                success:
                  summary: Blocking Response Example
                  value:
                    task_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    workflow_run_id: f1e2d3c4-b5a6-7890-abcd-ef0987654321
                    data:
                      id: f1e2d3c4-b5a6-7890-abcd-ef0987654321
                      status: succeeded
                      outputs: {}
                      created_at: 1741267200
                      finished_at: 1741267210
        '403':
          description: '`forbidden` : Forbidden.'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    status: 403
                    code: forbidden
                    message: Forbidden.
        '404':
          description: '`not_found` : Dataset not found.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found.
        '500':
          description: '`pipeline_run_error` : Pipeline execution failed.'
          content:
            application/json:
              examples:
                pipeline_run_error:
                  summary: pipeline_run_error
                  value:
                    status: 500
                    code: pipeline_run_error
                    message: 'Pipeline execution failed: connection timeout'
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key authentication. For all API requests, include your API Key in
        the `Authorization` HTTP Header, prefixed with `Bearer `. Example:
        `Authorization: Bearer {API_KEY}`. **Strongly recommend storing your API
        Key on the server-side, not shared or stored on the client-side, to
        avoid possible API-Key leakage that can lead to serious consequences.**

````