# WhatsApp

- Page: https://bytesms.com/docs/whatsapp (markdown: https://bytesms.com/docs/whatsapp.md)
- API base URL: https://api.bytesms.com/api (public resources under /api/v1)
- Auth: `Authorization: Bearer tp_live_…` — an API key from Dashboard → API Keys; keep it server-side (e.g. `BYTESMS_API_KEY`)
- All docs in one file: https://bytesms.com/llms-full.txt · OpenAPI 3.1: https://bytesms.com/openapi.json

Send WhatsApp OTP codes and approved template messages from Bytesms's verified business number, paid from prepaid THB credit.

Send one-time passcodes and approved template messages over WhatsApp with the same API key you use for email. Messages are sent from Bytesms's own verified WhatsApp Business number — you don't need a Meta Business account, a WhatsApp Business Account or your own phone number.

## Overview

- WhatsApp is available on the **Starter plan and above**. On other plans every endpoint returns `403 whatsapp_not_in_plan`.
- Messages are paid from a prepaid credit balance in Thai baht (THB). Each eligible plan includes a monthly credit; you can top up more in **Dashboard → WhatsApp**. See [Pricing & credits](https://bytesms.com/docs/whatsapp#pricing).
- Workspace owners and admins can also send an approved template without code from **Dashboard → WhatsApp → Send message** (same pricing and rules as the API).
- Authenticate with `Authorization: Bearer tp_live_…`. Both `full_access` and `sending_access` keys can call every WhatsApp endpoint. A [domain-scoped](https://bytesms.com/docs/authentication#domain-scoped) key (one created with a `domain_id`, e.g. for SMTP) can't — every `/v1/whatsapp/*` request with it is `403 restricted_api_key`, so an email-only credential never spends WhatsApp credit. The WhatsApp endpoints share the workspace's [request rate limit](https://bytesms.com/docs/rate-limits) with the rest of the API.
- Response fields on the WhatsApp endpoints are `camelCase` (`expiresAt`, `priceThb`, …).

## Phone number format

Pass recipients in E.164 format, e.g. `+66812345678`. These forms are also accepted and normalized to E.164:

- Without the plus sign: `66812345678`.
- Thai local format with the leading zero: `0812345678` (read as a Thai number).

Numbers that aren't valid phone numbers are rejected with `422 invalid_recipient`. You can message every country WhatsApp supports, unless the platform has restricted destinations (to contain SMS-pumping fraud). A number in a country outside that list returns `422 country_not_allowed`, with the allowed list in the message. The countries you can send to are shown in **Dashboard → WhatsApp**. Prices outside Thailand follow Meta's rate for the country (see [Pricing & credits](https://bytesms.com/docs/whatsapp#pricing)).

## OTP Verify quickstart

The Verify flow generates a 6-digit code, sends it with Bytesms's authentication template, and checks the code your user types back. You never see or store the code.

1. `POST /v1/whatsapp/verifications` with the user's number. Keep the returned `id`.
2. The user receives the code on WhatsApp.
3. `POST /v1/whatsapp/verifications/check` with the `id` (or the number) and the code. Treat the user as verified only when `valid` is `true`.

### Start a verification

`POST https://api.bytesms.com/api/v1/whatsapp/verifications`

**Body**

- `to` (string, required): The recipient's phone number (see [Phone number format](https://bytesms.com/docs/whatsapp#phone-numbers)).
- `language` (string, optional): Language of the message: `th` (Thai) or `en`(English). Defaults to the platform default. If that translation isn't approved yet, the default language is used; the response's `language` says which one was sent.

**cURL**

```bash
# Send a code
curl -X POST 'https://api.bytesms.com/api/v1/whatsapp/verifications' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"to":"+66812345678","language":"th"}'
```

**Node.js**

```js
// Send a code
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/verifications", {
  method: "POST",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+66812345678",
    "language": "th"
  }),
});
console.log(await res.json());
```

**Python**

```python
import requests

# Send a code
res = requests.post(
    "https://api.bytesms.com/api/v1/whatsapp/verifications",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
    json={
        "to": "+66812345678",
        "language": "th"
    },
)
print(res.json())
```

**201 Created**

```json
{
  "id": "5b2f6c1e-8d4a-4f7b-9c3e-1a2b3c4d5e6f",
  "to": "+66812345678",
  "status": "pending",
  "channel": "whatsapp",
  "language": "th",
  "expiresAt": "2026-11-22T08:40:00.000Z",
  "messageId": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
  "priceThb": 0.6
}
```

- OTP uses Bytesms's own authentication template, which Meta must approve first. Until it is approved, this endpoint returns `503 otp_template_not_ready` before anything is sent or charged. Template messages (below) are not affected.
- The code is valid for **10 minutes** by default — use `expiresAt` rather than hard-coding it.
- Starting a new verification cancels any earlier `pending` verification for the same number in your workspace, so only the latest code works.
- At most **5 codes per number per hour** (per workspace, counted per clock hour). More return `429 rate_limit_exceeded`.
- The OTP message is an `authentication` message and is charged like one. `messageId` is the underlying message — [retrieve it](https://bytesms.com/docs/whatsapp#get-message) to follow delivery. If the send fails, the verification is canceled, the credit is refunded and the error is returned.

### Check a code

`POST https://api.bytesms.com/api/v1/whatsapp/verifications/check`

**Body**

- `code` (string, required): The code the user entered, as a string of 4–10 digits (send it as a string so leading zeros survive).
- `id` (string, optional): The verification `id` from the start call. Provide `id` or `to`.
- `to` (string, optional): The phone number, used when you don't pass `id` — the most recent verification for that number is checked.

**cURL**

```bash
# Check a code
curl -X POST 'https://api.bytesms.com/api/v1/whatsapp/verifications/check' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"id":"5b2f6c1e-8d4a-4f7b-9c3e-1a2b3c4d5e6f","code":"482913"}'
```

**Node.js**

```js
// Check a code
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/verifications/check", {
  method: "POST",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "id": "5b2f6c1e-8d4a-4f7b-9c3e-1a2b3c4d5e6f",
    "code": "482913"
  }),
});
console.log(await res.json());
```

**Python**

```python
import requests

# Check a code
res = requests.post(
    "https://api.bytesms.com/api/v1/whatsapp/verifications/check",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
    json={
        "id": "5b2f6c1e-8d4a-4f7b-9c3e-1a2b3c4d5e6f",
        "code": "482913"
    },
)
print(res.json())
```

**200 OK**

```json
{
  "id": "5b2f6c1e-8d4a-4f7b-9c3e-1a2b3c4d5e6f",
  "to": "+66812345678",
  "status": "approved",
  "valid": true
}
```

A check always returns `200` with the verification's `status` and whether this code was `valid`. A wrong code returns `status: "pending"` and `valid: false` while attempts remain.

| status | Meaning |
| --- | --- |
| `pending` | Waiting for the right code. The user can try again. |
| `approved` | The code was correct. Only the check that approved it returns `valid: true`; later checks return `valid: false`. |
| `expired` | The code passed `expiresAt`. Start a new verification. |
| `canceled` | A newer verification was started for the same number, or the code could not be sent. |
| `max_attempts` | Too many wrong codes (5 by default). Start a new verification. |

> **Warning**
>
> Any status other than `pending` is final. Checking a finished verification never returns `valid: true`. Codes are compared in constant time and each attempt is counted before the comparison, so parallel guesses can't exceed the limit.

## Send a template message

`POST https://api.bytesms.com/api/v1/whatsapp/messages`

Sends a template that is approved on Bytesms's WhatsApp Business Account. WhatsApp only allows business-initiated messages through approved templates; the template's category (`authentication`, `utility` or `marketing`), as set by Meta, decides the price.

**Body**

- `to` (string, required): The recipient's phone number (see [Phone number format](https://bytesms.com/docs/whatsapp#phone-numbers)).
- `template` (string, required): The approved template name: lowercase letters, digits and underscores (`^[a-z0-9_]{1,512}$`).
- `language` (string, optional, default `"en"`): The template language code, e.g. `en`, `th` or `en_US`.
- `components` (array, optional): Up to 10 template components with the variable values, in the [WhatsApp Cloud API format](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#template-object) (`header`, `body`, `button` with their `parameters`). Passed to WhatsApp as is.
- `sender_name` (string, optional): One of your workspace's **approved** sender names, used when the template has the `{{sender_name}}`parameter. Omit it to use the workspace's default sender name. A name that isn't approved for the workspace returns `422 sender_name_not_approved`. Ignored by templates without the parameter. See [Sender name](https://bytesms.com/docs/whatsapp#sender-name).

**cURL**

```bash
# Send an order update
curl -X POST 'https://api.bytesms.com/api/v1/whatsapp/messages' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"to":"+66812345678","template":"order_shipped","language":"th","components":[{"type":"body","parameters":[{"type":"text","text":"A-10293"}]}]}'
```

**Node.js**

```js
// Send an order update
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/messages", {
  method: "POST",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+66812345678",
    "template": "order_shipped",
    "language": "th",
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "A-10293"
          }
        ]
      }
    ]
  }),
});
console.log(await res.json());
```

**Python**

```python
import requests

# Send an order update
res = requests.post(
    "https://api.bytesms.com/api/v1/whatsapp/messages",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
    json={
        "to": "+66812345678",
        "template": "order_shipped",
        "language": "th",
        "components": [
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "A-10293"
                    }
                ]
            }
        ]
    },
)
print(res.json())
```

**201 Created**

```json
{
  "id": "3c1d5e7f-9a2b-4c6d-8e0f-1a3b5c7d9e2f",
  "to": "+66812345678",
  "country": "TH",
  "category": "utility",
  "template": "order_shipped",
  "language": "th",
  "kind": "template",
  "status": "accepted",
  "priceThb": 0.6,
  "refunded": false,
  "error": null,
  "verificationId": null,
  "createdAt": "2026-11-22T08:30:00.000Z",
  "sentAt": null,
  "deliveredAt": null,
  "readAt": null
}
```

The price is debited before the message is handed to WhatsApp. If WhatsApp rejects the message, the credit is refunded and the call fails with `whatsapp_send_failed` (`metaCode`carries Meta's error code when there is one). A template that doesn't exist or isn't approved in that language returns `404 template_not_found`.

## Sender name

Every message is sent from Bytesms's shared WhatsApp Business number, so the chat title your recipients see is Bytesms's verified business name, set by Meta. Your brand appears inside the message instead: templates with the `{{sender_name}}` parameter show one of your workspace's **sender names**.

### Request and approval

1. A workspace owner or admin requests a name in **Dashboard → WhatsApp → Sender names**, with an optional note for the reviewer (e.g. the registered company name or website).
2. The Bytesms team reviews every request before the name can be used, usually within 1 business day. A request is `pending` until it is `approved` or `rejected` (with a reason shown in the dashboard). Bytesms can later `revoke` an approved name.
3. The first approved name becomes the workspace's **default**. Owners and admins can make another approved name the default, or remove names they no longer use.

- Rules: 2–30 characters; letters, digits, spaces and `. & ' -` only; no links; no platform brands such as WhatsApp, Meta or Bytesms. An invalid name is refused with `422 invalid_sender_name` (the message says which rule failed). Requesting a name that is already pending or approved returns `409 sender_name_exists`.
- Each plan allows a number of sender names; pending and approved names both count. By default: Starter 1, Pro 3, Max 10, Enterprise 20. Past the quota a request returns `403 sender_name_limit` (with `limit`); on a plan without sender names it returns `403 sender_name_not_in_plan`. Removing a name frees its slot.

### List sender names

`GET https://api.bytesms.com/api/v1/whatsapp/sender-names`

Returns every sender name of the workspace with its review status, the plan quota and the default. Only names with `status: "approved"` can be sent.

**cURL**

```bash
# List sender names
curl -X GET 'https://api.bytesms.com/api/v1/whatsapp/sender-names' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx'
```

**Node.js**

```js
// List sender names
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/sender-names", {
  method: "GET",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
  },
});
console.log(await res.json());
```

**Python**

```python
import requests

# List sender names
res = requests.get(
    "https://api.bytesms.com/api/v1/whatsapp/sender-names",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
)
print(res.json())
```

**Response**

```json
{
  "data": [
    {
      "id": "0b6f1c2e-3d4a-4b5c-8d6e-7f8a9b0c1d2e",
      "name": "Acme Shop",
      "status": "approved",
      "isDefault": true,
      "note": "Registered as Acme Shop Co., Ltd.",
      "reviewNote": null,
      "reviewedAt": "2026-11-21T03:12:00.000Z",
      "createdAt": "2026-11-20T09:45:00.000Z"
    },
    {
      "id": "6a7b8c9d-0e1f-4a2b-9c3d-4e5f6a7b8c9d",
      "name": "Acme Rewards",
      "status": "pending",
      "isDefault": false,
      "note": null,
      "reviewNote": null,
      "reviewedAt": null,
      "createdAt": "2026-11-22T02:10:00.000Z"
    }
  ],
  "limit": 3,
  "used": 2,
  "default": "Acme Shop"
}
```

| Field | Description |
| --- | --- |
| `data[].status` | `pending`, `approved`, `rejected` or `revoked`. |
| `data[].isDefault` | The approved name used when a send doesn't pass sender_name. |
| `data[].reviewNote` | Reviewer's reason for a rejected or revoked name, else null. |
| `limit` | Sender names the plan allows. |
| `used` | Pending + approved names (they count against limit). |
| `default` | The default approved name, or null when none is approved. |

### The {{sender_name}} parameter

Any approved template whose body contains the named parameter `{{sender_name}}` gets a sender name filled in automatically when you call `POST /v1/whatsapp/messages`: the one you pass as `sender_name`, otherwise the workspace's default. Send only the template's other parameters; Bytesms adds the body parameter `{ "type": "text", "parameter_name": "sender_name", "text": "<approved name>" }` for you. A `sender_name` body parameter of your own is replaced, so only approved names reach recipients.

**cURL**

```bash
# Default sender name
curl -X POST 'https://api.bytesms.com/api/v1/whatsapp/messages' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"to":"+66812345678","template":"order_shipped_branded","language":"th","components":[{"type":"body","parameters":[{"type":"text","parameter_name":"order_id","text":"A-10293"}]}]}'

# Pick an approved name
curl -X POST 'https://api.bytesms.com/api/v1/whatsapp/messages' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"to":"+66812345678","template":"order_shipped_branded","language":"th","sender_name":"Acme Rewards","components":[{"type":"body","parameters":[{"type":"text","parameter_name":"order_id","text":"A-10293"}]}]}'
```

**Node.js**

```js
// Default sender name
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/messages", {
  method: "POST",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+66812345678",
    "template": "order_shipped_branded",
    "language": "th",
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "parameter_name": "order_id",
            "text": "A-10293"
          }
        ]
      }
    ]
  }),
});
console.log(await res.json());

// Pick an approved name
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/messages", {
  method: "POST",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+66812345678",
    "template": "order_shipped_branded",
    "language": "th",
    "sender_name": "Acme Rewards",
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "parameter_name": "order_id",
            "text": "A-10293"
          }
        ]
      }
    ]
  }),
});
console.log(await res.json());
```

**Python**

```python
import requests

# Default sender name
res = requests.post(
    "https://api.bytesms.com/api/v1/whatsapp/messages",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
    json={
        "to": "+66812345678",
        "template": "order_shipped_branded",
        "language": "th",
        "components": [
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "parameter_name": "order_id",
                        "text": "A-10293"
                    }
                ]
            }
        ]
    },
)
print(res.json())

# Pick an approved name
res = requests.post(
    "https://api.bytesms.com/api/v1/whatsapp/messages",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
    json={
        "to": "+66812345678",
        "template": "order_shipped_branded",
        "language": "th",
        "sender_name": "Acme Rewards",
        "components": [
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "parameter_name": "order_id",
                        "text": "A-10293"
                    }
                ]
            }
        ]
    },
)
print(res.json())
```

Both checks happen before any credit is debited: a template that needs a sender name while the workspace has no approved one fails with `422 sender_name_required`, and a `sender_name`that isn't approved for the workspace (pending, rejected, revoked or unknown) fails with `422 sender_name_not_approved`.

> **Note**
>
> OTP codes never show a sender name. Meta fixes the wording of authentication templates, so `/v1/whatsapp/verifications` messages contain only the code and the security text WhatsApp provides.

## Retrieve a message

`GET https://api.bytesms.com/api/v1/whatsapp/messages/{message_id}`

Returns a template or OTP message of your workspace, in the same shape as the send response. Unknown ids return `404 not_found`.

**cURL**

```bash
# Retrieve a message
curl -X GET 'https://api.bytesms.com/api/v1/whatsapp/messages/3c1d5e7f-9a2b-4c6d-8e0f-1a3b5c7d9e2f' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx'
```

**Node.js**

```js
// Retrieve a message
const res = await fetch("https://api.bytesms.com/api/v1/whatsapp/messages/3c1d5e7f-9a2b-4c6d-8e0f-1a3b5c7d9e2f", {
  method: "GET",
  headers: {
    Authorization: "Bearer tp_live_xxxxxxxxx",
  },
});
console.log(await res.json());
```

**Python**

```python
import requests

# Retrieve a message
res = requests.get(
    "https://api.bytesms.com/api/v1/whatsapp/messages/3c1d5e7f-9a2b-4c6d-8e0f-1a3b5c7d9e2f",
    headers={"Authorization": "Bearer tp_live_xxxxxxxxx"},
)
print(res.json())
```

**Response**

```json
{
  "id": "3c1d5e7f-9a2b-4c6d-8e0f-1a3b5c7d9e2f",
  "to": "+66812345678",
  "country": "TH",
  "category": "utility",
  "template": "order_shipped",
  "language": "th",
  "kind": "template",
  "status": "read",
  "priceThb": 0.6,
  "refunded": false,
  "error": null,
  "verificationId": null,
  "createdAt": "2026-11-22T08:30:00.000Z",
  "sentAt": "2026-11-22T08:30:01.000Z",
  "deliveredAt": "2026-11-22T08:30:02.000Z",
  "readAt": "2026-11-22T08:31:15.000Z"
}
```

**Message fields**

- `id` (string, optional): Message id.
- `to` (string, optional): Recipient in E.164 format.
- `country` (string, optional): Recipient country (ISO 3166-1 alpha-2), used for pricing.
- `category` ("authentication" | "utility" | "marketing", optional): Template category from Meta.
- `template` (string, optional): Template name.
- `language` (string, optional): Template language code.
- `kind` ("template" | "otp", optional): `otp` for messages sent by the Verify flow.
- `status` (string, optional): See [Message statuses](https://bytesms.com/docs/whatsapp#statuses).
- `priceThb` (number, optional): Price charged for the message, in THB.
- `refunded` (boolean, optional): `true` when the price was returned to your balance because the message failed.
- `error` (object | null, optional): `{ code, message }` from WhatsApp when the message failed, otherwise `null`.
- `verificationId` (string | null, optional): The verification this OTP message belongs to.
- `createdAt` (string, optional): When the message was created (ISO 8601).
- `sentAt / deliveredAt / readAt` (string | null, optional): When WhatsApp reported each status.

## Message statuses

Statuses only move forward. WhatsApp reports them asynchronously; poll the message to follow them.

| status | Meaning |
| --- | --- |
| `queued` | Created; the credit is reserved and the message is being handed to WhatsApp. |
| `accepted` | WhatsApp accepted the message. This is the status in a successful send response. |
| `sent` | WhatsApp sent the message. |
| `delivered` | Delivered to the recipient's device. |
| `read` | The recipient opened it (only when they have read receipts on). |
| `failed` | WhatsApp couldn't send or deliver it — at send time or reported later. The credit is refunded (`refunded: true`) and `error` holds the reason. |

> **Note**
>
> A refund returns the price to where it came from. The included monthly credit part is returned only while that month is still current — included credit that has expired is not given back.

## Pricing & credits

- **Prepaid balance in THB.**Each message's price is debited when you send it. If the balance can't cover it, the call fails with `402 insufficient_credits` and nothing is sent.
- **Included monthly credit.** Eligible plans include a credit amount every calendar month (UTC). It resets at the start of each month and unused included credit does not roll over. Included credit is spent before top-up credit.
- **One wallet for email and WhatsApp.** WhatsApp is paid from the same prepaid credit as over-quota email. Top-ups (card or PromptPay), auto-recharge and credit expiry are described in [Credits & billing](https://bytesms.com/docs/credits); you can top up from Settings → Billing or Dashboard → WhatsApp.
- **Price per message** depends on your plan, the template category (`authentication`, `utility`, `marketing`) and the destination country. Thailand has its own price list; other countries are priced from Meta's rate for that country times a plan multiplier. Your current prices, included credit and balance are shown in Dashboard → WhatsApp.
- Every message response includes `priceThb`, the amount charged.

**402 Payment Required**

```json
{
  "statusCode": 402,
  "name": "insufficient_credits",
  "message": "Not enough prepaid credit. Top up (or turn on auto-recharge) in the dashboard under Settings → Billing.",
  "neededThb": 0.6,
  "availableThb": 0.25
}
```

## Errors

Errors use the standard [error envelope](https://bytesms.com/docs/errors) `{ statusCode, name, message }`. Branch on `name`.

| Status | name | When |
| --- | --- | --- |
| 401 | `unauthorized` | Missing, malformed, unknown or expired API key. |
| 402 | `insufficient_credits` | Balance too low for this message. Adds `neededThb` and `availableThb`. |
| 402 | `subscription_inactive` | The workspace's subscription doesn't allow sending (e.g. unpaid). |
| 403 | `suspended_api_key` | The API key was suspended. |
| 403 | `whatsapp_not_in_plan` | WhatsApp is available on the Starter plan and above. |
| 403 | `workspace_paused` | Sending is paused for this workspace. |
| 404 | `template_not_found` | No approved template with that name in that language. |
| 404 | `not_found` | Unknown message id, or no verification for that id / number. |
| 422 | `validation_error` | Body isn't a JSON object; bad `template`, `language` or `components`; `code` isn't 4–10 digits; neither `id` nor a valid `to` on a check. |
| 422 | `invalid_recipient` | `to` isn't a valid phone number. |
| 422 | `country_not_allowed` | Sending to that country isn't enabled. |
| 422 | `sender_name_required` | The template uses `{{sender_name}}` and the workspace has no approved sender name. See [Sender name](https://bytesms.com/docs/whatsapp#sender-name). |
| 422 | `sender_name_not_approved` | The `sender_name`you passed isn't an approved sender name of the workspace. |
| 422 | `template_not_supported` | The template's category isn't authentication, utility or marketing. |
| 429 | `rate_limit_exceeded` | Workspace request rate limit, or more than 5 verification codes to one number in an hour. |
| 400 / 502 | `whatsapp_send_failed` | WhatsApp rejected the message (`400`) or failed (`502`). The credit is refunded. `metaCode` is Meta's error code or `null`. |
| 502 | `whatsapp_unavailable` | The template lookup at WhatsApp failed. Retry later. |
| 503 | `whatsapp_unavailable` | WhatsApp sending is temporarily unavailable on the platform. |
| 503 | `otp_template_not_ready` | Verifications only: Bytesms's OTP template is still waiting for Meta's approval. Nothing is charged; retry later. |
