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

# send text message

> Send a text message to a chat



## OpenAPI

````yaml api-reference/openapi.json post /devices/{id}/messages/text
openapi: 3.1.0
info:
  title: Chatlevel API
  description: >-
    Chatlevel is a WhatsApp web API to manage any WhatsApp account
    programmatically.
  version: v1.0.0
servers:
  - url: https://api.chatlevel.io/v1
security:
  - bearerAuth: []
tags:
  - name: devices
    description: Operations related to managing devices.
  - name: messages
    description: Operations related to sending messages.
paths:
  /devices/{id}/messages/text:
    post:
      tags:
        - messages
      summary: send text message
      description: Send a text message to a chat
      operationId: send-text-message
      parameters:
        - name: id
          in: path
          description: Device ID
          required: true
          schema:
            type: integer
            description: Numeric device identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - message
              oneOf:
                - required:
                    - to
                - required:
                    - toNumber
              properties:
                to:
                  type: string
                  description: >-
                    Full WhatsApp JID. Use for LIDs (e.g.,
                    '138087493537914@lid'), groups (e.g.,
                    '123456789-987654@g.us'), or full phone JIDs (e.g.,
                    '31612345678@s.whatsapp.net'). Mutually exclusive with
                    toNumber.
                  example: 123456789-987654@g.us
                toNumber:
                  type: string
                  description: >-
                    WhatsApp phone number (digits only, 8-15 digits). Will be
                    formatted as phone@s.whatsapp.net. Mutually exclusive with
                    'to'.
                  example: '31620292537'
                message:
                  type: string
                  description: Text message to send
      responses:
        '200':
          description: Message sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  messageId:
                    type: string
              example:
                status: success
                messageId: 3EB0C1F0B2F0A1D5E8F4
        '400':
          $ref: '#/components/responses/400InvalidJSON'
        '401':
          $ref: '#/components/responses/401Unauthorized'
        '404':
          description: Device not found or not connected
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/status'
              example:
                status:
                  code: 404
                  message: Device 12345 is not connected.
        '408':
          $ref: '#/components/responses/408Timeout'
        '413':
          $ref: '#/components/responses/413PayloadTooLarge'
        '422':
          $ref: '#/components/responses/422NotAuthenticated'
        '429':
          $ref: '#/components/responses/429RateLimit'
        '500':
          description: Failed to send message
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/status'
              example:
                status:
                  code: 500
                  message: Failed to send message
components:
  responses:
    400InvalidJSON:
      description: Invalid JSON format
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  message:
                    type: string
                    example: Invalid JSON format
    401Unauthorized:
      description: Missing or invalid authorization header
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              error:
                type: object
                properties:
                  code:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: >-
                      Missing or invalid authorization header. Please provide a
                      Bearer token.
    408Timeout:
      description: Request timeout
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: object
                properties:
                  code:
                    type: integer
                    example: 408
                  message:
                    type: string
                    example: Request timeout
    413PayloadTooLarge:
      description: Request payload too large
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: object
                properties:
                  code:
                    type: integer
                    example: 413
                  message:
                    type: string
                    example: Request payload too large
    422NotAuthenticated:
      description: Device is not fully authenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: object
                properties:
                  code:
                    type: integer
                    example: 422
                  message:
                    type: string
                    example: >-
                      Device is not fully authenticated. Please scan the QR code
                      to complete the connection.
    429RateLimit:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: object
                properties:
                  code:
                    type: integer
                    example: 429
                  message:
                    type: string
                    example: >-
                      Rate limit exceeded. Maximum 100 requests per minute per
                      user.
  schemas:
    status:
      type: object
      properties:
        code:
          type: integer
          description: Status code
          example: 200
        message:
          type: string
          description: Status message
          example: Success
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Provide your API key as: Authorization: Bearer
        <api_key>

````