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

# Send a message



## OpenAPI

````yaml /openapi.json post /messages
openapi: 3.0.0
info:
  title: Visito API
  version: 1.0.0
servers: []
security: []
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Send a message
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - text
                    to:
                      type: string
                      minLength: 1
                      description: Conversation/contact ID.
                    text:
                      type: string
                      minLength: 1
                      description: Message text.
                  required:
                    - type
                    - to
                    - text
                - type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - image
                        - file
                        - video
                        - audio
                    to:
                      type: string
                      minLength: 1
                      description: Conversation/contact ID.
                  required:
                    - type
                    - to
      responses:
        '200':
          description: Message sent
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      message:
                        $ref: '#/components/schemas/Message'
                    required:
                      - message
                required:
                  - data
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Missing or invalid Authorization header
        '403':
          description: Invalid API key
        '404':
          description: Contact not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: contact_not_found
                required:
                  - error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    Message:
      type: object
      properties:
        id:
          type: string
          example: 68505cb92a11ea971d9df894
          description: Message ID
        providerId:
          type: string
          nullable: true
          example: wamid.HBgLMTIzNDU2Nzg5FQIAERgSMzQ1Q0Y5QkE=
          description: Provider message ID (WhatsApp/Meta).
        contact:
          type: string
          nullable: true
          example: 68505cb92a11ea971d9df894
          description: Conversation/contact ID.
        content:
          type: string
          nullable: true
          example: Hello! How can I help?
          description: Message text content.
        role:
          type: string
          nullable: true
          example: assistant
          description: Message role/type.
        status:
          type: string
          nullable: true
          example: unsent
          description: Delivery status.
        error:
          type: string
          nullable: true
          example: Rate limit exceeded
          description: Provider error message when send fails.
      required:
        - id
    ValidationErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: Validation failed
        details:
          type: object
          additionalProperties:
            type: string
          example:
            body.text: Text is required
      required:
        - error
        - details
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: something_went_wrong
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Use `Authorization: Bearer <api_key>`.'

````