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

# Send Text Message

> Send a text message to a WhatsApp number

Send a text message to any WhatsApp number.

## Request Body

<ParamField body="phone" type="string" required>
  Recipient phone number in international format without `+` (e.g., `5511999999999`)
</ParamField>

<ParamField body="body" type="string" required>
  Message text content. Supports emojis and basic formatting.
</ParamField>

<ParamField body="id" type="string">
  Optional message ID to reply to. Creates a quoted reply.
</ParamField>

<ParamField body="linkPreview" type="boolean">
  Enable link preview for URLs in the message. Default: `false`
</ParamField>

<ParamField body="from" type="string">
  Sender instance identifier for multi-instance organizations. Can be:

  * **Phone number**: WhatsApp number (e.g., `5585912345678`)
  * **Instance ID**: UUID of the instance

  If not specified, uses the most recently connected instance.

  <Info>Required for organizations with multiple WhatsApp numbers to specify which number sends the message.</Info>
</ParamField>

## Text Formatting

WhatsApp supports basic text formatting:

| Format        | Syntax       | Result   |
| ------------- | ------------ | -------- |
| Bold          | `*text*`     | **text** |
| Italic        | `_text_`     | *text*   |
| Strikethrough | `~text~`     | ~~text~~ |
| Monospace     | `` `text` `` | `text`   |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.livchat.ai/v1/messages/send \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "phone": "5511999999999",
      "body": "Hello from LivChat!",
      "from": "5585912345678"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.livchat.ai/v1/messages/send", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      phone: "5511999999999",
      body: "Hello from LivChat!",
      from: "5585912345678", // Optional: specify sender instance
    }),
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.livchat.ai/v1/messages/send",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
      },
      json={
          "phone": "5511999999999",
          "body": "Hello from LivChat!",
          "from": "5585912345678",  # Optional: specify sender instance
      },
  )

  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "code": 200,
    "data": {
      "details": "Sent",
      "id": "3EB04A45DCA355D01DB68C",
      "timestamp": "2024-12-10T12:00:00-03:00"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Phone number is required"
    }
  }
  ```
</ResponseExample>
