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

# Send conversation messages (AI SDK stream)

> Streams the survey editor agent as an AI SDK UIMessage SSE response. UIMessages are upserted into this conversation. Tip revisions are created when the client save tool (or Review Save) calls PUT /content — not by this stream itself.



## OpenAPI

````yaml /openapi/program.openapi.json post /surveys/{surveyId}/conversations/{conversationId}/messages
openapi: 3.1.0
info:
  title: Questra Program API
  version: 0.0.1
  description: >-
    REST API for the Questra Program product. Browser users authenticate through
    Questra Auth SSO; automation uses workspace-scoped API keys (`Authorization:
    Bearer qpk_live_…`). API keys carry scopes enforced before handlers.
    Outbound webhooks follow Standard Webhooks (at-least-once delivery;
    consumers must be idempotent).
servers:
  - url: /v1
    description: Program API base path
security: []
paths:
  /surveys/{surveyId}/conversations/{conversationId}/messages:
    post:
      tags:
        - Conversations
      summary: Send conversation messages (AI SDK stream)
      description: >-
        Streams the survey editor agent as an AI SDK UIMessage SSE response.
        UIMessages are upserted into this conversation. Tip revisions are
        created when the client save tool (or Review Save) calls PUT /content —
        not by this stream itself.
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: surveyId
          in: path
        - schema:
            type: string
            format: uuid
          required: true
          name: conversationId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostConversationMessageRequest'
      responses:
        '200':
          description: AI SDK UIMessage SSE stream
          content:
            text/event-stream:
              schema:
                type: string
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '409':
          description: Survey not in reviewing or missing target
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    PostConversationMessageRequest:
      type: object
      properties:
        messages:
          type: array
          items: {}
          description: Full AI SDK UIMessage history for this chat turn.
        document_source:
          type: string
          description: >-
            Current Review editor draft. The server-side agent uses this as its
            request-scoped document for reads, diagnostics, and mutations.
        editor_tab:
          $ref: '#/components/schemas/ConversationEditorTab'
      required:
        - messages
    ErrorBody:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        resource:
          type: string
        slug:
          type: string
        file_id:
          type: string
        endpoint_id:
          type: string
        event_id:
          type: string
        delivery_id:
          type: string
        api_key_id:
          type: string
        integration_id:
          type: string
        audit_id:
          type: string
        status:
          type: string
        details: {}
        question_ids:
          type: array
          items:
            type: string
        survey_ids:
          type: array
          items:
            type: string
        revisions:
          type: array
          items:
            type: number
      required:
        - error
    ConversationEditorTab:
      type: string
      enum:
        - preview
        - code
        - files
        - audits
        - regressions
        - simulation
        - history
      description: >-
        Which Review editor tab the user is currently viewing. Used for save
        guidance.

````