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

# Send a message

> Send a message to start or continue a conversation with an agent



## OpenAPI

````yaml post /api/v2/conversations
openapi: 3.0.1
info:
  title: LiveChatAI API v2
  description: >-
    LiveChatAI API v2 - Build powerful AI-powered customer support experiences.
    This API follows REST principles with predictable, resource-oriented URLs,
    JSON responses, and standard HTTP methods.
  version: 2.0.0
servers:
  - url: https://app.livechatai.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v2/conversations:
    post:
      tags:
        - Conversations
      summary: Send a message
      description: Send a message to start or continue a conversation with an agent
      requestBody:
        required: true
        description: Message details for the agent
        content:
          application/json:
            schema:
              type: object
              required:
                - question
                - agentId
              properties:
                question:
                  type: string
                  example: What are your business hours?
                  description: The question or message to send to the agent
                agentId:
                  type: string
                  example: clx1234567890abcdef
                  description: Unique identifier of the agent to message
                contactId:
                  type: string
                  example: contact_1234567890
                  description: >-
                    Optional: ID of an existing contact to associate with this
                    conversation. If not provided, a new contact may be created
                    automatically.
                conversationId:
                  type: string
                  example: chat_1234567890
                  description: >-
                    Optional: ID of an existing conversation to continue. If
                    provided, the message will be added to the existing
                    conversation. If not provided, a new conversation will be
                    created and returned in the response.
                messageType:
                  type: string
                  enum:
                    - TEXT
                    - IMAGE
                    - FILE
                  example: TEXT
                  description: >-
                    Type of message being sent. Resolved automatically when
                    attachments are provided (single image -> IMAGE, otherwise
                    FILE).
                attachments:
                  type: array
                  description: >-
                    Optional file attachments. Upload each file to S3 first via
                    the attachments presign endpoint, then reference the
                    returned metadata here.
                  items:
                    type: object
                    required:
                      - url
                      - name
                      - mimeType
                      - size
                    properties:
                      url:
                        type: string
                        example: https://cdn.example.com/bot/chat/abc/messages/file.pdf
                      name:
                        type: string
                        example: report.pdf
                      mimeType:
                        type: string
                        example: application/pdf
                      size:
                        type: integer
                        description: File size in bytes
                streaming:
                  type: boolean
                  example: false
                  description: 'Optional: Enable streaming of the response'
                ip:
                  type: string
                  example: 192.168.1.1
                  description: 'Optional: Client IP address'
                country:
                  type: string
                  example: US
                  description: 'Optional: Client country code'
                responseFormat:
                  type: string
                  enum:
                    - MARKDOWN
                    - PLAIN
                  default: MARKDOWN
                  example: MARKDOWN
                  description: 'Optional: Format of the AI response (MARKDOWN or PLAIN text)'
                integrationType:
                  type: string
                  enum:
                    - WHATSAPP
                    - SLACK
                  example: WHATSAPP
                  description: 'Optional: Integration type for the conversation'
      responses:
        '200':
          description: Message sent and response received successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: Message sent successfully
                  data:
                    type: object
                    properties:
                      conversationId:
                        type: string
                        example: chat_1234567890
                        description: ID of the conversation
                      contactId:
                        type: string
                        example: contact_1234567890
                        description: ID of the contact
                      response:
                        type: string
                        example: >-
                          Our business hours are Monday to Friday, 9 AM to 6 PM
                          EST.
                        description: AI agent response
                      messageId:
                        type: string
                        example: msg_1234567890
                        description: ID of the sent message
                      responseMessageId:
                        type: string
                        example: msg_0987654321
                        description: ID of the response message
                      links:
                        type: array
                        items:
                          type: object
                          properties:
                            link:
                              type: string
                              example: https://example.com/page
                            type:
                              type: string
                              example: WEBSITE
                        description: Relevant sources used for the response
        '401':
          description: Unauthorized access
        '403':
          description: Access denied - Invalid agent access.
        '429':
          description: Rate limit exceeded - Too many requests.
        '500':
          description: An internal server error occurred.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````