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

# Send a test message

> Append a user message and execute the next agent turn.

Requires membership in the requested workspace and available usage quota. Send nonempty `text` and the latest `expected_revision` to detect concurrent edits. This executes the agent and may call its configured tools.

A stale revision returns `409`; fetch the session again before retrying. Insufficient quota returns `402`. The response contains the updated session, revision, and completion state. A repeated successful request can append the message again; it is not an idempotent retry.


## OpenAPI

````yaml POST /api/v1/workflow/{workflow_id}/text-chat/sessions/{run_id}/messages
openapi: 3.1.0
info:
  title: Bandwidth Agent Builder API
  version: v1
  description: >-
    Manage agents, place calls, and retrieve conversation results in your
    workspace.
servers:
  - url: https://agents.labs.bandwidth.com
    description: Workspace API
security: []
paths:
  /api/v1/workflow/{workflow_id}/text-chat/sessions/{run_id}/messages:
    post:
      tags:
        - text-chat
      summary: Send a test message
      description: >-
        **Authorization:** Accepts a Labs OAuth bearer token or a Labs API key.
        Workspace-scoped resources require membership in the requested
        workspace.


        Append a user message and execute the next agent turn.
      operationId: >-
        append_text_chat_message_api_v1_workflow__workflow_id__text_chat_sessions__run_id__messages_post
      parameters:
        - in: path
          name: workflow_id
          required: true
          schema:
            title: Workflow Id
            type: integer
        - in: path
          name: run_id
          required: true
          schema:
            title: Run Id
            type: integer
        - description: >-
            Required with X-BW-LABS-AGENTS-API-KEY: the positive local workspace
            ID to access. The key owner must be a current member. Missing or
            invalid IDs return 400; non-member workspaces return 403. Not
            required for bearer authentication, which uses the user's selected
            workspace.
          in: header
          name: X-VOAI-ORGANIZATION-ID
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Required with X-BW-LABS-AGENTS-API-KEY: the positive local
              workspace ID to access. The key owner must be a current member.
              Missing or invalid IDs return 400; non-member workspaces return
              403. Not required for bearer authentication, which uses the user's
              selected workspace.
            title: X-Voai-Organization-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppendTextChatMessageRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowRunTextSessionResponse'
          description: Successful Response
        '400':
          description: Invalid request or missing/invalid workspace header with an API key.
        '401':
          description: Missing, invalid, or expired credential.
        '402':
          description: Insufficient usage quota.
        '403':
          description: >-
            The account lacks access to the workspace, resource, or required
            role.
        '404':
          description: Not found
        '409':
          description: Text session revision conflict.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - LabsAuth: []
        - LabsApiKey: []
components:
  schemas:
    AppendTextChatMessageRequest:
      properties:
        expected_revision:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expected Revision
        text:
          minLength: 1
          title: Text
          type: string
      required:
        - text
      title: AppendTextChatMessageRequest
      type: object
    WorkflowRunTextSessionResponse:
      properties:
        annotations:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Annotations
        checkpoint:
          additionalProperties: true
          title: Checkpoint
          type: object
        created_at:
          format: date-time
          title: Created At
          type: string
        gathered_context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Gathered Context
        initial_context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Initial Context
        is_completed:
          title: Is Completed
          type: boolean
        mode:
          title: Mode
          type: string
        name:
          title: Name
          type: string
        revision:
          title: Revision
          type: integer
        session_data:
          additionalProperties: true
          title: Session Data
          type: object
        state:
          title: State
          type: string
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Updated At
        workflow_id:
          title: Workflow Id
          type: integer
        workflow_run_id:
          title: Workflow Run Id
          type: integer
      required:
        - workflow_run_id
        - workflow_id
        - name
        - mode
        - state
        - is_completed
        - revision
        - session_data
        - checkpoint
        - created_at
      title: WorkflowRunTextSessionResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    LabsAuth:
      description: >-
        Bandwidth Labs OAuth access token. Uses the user's selected workspace;
        the workspace header is not required. Do not also send an API key.
        Bearer-only operations may additionally require the Labs `super_user`
        role.
      scheme: bearer
      type: http
    LabsApiKey:
      description: >-
        Bandwidth Labs API key. Also send `X-VOAI-ORGANIZATION-ID` with a
        positive local workspace ID belonging to the key owner. Access follows
        the owner's current workspace role. Do not also send a bearer token. API
        keys cannot access bearer-only or Labs `super_user` operations.
      in: header
      name: X-BW-LABS-AGENTS-API-KEY
      type: apiKey

````

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