---
title: "Send a message"
description: "Sends one WhatsApp message to one recipient. The `type` field selects\nthe message kind and decides which other fields apply:\n\n| `type` | When to use | Chat window required |\n|---|---|---|\n| `template` | Approved WhatsApp templates. Works at any time. | No |\n| `text`, `image`, `document`, `audio`, `location` | Free-form messages inside an open conversation. | Yes |\n| `interactive` | Reply buttons or a list menu inside an open conversation. | Yes |\n\nMedia URLs (`url`) must be publicly accessible.\n\nFor templates, only pass the `header` object when the template has a\nheader, only pass `body` when the template has body variables, and only\npass `buttons` when a button carries a variable (for example a\ndynamic **Visit website** URL).\n"
---

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

Path: Zacx Public API › Messages

`POST /message/send`

Sends one WhatsApp message to one recipient. The `type` field selects
the message kind and decides which other fields apply:

| `type` | When to use | Chat window required |
|---|---|---|
| `template` | Approved WhatsApp templates. Works at any time. | No |
| `text`, `image`, `document`, `audio`, `location` | Free-form messages inside an open conversation. | Yes |
| `interactive` | Reply buttons or a list menu inside an open conversation. | Yes |

Media URLs (`url`) must be publicly accessible.

For templates, only pass the `header` object when the template has a
header, only pass `body` when the template has body variables, and only
pass `buttons` when a button carries a variable (for example a
dynamic **Visit website** URL).

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

One of:

- [TemplateMessage](/api/schemas/TemplateMessage)
- [TextMessage](/api/schemas/TextMessage)
- [ImageMessage](/api/schemas/ImageMessage)
- [DocumentMessage](/api/schemas/DocumentMessage)
- [AudioMessage](/api/schemas/AudioMessage)
- [LocationMessage](/api/schemas/LocationMessage)
- [InteractiveMessage](/api/schemas/InteractiveMessage)

Discriminator: `type`

- `template` → [TemplateMessage](/api/schemas/TemplateMessage)
- `text` → [TextMessage](/api/schemas/TextMessage)
- `image` → [ImageMessage](/api/schemas/ImageMessage)
- `document` → [DocumentMessage](/api/schemas/DocumentMessage)
- `audio` → [AudioMessage](/api/schemas/AudioMessage)
- `location` → [LocationMessage](/api/schemas/LocationMessage)
- `interactive` → [InteractiveMessage](/api/schemas/InteractiveMessage)

## Example request

```json
{
  "wabaNumber": "919705182126",
  "recipient": {
    "phoneNumber": "919999999999"
  },
  "type": "template",
  "template": {
    "name": "confirmation",
    "language": "en",
    "header": {
      "text": "Welcome"
    },
    "body": [
      "John",
      "Premium Plan"
    ],
    "buttons": [
      "button1_param"
    ]
  }
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://api.zacx.io/v1/message/send \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "wabaNumber": "919705182126",
  "recipient": {
    "phoneNumber": "919999999999"
  },
  "type": "template",
  "template": {
    "name": "confirmation",
    "language": "en",
    "header": {
      "text": "Welcome"
    },
    "body": [
      "John",
      "Premium Plan"
    ],
    "buttons": [
      "button1_param"
    ]
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.zacx.io/v1/message/send';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    wabaNumber: '919705182126',
    recipient: {phoneNumber: '919999999999'},
    type: 'template',
    template: {
      name: 'confirmation',
      language: 'en',
      header: {text: 'Welcome'},
      body: JSON.stringify(['John', 'Premium Plan']),
      buttons: ['button1_param']
    }
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.zacx.io/v1/message/send"

payload = {
    "wabaNumber": "919705182126",
    "recipient": { "phoneNumber": "919999999999" },
    "type": "template",
    "template": {
        "name": "confirmation",
        "language": "en",
        "header": { "text": "Welcome" },
        "body": ["John", "Premium Plan"],
        "buttons": ["button1_param"]
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The message was accepted. Keep the returned message id to poll delivery status.

#### Example

```json
{
  "status": "success",
  "data": {
    "messageId": "wamid.HBgMOTE5Mjk2MzA0MjI0FQIAERgSMUZDNzgzMjJFNzEwMTkwRjY3AA=="
  }
}
```

- `sendMessage.response.200.status` (string, optional)
- `sendMessage.response.200.data` (object, optional)
  - `sendMessage.response.200.data.messageId` (string, optional) — The WhatsApp message id (`wamid`). Pass it to **Get message status**.
    - example `"wamid.HBgMOTE5Mjk2MzA0MjI0FQIAERgSMUZDNzgzMjJFNzEwMTkwRjY3AA=="`

### 400

One or more parameters are missing or invalid.

#### Example

```json
{
  "status": "error",
  "code": "VALIDATION_FAILED",
  "message": "Parameters are not valid"
}
```

- `sendMessage.response.400.status` (string, required)
- `sendMessage.response.400.code` (string, required) — Stable machine-readable error code.
- `sendMessage.response.400.message` (string, required) — Human-readable explanation.

### 401

The API key is missing or invalid.

#### Example

```json
{
  "status": "error",
  "code": "VALIDATION_FAILED",
  "message": "string"
}
```

- `sendMessage.response.401.status` (string, required)
- `sendMessage.response.401.code` (string, required) — Stable machine-readable error code.
- `sendMessage.response.401.message` (string, required) — Human-readable explanation.


Source: https://zacx.io/api/message/send/index.md
