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

# ワークフローイベントをストリーム

> 一時停止後または元の SSE 接続が切断された後にワークフロー実行の Server-Sent Events ストリームを再開します。すでに完了している実行に対しては、`workflow_finished` イベントを 1 つ送信してストリームを閉じます。



## OpenAPI

````yaml /ja/api-reference/openapi_workflow.json get /workflow/{task_id}/events
openapi: 3.0.1
info:
  title: ワークフローアプリAPI
  description: ワークフローアプリケーションはセッションなしの動作をサポートし、翻訳、記事作成、要約 AI などに最適です。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Workflow App 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: 人間の入力を要する一時停止中のワークフローの再開操作です。
paths:
  /workflow/{task_id}/events:
    get:
      tags:
        - ワークフロー
      summary: ワークフローイベントをストリーム
      description: >-
        一時停止後または元の SSE 接続が切断された後にワークフロー実行の Server-Sent Events
        ストリームを再開します。すでに完了している実行に対しては、`workflow_finished` イベントを 1
        つ送信してストリームを閉じます。
      operationId: streamWorkflowEvents
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 元のワークフロー実行リクエストで返されたワークフロー実行 ID。
        - name: user
          in: query
          required: true
          schema:
            type: string
          description: この実行を最初にトリガーしたエンドユーザー識別子。ワークフロー実行の作成者と一致している必要があります。
        - name: include_state_snapshot
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            `true`
            の場合、永続化された状態スナップショットからリプレイし、新しいイベントのストリーミング開始前に実行済みノードのステータスサマリーを含めます。
        - name: continue_on_pause
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            `true` に設定すると、複数の `workflow_paused`
            イベントを跨いでストリームを開いたままにします（ワークフローに複数の人間の入力ノードが連続する場合に有用）。デフォルトでは最初の一時停止で閉じます。
      responses:
        '200':
          description: >-
            Server-Sent Events ストリーム。各イベントは `data: {JSON}\n\n`
            として配信されます。イベントペイロードは元のストリーミングレスポンスと同じスキーマに従います。
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  再開されたワークフロー実行のイベントの SSE ストリームです。形式は
                  [ワークフローを実行](/api-reference/ワークフロー/ワークフローを実行) と同じです。再開された部分で
                  `reasoning_format: separated` を指定した LLM ノードが実行される場合、このストリームには
                  `reasoning_chunk` イベントも含まれます。
              examples:
                resumedRun:
                  summary: レスポンス例 - 再開実行
                  value: >-
                    data: {"event": "human_input_form_filled", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": {"node_id":
                    "approval_node", "node_title": "Approval",
                    "rendered_content": "Please review the draft.", "action_id":
                    "approve", "action_text": "Approve"}} data: {"event":
                    "node_started", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": {"id":
                    "node_exec_2", "node_id": "node_1", "node_type": "llm",
                    "title": "LLM Node", "index": 2, "created_at": 1705407705}}
                    data: {"event": "reasoning_chunk", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data":
                    {"reasoning": "Approved, now translating.", "node_id":
                    "node_1", "is_final": false}} data: {"event":
                    "reasoning_chunk", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data":
                    {"reasoning": "", "node_id": "node_1", "is_final": true}}
                    data: {"event": "text_chunk", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": {"text":
                    "Bonjour", "from_variable_selector": ["node_1", "text"]}}
                    data: {"event": "workflow_finished", "task_id":
                    "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": {"id":
                    "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "workflow_id":
                    "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345", "status":
                    "succeeded", "outputs": {"result": "Bonjour"},
                    "elapsed_time": 2.1, "total_tokens": 42, "total_steps": 2,
                    "created_at": 1705407629, "finished_at": 1705407706}}
        '400':
          description: >-
            `not_workflow_app` : Please check if your app mode matches the right
            API route.
          content:
            application/json:
              examples:
                not_workflow_app:
                  summary: not_workflow_app
                  value:
                    status: 400
                    code: not_workflow_app
                    message: Please check if your app mode matches the right API route.
        '404':
          description: '`not_found` : Workflow run not found.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Workflow run not found
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
        の漏洩は深刻な結果につながる可能性があります。**

````