API reference
Send WhatsApp messages, save contacts, start sequences and list templates over HTTPS.
Basics
Base URL
https://api.wabee.chat/v1
All paths below are relative to this URL. For example, "send a message" is POST https://api.wabee.chat/v1/messages.
Authentication. Every request needs an API key, sent as Authorization: Bearer YOUR_API_KEY (or X-API-Key: YOUR_API_KEY). See Authentication.
Requests. Send request bodies as JSON with Content-Type: application/json. Unknown fields are ignored.
Responses. Successful calls return 200 with a JSON object. Errors return a 4xx or 5xx status with a JSON body like {"error": "Human-readable message."}. See Errors. Responses are never cached (Cache-Control: no-store).
Server-side only. The API doesn't send CORS headers, so it can't be called from a web page. Call it from your backend.
Endpoints
| Method | Path | What it does |
|---|---|---|
POST |
/messages |
Send a template message, or a text reply inside the 24-hour window |
POST |
/contacts |
Create a contact, or update one that exists |
POST |
/sequences/{sequenceId}/enroll |
Add a contact to a drip sequence |
GET |
/templates |
List approved templates and the values each one needs |
Any other path or method returns 404 with Unknown endpoint. See Settings → Integrations for the API reference.
Phone numbers
Wherever the API takes a phone number (to, phone), you can send it in any common format: +919876543210, 91 98765 43210, 0091 98765 43210 or (+91) 98765-43210.
- Include the country code. A number without one is read as an Indian number, so
9876543210becomes+919876543210, and a non-Indian number without a country code is either rejected or saved as the wrong number. - A leading
00is treated as+. - The number must be a valid number for its country. Invalid numbers return
422withA valid phone number with country code is required (e.g. +919876543210).
Contact IDs returned by the API are the number in WhatsApp's format: country code and digits, no + (for example 919876543210).
Send a message
POST /messages
Sends one WhatsApp message to one person. There are two kinds:
- Template message. Any time, to anyone who hasn't opted out. Uses a template that Meta has approved.
- Text message. Free-form text, allowed only within 24 hours of the person's last message to you (WhatsApp's customer service window).
If the body has a non-empty text, a text message is sent and template is ignored. Otherwise template is required.
Every message sent through the API appears in the team inbox, marked as sent by the API.
Send a template
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
to |
string | Yes | Recipient's phone number with country code. See Phone numbers. |
template |
object | Yes | The template to send. Fields below. |
template.name |
string | Yes | Template name exactly as approved, for example order_shipped. |
template.language |
string | No | Language code exactly as on the template, for example en or en_US. If you leave it out and the name exists in several languages, any one of them may be used, so always send it when you have more than one. |
template.variables |
array or object | If the body has variables | Values for the body variables. See Template variables. |
template.header |
string | If the header has a variable | Value for a text header's variable. |
template.headerMediaUrl |
string | If the header is an image, video or document | Public https:// URL of the file. Meta downloads it when sending. |
template.buttons |
object | If a button needs a value | Values for dynamic buttons, keyed by button index ("0", "1", ...). See Button values. |
name |
string | No | Contact's name. Saved on the contact (it doesn't fill template variables). |
from |
string | No | Which of your WhatsApp numbers to send from: its phone number ID or the number itself (+919800000000). Defaults to your main number. |
What happens
- The template is looked up among your approved templates by
name(andlanguage, if given). - The contact is created if it doesn't exist (source "api"), or its name is updated if you sent
name. - The send is checked: the contact must not have opted out, marketing templates must pass your frequency cap, and every variable must have a value.
- The message is sent through Meta and its WhatsApp message ID is returned.
The contact is saved in step 2 even if the send fails in step 3 or 4.
Example request
curl -X POST https://api.wabee.chat/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+919876543210",
"name": "Asha Rao",
"template": {
"name": "order_shipped",
"language": "en",
"variables": ["Asha", "#A-4521"]
}
}'
Example response
{
"id": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSQzVGRkY1QjhBNjM2RTdBMjE5AA=="
}
id is the WhatsApp message ID. Delivery updates for it (sent, delivered, read, failed) arrive as message.status outgoing webhooks with the same id.
A 200 means Meta accepted the message, not that it was delivered. Meta can still fail it later (for example, if the number isn't on WhatsApp); you'll see that as a failed status.
Template variables
WhatsApp templates have placeholders in the body, either numbered ({{1}}, {{2}}) or named ({{first_name}}). Call GET /templates to see each template's variables.
You can pass values in two ways:
Array, in the order of the template's
variableslist:"variables": ["Asha", "#A-4521"]For numbered templates the order is
{{1}},{{2}}, ... For named templates it's the order in which the names first appear in the body.Object, keyed by variable name. Works for both kinds:
"variables": { "1": "Asha", "2": "#A-4521" }"variables": { "first_name": "Asha", "order_id": "#A-4521" }
Rules that apply to every value (body, header and buttons):
- Numbers and booleans are converted to text.
- Line breaks, tabs and runs of spaces are collapsed to a single space, because Meta rejects them in variables. Leading and trailing spaces are removed.
- Values longer than 1,000 characters are cut to 1,000.
- Every variable needs a non-empty value. A missing,
nullor blank value returns422naming the first missing one, for exampleNo value for {{2}}.Extra values are ignored.
Header
- Text header with a variable: pass its value as
template.header, for example"header": "Order update". If it's missing you get422 No value for header variable. - Image, video or document header: pass a public URL as
template.headerMediaUrl. If it's missing you get422 This template needs header media (headerMediaUrl).The URL must be reachable by Meta without login; if Meta can't fetch it, the message fails. - Text header without a variable, or no header: send nothing.
Button values
Two kinds of buttons need a value at send time. GET /templates lists them in buttons, with their position (index, counting from 0 across all the template's buttons) and type:
type |
What the value is |
|---|---|
url |
The part of the link that replaces {{1}} at the end of the button's URL. For a button URL https://shop.example/track/{{1}}, send "A-4521". |
copy_code |
The coupon code the customer can copy, for example "DIWALI20". |
Pass them in template.buttons keyed by index as a string:
"buttons": { "0": "A-4521" }
A missing value returns 422 with No value for button link value. or No value for coupon code.
Frequency cap
Marketing templates (category MARKETING) are subject to the workspace's marketing frequency cap, set in Settings → Sending & prices. By default a contact can receive at most 2 marketing messages every 7 days across campaigns, sequences and the API. A send over the cap returns 429 with Frequency cap: this contact already got the maximum marketing messages for now. Utility and authentication templates are never capped.
Send a text message
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
to |
string | Yes | Recipient's phone number with country code. |
text |
string | Yes | Message text. Longer than 4,096 characters is cut to 4,096. If it contains an http:// or https:// link, WhatsApp shows a link preview. |
from |
string | No | Phone number ID or number to send from. Defaults to the number the person last wrote to. |
Rules:
- The person must have messaged you in the last 24 hours. Otherwise you get
409 The 24-hour reply window is closed. Send a template instead. - The person must not have opted out (
409 This contact opted out of messages.). - A text send doesn't create or update the contact.
Example request
curl -X POST https://api.wabee.chat/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+919876543210", "text": "Your order has shipped. Track it at https://shop.example/track/A-4521"}'
Example response
{
"id": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSNkI0QjM3NkM2RjQwQkY3QzE4AA=="
}
Errors for this endpoint
| Status | error |
Why |
|---|---|---|
422 |
A valid phone number with country code is required (e.g. +919876543210). |
to is missing or not a valid number. |
422 |
Send "text", or "template": {"name": "...", "variables": [...]}. |
Neither a non-empty text nor a template.name was sent. |
404 |
No approved template named "order_shipped" in en. |
No approved template with that name (and language). |
422 |
No value for {{1}}. (or header, button link value, coupon code) |
A variable has no value. |
422 |
This template needs header media (headerMediaUrl). |
Media header without headerMediaUrl. |
422 |
"from" doesn't match any connected number. |
from isn't one of your connected numbers. |
422 |
That template belongs to a different WhatsApp account than the sending number. |
The template and the sending number are in different WhatsApp Business Accounts. |
409 |
The 24-hour reply window is closed. Send a template instead. |
Text message outside the 24-hour window. |
409 |
This contact opted out of messages. |
The contact replied STOP (or was marked opted out). |
409 |
This number asked not to be contacted. |
The number's owner asked to be erased and suppressed. |
429 |
Frequency cap: this contact already got the maximum marketing messages for now. |
Marketing frequency cap reached. |
503 |
WhatsApp is not connected in Settings. |
The workspace has no connected WhatsApp number. |
502 |
Meta: ... |
Meta rejected the message. The body also has Meta's numeric code. |
Create or update a contact
POST /contacts
Creates a contact, or updates it if a contact with that phone number already exists. Use it to sync customers from your CRM, shop or sign-up form.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone |
string | Yes | Phone number with country code. It identifies the contact. |
name |
string | No | Full name. Up to 120 characters (longer is cut). An empty name doesn't overwrite an existing one. |
email |
string | No | Email address. Up to 200 characters. Not validated. |
tags |
array of strings | No | Tags to add. Existing tags are kept. See notes below. |
attributes |
object | No | Custom fields to set, for example {"city": "Pune", "plan": "gold"}. Only the keys you send are changed. See notes below. |
optIn |
boolean or string | No | true or "opted_in" marks the contact as opted in. false or "opted_out" marks them as opted out. Anything else leaves the status unchanged. |
Notes:
- Tags are normalised: lower-cased, spaces and slashes replaced with
-, cut to 40 characters. At most 30 tags are taken from one request. New tags also appear in the app's tag pickers. - Attribute keys must be 1 to 40 characters of lower-case letters, digits and underscores (
city,last_order_id). Other keys are silently dropped. Values are converted to text and cut to 500 characters. Attribute values can be used as template variables in campaigns and sequences. - Opt-out wins.
optIn: truedoes not re-subscribe a contact who has opted out. Only the contact can do that, by sending START (or your configured opt-in word).optIn: falsealways opts the contact out. - A new contact without
optIngets the status "unknown".
Example request
curl -X POST https://api.wabee.chat/v1/contacts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+919876543210",
"name": "Asha Rao",
"email": "asha@example.com",
"tags": ["vip", "Diwali 2026"],
"attributes": {"city": "Pune", "last_order_id": "A-4521"},
"optIn": true
}'
Example response
{
"id": "919876543210",
"created": true
}
| Field | Type | Description |
|---|---|---|
id |
string | Contact ID: the phone number in WhatsApp format, without +. |
created |
boolean | true if a new contact was created, false if an existing one was updated. |
Errors
| Status | error |
Why |
|---|---|---|
422 |
A valid phone number with country code is required (e.g. +919876543210). |
phone is missing or invalid. |
409 |
This number asked not to be contacted. |
The number is on the workspace's suppression list (its owner asked to be erased). |
Add a contact to a sequence
POST /sequences/{sequenceId}/enroll
Starts a drip sequence for one contact. The contact is created first if it doesn't exist.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
sequenceId |
string | Yes | The sequence's ID. Open the sequence in the app; the ID is the last part of the address, https://live.wabee.chat/sequences/{sequenceId}. |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone |
string | Yes | Phone number with country code. |
name |
string | No | Contact's name, saved on the contact. |
The first message goes out according to the sequence's first step: a "day 0" step is sent within about 5 minutes, a "day 2" step two days after enrolment, and so on. Later steps follow the sequence's timing. If the contact opts out, the sequence stops for them.
Example request
curl -X POST https://api.wabee.chat/v1/sequences/3hJk9QxV2mTr8LpA/enroll \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "+919876543210", "name": "Asha Rao"}'
Example response
{
"enrolled": true
}
enrolled is false, still with status 200, when nothing was started because:
- the contact is already active in this sequence,
- the contact has opted out, or
- the sequence has no steps yet.
A contact who finished or left the sequence earlier can be enrolled again.
Errors
| Status | error |
Why |
|---|---|---|
404 |
Sequence not found. |
No sequence with that ID in this workspace. |
422 |
A valid phone number with country code is required (e.g. +919876543210). |
phone is missing or invalid. |
409 |
This number asked not to be contacted. |
The number is suppressed. |
List templates
GET /templates
Returns every approved template in the workspace, with what each one needs at send time. Use it to build the template object for POST /messages.
The list comes from the templates Wabee has synced from Meta. Status changes arrive automatically, but if you created a template outside Wabee (for example in WhatsApp Manager), open Templates in the app or click Sync from Meta first.
No parameters.
Example request
curl https://api.wabee.chat/v1/templates \
-H "Authorization: Bearer YOUR_API_KEY"
Example response
{
"templates": [
{
"name": "order_shipped",
"language": "en",
"category": "UTILITY",
"header": "TEXT",
"variables": ["1", "2"],
"buttons": [{ "index": 0, "type": "url" }]
},
{
"name": "festive_offer",
"language": "en",
"category": "MARKETING",
"header": "IMAGE",
"variables": ["first_name"],
"buttons": [{ "index": 1, "type": "copy_code" }]
}
]
}
| Field | Type | Description |
|---|---|---|
name |
string | Template name. Send it as template.name. |
language |
string | Language code. Send it as template.language. The same name can appear once per language. |
category |
string | MARKETING, UTILITY or AUTHENTICATION. Marketing templates count towards the frequency cap. |
header |
string or null | Header type: TEXT, IMAGE, VIDEO, DOCUMENT (or another type Meta supports), or null for no header. For IMAGE, VIDEO and DOCUMENT, send headerMediaUrl. A TEXT header may or may not have a variable; the list doesn't say, so check the template in the app. |
variables |
array of strings | Body variable names, in the order an array of values must follow. ["1", "2"] for numbered templates, names like ["first_name"] for named ones. Empty if the body has no variables. |
buttons |
array of objects | Buttons that need a value: index (position among all buttons, from 0) and type (url or copy_code). Empty if none do. |
Errors. Only the general ones: 401, 403, 500. See Errors.