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

# Send a message

> Appends a user message to a **text** conversation, runs one agent turn, and returns the agent's reply.

**Constraints:** this endpoint applies to text conversations only, and the conversation must be **active** (status `triggered`, `ringing`, or `in_progress`). Other channels, or conversations that have ended, return `409`.

Set `interactivity` to `rich` to also receive any UI widgets the agent emitted this turn. Requires a token with write access.



## OpenAPI

````yaml /openapi.json post /core/conversations/{conversation_id}/messages
openapi: 3.0.3
info:
  title: AnyReach API
  version: 1.0.0
  description: REST API for the AnyReach platform.
servers:
  - url: https://api.anyreach.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Conversations
    description: >-
      Create, list, retrieve, and message conversations between your users and
      AnyReach agents.
paths:
  /core/conversations/{conversation_id}/messages:
    post:
      tags:
        - Conversations
      summary: Send a message
      description: >-
        Appends a user message to a **text** conversation, runs one agent turn,
        and returns the agent's reply.


        **Constraints:** this endpoint applies to text conversations only, and
        the conversation must be **active** (status `triggered`, `ringing`, or
        `in_progress`). Other channels, or conversations that have ended, return
        `409`.


        Set `interactivity` to `rich` to also receive any UI widgets the agent
        emitted this turn. Requires a token with write access.
      operationId: sendConversationMessage
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
          description: The text conversation to send the message to.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextMessageRequest'
            example:
              text: Where is my order?
              interactivity: rich
      responses:
        '200':
          description: The agent's reply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The conversation is not a text channel, or is no longer active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    TextMessageRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: The user's message. Cannot be empty.
        interactivity:
          type: string
          enum:
            - plain
            - rich
          default: plain
          description: >-
            plain returns text only; rich also returns any UI widgets the agent
            emitted this turn.
    SendMessageResponse:
      type: object
      properties:
        conversation_id:
          type: string
          description: The conversation the reply belongs to.
        reply:
          type: string
          description: The agent's text response for this turn.
        tool_calls:
          type: array
          description: >-
            The tools the agent invoked this turn and their results, paired by
            call_id. Empty when no tools were used.
          items:
            type: object
            additionalProperties: true
        widgets:
          type: array
          description: >-
            Included only when interactivity is rich. The UI widgets the agent
            emitted this turn; an empty array if none. Each item is { "type":
            <widget_type>, "data": { ... } }. Widget types: detail, carousel,
            info, list, action_grid, collect_otp, collect_phone_number,
            order_tracker, comparison.
          items:
            type: object
            additionalProperties: true
    Error:
      type: object
      properties:
        detail:
          type: string
          description: A human-readable description of the error.
          example: Conversation not found
  responses:
    Forbidden:
      description: The token's role doesn't grant access to this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The conversation does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: The request body or parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Personal access token. See Authentication.

````