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

# Send Message To Conversation

> Send a follow-up message to an existing conversation.

This REST endpoint provides a simplified way to send messages to a running
conversation without requiring a WebSocket connection.

**Alternative Approaches:**

This endpoint is a convenience wrapper. You can also interact with the agent
server directly using:

1. **WebSocket**: Connect to the agent server's WebSocket endpoint for
   real-time bidirectional communication
2. **Agent Server REST API**: Call the agent server's REST endpoints directly
   using the `conversation_url` from `GET /api/v1/app-conversations/{id}`

**Design Note:**

This endpoint is intentionally a thin proxy that forwards messages to the
agent server without additional processing logic. Any custom processing
(validation, transformation, side effects) should be implemented via
webhook callbacks, not in this endpoint. This ensures that direct agent
server invocation and this convenience endpoint remain functionally equivalent.

**Prerequisites:**

- The sandbox must be in RUNNING state
- If the sandbox is PAUSED, call `POST /api/v1/sandboxes/{sandbox_id}/resume` first
- If the sandbox is STARTING, wait for it to reach RUNNING state

**Error responses:**

- 404: Conversation or sandbox not found
- 409: Sandbox exists but is not running (PAUSED, STARTING, STOPPING)
- 410: Conversation is archived (sandbox no longer exists)
- 503: Sandbox is in ERROR state or agent server is unavailable

Args:
    conversation_id: The UUID of the conversation to send the message to
    request: The message content and options

Returns:
    AppSendMessageResponse with success status and sandbox state



## OpenAPI

````yaml /openapi/openhands-cloud.json post /api/v1/app-conversations/{conversation_id}/send-message
openapi: 3.1.0
info:
  title: OpenHands
  description: 'OpenHands: Code Less, Make More'
  version: 0.0.1
servers: []
security: []
paths:
  /api/v1/app-conversations/{conversation_id}/send-message:
    post:
      tags:
        - Conversations
      summary: Send Message To Conversation
      description: >-
        Send a follow-up message to an existing conversation.


        This REST endpoint provides a simplified way to send messages to a
        running

        conversation without requiring a WebSocket connection.


        **Alternative Approaches:**


        This endpoint is a convenience wrapper. You can also interact with the
        agent

        server directly using:


        1. **WebSocket**: Connect to the agent server's WebSocket endpoint for
           real-time bidirectional communication
        2. **Agent Server REST API**: Call the agent server's REST endpoints
        directly
           using the `conversation_url` from `GET /api/v1/app-conversations/{id}`

        **Design Note:**


        This endpoint is intentionally a thin proxy that forwards messages to
        the

        agent server without additional processing logic. Any custom processing

        (validation, transformation, side effects) should be implemented via

        webhook callbacks, not in this endpoint. This ensures that direct agent

        server invocation and this convenience endpoint remain functionally
        equivalent.


        **Prerequisites:**


        - The sandbox must be in RUNNING state

        - If the sandbox is PAUSED, call `POST
        /api/v1/sandboxes/{sandbox_id}/resume` first

        - If the sandbox is STARTING, wait for it to reach RUNNING state


        **Error responses:**


        - 404: Conversation or sandbox not found

        - 409: Sandbox exists but is not running (PAUSED, STARTING, STOPPING)

        - 410: Conversation is archived (sandbox no longer exists)

        - 503: Sandbox is in ERROR state or agent server is unavailable


        Args:
            conversation_id: The UUID of the conversation to send the message to
            request: The message content and options

        Returns:
            AppSendMessageResponse with success status and sandbox state
      operationId: >-
        send_message_to_conversation_api_v1_app_conversations__conversation_id__send_message_post
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Conversation Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppSendMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppSendMessageResponse'
        '404':
          description: Conversation or sandbox not found
        '409':
          description: >-
            Sandbox is not running. Resume it first via POST
            /sandboxes/{id}/resume
        '410':
          description: Conversation is archived (sandbox no longer exists)
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Sandbox is in error state or agent server unavailable
      security:
        - APIKeyHeader: []
components:
  schemas:
    AppSendMessageRequest:
      properties:
        role:
          type: string
          const: user
          title: Role
          description: The role of the message sender. Currently only "user" is supported.
          default: user
        content:
          items:
            anyOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ImageContent'
          type: array
          minItems: 1
          title: Content
          description: The message content as a list of text and/or image content blocks.
        run:
          type: boolean
          title: Run
          description: Whether to automatically run the agent after sending the message.
          default: true
      type: object
      required:
        - content
      title: AppSendMessageRequest
      description: |-
        Request to send a follow-up message to a conversation.

        This is used to send messages to an existing conversation via REST API,
        as an alternative to WebSocket communication.
    AppSendMessageResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the message was successfully sent to the agent.
        sandbox_status:
          $ref: '#/components/schemas/SandboxStatus'
          description: The current status of the sandbox after the operation.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: >-
            Optional message with additional details (e.g., if sandbox was
            resumed).
      type: object
      required:
        - success
        - sandbox_status
      title: AppSendMessageResponse
      description: Response from sending a message to a conversation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TextContent:
      properties:
        cache_prompt:
          type: boolean
          title: Cache Prompt
          default: false
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          title: Text
      additionalProperties: false
      type: object
      required:
        - text
      title: TextContent
    ImageContent:
      properties:
        cache_prompt:
          type: boolean
          title: Cache Prompt
          default: false
        type:
          type: string
          const: image
          title: Type
          default: image
        image_urls:
          items:
            type: string
          type: array
          title: Image Urls
      type: object
      required:
        - image_urls
      title: ImageContent
    SandboxStatus:
      type: string
      enum:
        - STARTING
        - RUNNING
        - PAUSED
        - ERROR
        - MISSING
      title: SandboxStatus
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Access-Token

````