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

# Stream thread run

> Run the agent/chat for this thread and stream the response via Server-Sent Events (SSE). Use for real-time chat UIs; events include message deltas and run status. A final `event: usage` reports credits for this turn and the thread total.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/graphify/threads/{thread_id}/runs/stream
openapi: 3.0.0
info:
  title: Flowra API (API Key Endpoints)
  description: >-
    **Flowra** is an AI-powered platform for building agents, workflows, and
    integrations.


    ### Capabilities

    - **Tools & Toolkits** – Define and group tools for agents and workflows.

    - **Workflows** – Orchestrate steps and automate processes.

    - **Triggers** – Schedule or event-based execution.

    - **Auth & Connections** – OAuth, API keys, and connected accounts.

    - **MCP** – Model Context Protocol server integration.

    - **Knowledge / RAG** – Add files and URLs for retrieval-augmented
    generation.


    ### Authentication

    Use the **x-api-key** header with a project API key to access endpoints that
    support API Key auth. Create and manage API keys in the dashboard under your
    project settings.


    Only endpoints that support API Key authentication via the @ApiKeyEnabled()
    decorator.


    Send x-api-key (required). On multi-tenant endpoints, optionally send
    x-username to act as an external user.
  version: '1.0'
  contact:
    name: Flowra
    url: https://flowra.dev
servers:
  - url: https://flowra.dev
    description: Flowra API
security: []
tags:
  - name: Users
    description: User profile
  - name: External Users
    description: End-user identities inside a project (x-username)
  - name: Auth Configs
    description: OAuth and API key configs for toolkits
  - name: Connected Accounts
    description: OAuth connected accounts and link creation
  - name: Toolkits
    description: List and search toolkits
  - name: Tools
    description: List, execute, and manage tools
  - name: Skills
    description: Browse, create, import, and install skills
  - name: Workflow & Agent
    description: Create, run, and inspect workflows and agents
  - name: Triggers
    description: Schedule and event-based trigger instances
  - name: Chat
    description: Threads and streaming agent runs
  - name: File
    description: Upload, list, and download files
  - name: Knowledge
    description: RAG knowledge collections
  - name: Table
    description: Collections and documents
  - name: Sandbox
    description: Ephemeral and durable code sandboxes
  - name: Browser
    description: Live browser sessions and view
  - name: LLM
    description: List AI models and generate completions
  - name: MCP
    description: MCP server management
  - name: usage
    description: Credit balance and usage ledger for the project API key
paths:
  /api/v1/graphify/threads/{thread_id}/runs/stream:
    post:
      tags:
        - Chat
      summary: Stream thread run
      description: >-
        Run the agent/chat for this thread and stream the response via
        Server-Sent Events (SSE). Use for real-time chat UIs; events include
        message deltas and run status. A final `event: usage` reports credits
        for this turn and the thread total.
      operationId: GraphifyController_streamThreadRun
      parameters:
        - name: thread_id
          required: true
          in: path
          description: Thread ID
          schema:
            example: b737d8af-a9e0-4251-9714-3fdc1126e5fb
            type: string
        - name: x-end-user-token
          required: false
          in: header
          description: >-
            Optional host-issued identity token for the end user (HMAC/JWT).
            Used when the agent identity policy requires proof.
          schema:
            type: string
        - name: x-username
          in: header
          required: false
          description: >-
            External user (end user) to act as. Optional — if omitted, Flowra
            uses the project’s default external user. Send a stable username
            (e.g. customer_alice) only when you need another end-user context.
          schema:
            type: string
            default: (project default user)
          example: customer_alice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StreamThreadRunDto'
      responses:
        '200':
          description: Server-sent events
          content:
            application/json:
              schema:
                type: string
                description: SSE body
        '201':
          description: Server-sent events
          content:
            application/json:
              schema:
                type: string
                description: SSE body
      security:
        - x-api-key: []
        - x-api-key: []
          x-username: []
components:
  schemas:
    StreamThreadRunDto:
      type: object
      properties:
        input:
          $ref: '#/components/schemas/ThreadInputDto'
        command:
          type: object
          description: >-
            Run command forwarded as-is (e.g. `{ "resume": { "decisions": [...]
            } }` for human-in-the-loop). Required when resuming without new
            messages.
          example:
            resume:
              decision: approve
        stream_mode:
          description: Stream modes
          example:
            - values
            - messages-tuple
            - custom
          type: array
          items:
            type: string
        stream_subgraphs:
          type: boolean
          description: Stream subgraphs
          example: true
          default: true
        stream_resumable:
          type: boolean
          description: Stream resumable
          example: true
          default: true
        assistant_id:
          type: string
          description: Assistant ID
          example: flowra-assistant
        on_disconnect:
          type: string
          description: Action on disconnect
          example: continue
          default: continue
        workflowId:
          type: string
          description: Workflow ID (agent workflow) to use for this conversation
          example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
          format: uuid
        model:
          type: string
          description: >-
            Optional model id override for this run (session-scoped). When set,
            wins over the agent workflow default model.
          example: openai/gpt-4o-mini
        reasoningEffort:
          type: string
          enum:
            - none
            - low
            - medium
            - high
          description: >-
            Optional reasoning effort override for this run (session-scoped).
            `none` disables workflow default reasoning. low|medium|high when the
            model supports reasoning_effort.
          example: none
    ThreadInputDto:
      type: object
      properties:
        messages:
          description: Messages array
          type: array
          items:
            $ref: '#/components/schemas/MessageDto'
      required:
        - messages
    MessageDto:
      type: object
      properties:
        id:
          type: string
          description: Message ID
        type:
          type: string
          description: Message type
          example: human
        content:
          description: Message content
          example:
            - type: text
              text: Hello
          type: array
          items:
            $ref: '#/components/schemas/MessageContentDto'
      required:
        - type
        - content
    MessageContentDto:
      type: object
      properties:
        type:
          type: string
          description: Content type
          example: text
          enum:
            - text
            - image_url
        text:
          type: string
          description: Text content
          example: Hello
        image_url:
          $ref: '#/components/schemas/ImageUrlDto'
      required:
        - type
    ImageUrlDto:
      type: object
      properties:
        url:
          type: string
          description: Image URL (e.g. file download URL or data URL)
          example: http://localhost:10000/api/v1/file/download/xxx
      required:
        - url
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Project API key. Create and manage keys in the dashboard under Project →
        API Keys. Send as header: x-api-key: <your-key>
    x-username:
      type: apiKey
      in: header
      name: x-username
      description: >-
        Optional. External user username. If omitted, Flowra uses the project’s
        default external user. Send as header: x-username: <username>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.