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

# パイプラインを実行

> ナレッジベースの完全なナレッジパイプラインを実行します。ストリーミングとブロッキングの両方のレスポンスモードをサポートしています。



## OpenAPI

````yaml /ja/api-reference/openapi_knowledge.json post /datasets/{dataset_id}/pipeline/run
openapi: 3.0.1
info:
  title: ナレッジAPI
  description: >-
    ナレッジベース、ドキュメント、チャンク、メタデータ、タグの管理（作成、取得、設定を含む）のための API です。**注意：**単一のナレッジベース
    API キーは、同じアカウント配下のすべての可視ナレッジベースを操作する権限を持ちます。データセキュリティにご注意ください。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Knowledge API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: データセット
    description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
  - name: ドキュメント
    description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
  - name: チャンク
    description: ドキュメントチャンクと子チャンクの管理のための操作です。
  - name: メタデータ
    description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
  - name: タグ管理
    description: ナレッジベースタグとタグバインディングの管理のための操作です。
  - name: モデル
    description: 利用可能なモデルを取得するための操作です。
  - name: ナレッジパイプライン
    description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
paths:
  /datasets/{dataset_id}/pipeline/run:
    post:
      tags:
        - ナレッジパイプライン
      summary: パイプラインを実行
      description: ナレッジベースの完全なナレッジパイプラインを実行します。ストリーミングとブロッキングの両方のレスポンスモードをサポートしています。
      operationId: runPipelineJa
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: ナレッジベース 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: >-
                    パイプライン入力変数のキーと値のペア。ワークフローで定義されたパイプライン変数に対応します。入力変数がない場合は
                    `{}` を渡してください。
                datasource_type:
                  type: string
                  enum:
                    - local_file
                    - online_document
                    - website_crawl
                    - online_drive
                  description: データソースのタイプ。`datasource_info_list` の各項目に必要なフィールドを決定します。
                datasource_info_list:
                  type: array
                  description: 処理対象のデータソースオブジェクトのリストです。項目の構造は `datasource_type` によって異なります。
                  items:
                    oneOf:
                      - title: Local File
                        type: object
                        required:
                          - reference
                        properties:
                          reference:
                            type: string
                            description: >-
                              [パイプラインファイルアップロード](/api-reference/ナレッジパイプライン/パイプラインファイルをアップロード)
                              エンドポイントから返される `id` を使用してください。`related_id`
                              もエイリアスとして使用可能です。
                          name:
                            type: string
                            description: ドキュメントのタイトルです。デフォルトは `"untitled"` です。
                      - title: Online Document
                        type: object
                        required:
                          - workspace_id
                          - page
                        properties:
                          workspace_id:
                            type: string
                            description: >-
                              外部プラットフォームのワークスペースまたはデータベース ID（例：Notion のワークスペース
                              ID）。
                          page:
                            type: object
                            description: ページの詳細です。
                            required:
                              - page_id
                              - type
                            properties:
                              page_id:
                                type: string
                                description: ページ識別子です。
                              type:
                                type: string
                                description: >-
                                  データソースプラグインで定義されたページタイプ（例：`"page"`、`"database"`）。
                              page_name:
                                type: string
                                description: 表示名です。デフォルトは `"untitled"` です。
                          credential_id:
                            type: string
                            description: >-
                              外部プラットフォームとの認証用クレデンシャルです。Dify
                              コンソールで管理します。省略した場合、プロバイダーのデフォルトクレデンシャルが使用されます。
                      - title: Website Crawl
                        type: object
                        required:
                          - url
                        properties:
                          url:
                            type: string
                            description: クロール対象の URL です。
                          title:
                            type: string
                            description: ドキュメント名として使用されます。デフォルトは `"untitled"` です。
                      - title: Online Drive
                        type: object
                        required:
                          - id
                          - type
                        properties:
                          id:
                            type: string
                            description: ファイルまたはフォルダの ID です。
                          type:
                            type: string
                            enum:
                              - file
                              - folder
                            description: この項目が単一ファイルか、展開対象のフォルダかを指定します。
                          bucket:
                            type: string
                            description: >-
                              ストレージバケット名です。一部のドライブプロバイダー（S3
                              互換ストレージなど）で必要です。プロバイダーがバケットを使用しない場合は省略できます。
                          name:
                            type: string
                            description: ファイル名です。デフォルトは `"untitled"` です。
                start_node_id:
                  type: string
                  description: パイプライン実行を開始するノードの ID です。
                is_published:
                  type: boolean
                  description: >-
                    パイプラインの公開版またはドラフト版のどちらを実行するかを指定します。`true`
                    は最新の公開版を実行し、`false` は現在のドラフトを実行します（未公開の変更をテストする場合に便利です）。
                response_mode:
                  type: string
                  enum:
                    - streaming
                    - blocking
                  description: >-
                    パイプライン実行のレスポンスモードです。`streaming` は Server-Sent Events
                    ストリームを返し、`blocking` は完了まで待機して完全な結果を返します。
            examples:
              local_file:
                summary: リクエスト例—ローカルファイル
                value:
                  inputs: {}
                  datasource_type: local_file
                  datasource_info_list:
                    - reference: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      name: quarterly-report.pdf
                  start_node_id: '1719288585006'
                  is_published: true
                  response_mode: blocking
              online_document:
                summary: リクエスト例—オンラインドキュメント
                value:
                  inputs: {}
                  datasource_type: online_document
                  datasource_info_list:
                    - workspace_id: ws-abc123
                      page:
                        page_id: pg-def456
                        type: page
                        page_name: Product Roadmap
                      credential_id: cred-789xyz
                  start_node_id: '1719288585006'
                  is_published: true
                  response_mode: streaming
              website_crawl:
                summary: リクエスト例—ウェブサイトクロール
                value:
                  inputs: {}
                  datasource_type: website_crawl
                  datasource_info_list:
                    - url: https://example.com/docs/getting-started
                      title: Getting Started Guide
                  start_node_id: '1719288585006'
                  is_published: true
                  response_mode: blocking
              online_drive:
                summary: リクエスト例—オンラインドライブ
                value:
                  inputs: {}
                  datasource_type: online_drive
                  datasource_info_list:
                    - id: file-abc123
                      type: file
                      bucket: my-bucket
                      name: meeting-notes.docx
                  start_node_id: '1719288585006'
                  is_published: true
                  response_mode: blocking
      responses:
        '200':
          description: >-
            パイプライン実行結果。フォーマットは `response_mode` に依存します：ストリーミングは
            `text/event-stream` を返し、ブロッキングは完全な JSON 結果を返します。
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  Server-Sent Events ストリームです。各行は `data: {JSON}\n\n`
                  形式です。主要なイベント：`workflow_started`（実行開始）、`node_started` /
                  `node_finished`（ノードごとの進捗、`node_id`、`node_type`、`status`、`inputs`、`outputs`
                  を含む）、`workflow_finished`（最終結果、`status`、`outputs`、`total_tokens`、`elapsed_time`
                  を含む）、`ping`（キープアライブ）。
            application/json:
              schema:
                type: object
                description: パイプライン実行の完全な結果です。`response_mode` が `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` : アクセスが禁止されています。'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    status: 403
                    code: forbidden
                    message: Forbidden.
        '404':
          description: '`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` : パイプライン実行に失敗しました。'
          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 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer `
        プレフィックスを付けた API Key を含めてください。例：`Authorization: Bearer {API_KEY}`。**API
        Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key
        の漏洩は深刻な結果につながる可能性があります。**

````