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

# Stream agent or network response

> Build and stream responses from an agent or network of agents. Provide either agentId or copilotId (the id of a network).



## OpenAPI

````yaml /api-reference/openapi.json post /v1/chat
openapi: 3.1.0
info:
  title: Sidenet API
  version: 1.0.0
  description: >-
    Sidenet HTTP endpoints exposed by the Sidenet Studio. All routes require an
    api key that can be generated through the studio in studio.sidenet.ai.
servers:
  - url: https://api.sidenet.ai
security:
  - bearerAuth: []
paths:
  /v1/chat:
    post:
      tags:
        - V1
      summary: Stream agent or network response
      description: >-
        Build and stream responses from an agent or network of agents. Provide
        either agentId or copilotId (the id of a network).
      parameters:
        - name: X-Organization-Id
          in: header
          required: false
          schema:
            type: string
          description: Organization to scope the request to.
        - name: X-User-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            End-user identity for the request. Required by endpoints that read
            or write user-scoped resources (threads, messages, memory). A
            `userId` query param (or body field, where documented) is accepted
            as a fallback.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                messages:
                  type: array
                  minItems: 1
                agentId:
                  type: string
                  description: Agent id — runs the agent's active published version
                agentVersionId:
                  type: string
                  description: >-
                    Optional override: run a specific agent version (e.g.
                    preview a draft or an earlier published version) instead of
                    the active one
                copilotId:
                  type: string
                  description: Network id to route through (alternative to agentId)
                threadId:
                  type: string
                  description: Conversation thread id
                groupId:
                  type: string
                  minLength: 1
                  maxLength: 255
                  nullable: true
                  description: >-
                    Optional stable caller-supplied group id. When sent, group
                    matching is by this id; a differing groupName renames the
                    group.
                groupName:
                  type: string
                  nullable: true
                  description: >-
                    Optional group name. Without groupId this matches by name;
                    alongside groupId it is display-only (rename on change).
                runtimeAuth:
                  type: object
                  additionalProperties:
                    type: object
                    additionalProperties: {}
                  description: >-
                    Runtime authentication map: { [providerNameOrId]: {
                    credentials } }
                context:
                  type: array
                  items:
                    type: string
                  description: Additional context messages to provide to the agent.
                trigger:
                  type: string
                  enum:
                    - submit-message
                    - regenerate-message
                  description: AI SDK trigger type
                tools:
                  type: object
                  additionalProperties: {}
                  description: AI SDK client-side tools
                metadata:
                  type: object
                  additionalProperties: {}
                  description: AI SDK session metadata
                use_routing:
                  type: boolean
                  default: true
                  description: >-
                    Default true. When the request targets an orchestrator
                    agent, routing picks whether to stream the orchestrator
                    (multi-step / synthesis) or a single subagent directly
                    (domain-specific ask). No effect when the resolved agent is
                    not an orchestrator. Pass false to disable.
              required:
                - messages
              additionalProperties: false
      responses:
        '200':
          description: AI SDK v6 UIMessageStream response
          content:
            text/event-stream:
              schema:
                type: string
        '400':
          description: Bad request - missing required fields
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: string
        '404':
          description: Agent version not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: string
        '429':
          description: Usage limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  details:
                    type: object
                    properties:
                      currentUsage:
                        type: number
                      limit:
                        type: number
                      groupLimitRemaining:
                        type: number
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key generated in studio.sidenet.ai. Scopes the request to its
        organization.

````