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

# Send Conversation Message

> Send a follow-up to a (possibly running) conversation.

`mode=auto` queues the message while a turn is running and signals `started` when the conversation is idle; `mode=queue` always enqueues.

A `started` response means the message was **not** enqueued (`queue_depth: 0`) - the conversation is idle, so run the turn yourself with [Run Gateway Turn](/api-reference/v1/agents/gateway/run-turn) passing `id` = `conversation_id`. A `queued` response means it was enqueued behind a running turn; that turn drains it automatically, or if nothing is streaming you run the queue with [Drain Queue](/api-reference/v1/agents/gateway/drain-stream).

See the [Agent Gateway overview](/api-reference/v1/agents/gateway/overview) for the full conversation model.


## OpenAPI

````yaml POST /v1/agents/{agent_id}/gateway/conversations/{conversation_id}/messages
openapi: 3.1.0
info:
  title: xpander.ai API Service
  description: |2-

        The xpander.ai API Service provides a unified REST API for managing AI agents,
        executing tasks, managing knowledge bases, and integrating with external systems.
        
        Features:
        - Agent Management: Create, update, deploy, and delete AI agents
        - Task Execution: Invoke agents with support for sync, async, and streaming modes
        - Knowledge Bases: Manage knowledge bases and documents for RAG workflows
        - Tools: Discover, connect, and attach tools (connectors, custom functions, MCP servers, sub-agents, workflows) to agents and workflows
        - MCP Integration: Model Context Protocol support for standardized AI interactions
        
        Authentication: All endpoints require authentication via either an API key (`x-api-key`) or an OAuth2 JWT (`Authorization: Bearer <jwt>`).
        
  version: '0.001'
servers:
  - url: https://api.xpander.ai
security: []
paths:
  /v1/agents/{agent_id}/gateway/conversations/{conversation_id}/messages:
    post:
      tags:
        - API v1
        - Agents
        - Agent Gateway
      summary: Send Conversation Message
      description: >-
        Send a follow-up to a (possibly running) conversation. mode=auto queues
        while running and signals 'started' when idle; mode=queue always
        enqueues.
      operationId: >-
        Send_Conversation_Message_v1_agents__agent_id__gateway_conversations__conversation_id__messages_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
            title: Conversation Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayMessageAccepted'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GatewayMessageRequest:
      properties:
        text:
          type: string
          title: Text
          default: ''
        files:
          items:
            type: string
          type: array
          title: Files
        mode:
          $ref: '#/components/schemas/GatewayMessageMode'
          default: auto
        idempotency_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Idempotency Key
        user:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: User
      type: object
      title: GatewayMessageRequest
      description: Body of the chat-backend `messages` / `steer` endpoints.
    GatewayMessageAccepted:
      properties:
        action:
          type: string
          title: Action
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
        queue_depth:
          type: integer
          title: Queue Depth
          default: 0
        steer_target:
          anyOf:
            - type: string
            - type: 'null'
          title: Steer Target
      type: object
      required:
        - action
      title: GatewayMessageAccepted
      description: Result of accepting an inbound message for a running conversation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GatewayMessageMode:
      type: string
      enum:
        - auto
        - queue
        - steer
      title: GatewayMessageMode
      description: How an inbound message to a (possibly running) conversation is handled.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: API Key for authentication
      in: header
      name: x-api-key

````