Build on the WhatsApp API
Send approved WhatsApp templates, manage them, and track delivery — all through your own number, from your own software. Backed by BAMNEXA's official WhatsApp Cloud API, with plans starting at Rs. 4,999/month — built for businesses in Pakistan.
Getting Started
Get API access
Enabled by your administrator from the Developer page.
Generate a key
Dashboard → Developer API → New Key. Shown once — save it.
Call the API
Send the key as a bearer token on every request below.
Base URL
https://your-domain.com
Authentication
Every request must include your API key as a Bearer token. Keys are tied to your WhatsApp connection — requests act on whichever number you have connected.
Authorization: Bearer wsa_your_api_key_here
Keys are shown only once, at creation. If you lose one, revoke it from the dashboard and generate a new one — there's no way to retrieve the original value.
/api/v1/templatesList Templates
Returns every WhatsApp template on your connected number — approved, pending, and rejected — merged with any templates created locally.
Request
curl https://your-domain.com/api/v1/templates \ -H "Authorization: Bearer wsa_your_api_key_here"
Response
{
"templates": [
{
"name": "order_update",
"status": "APPROVED",
"category": "UTILITY",
"language": "en_US",
"components": [ ... ]
}
]
}Possible Errors
| Status | Message |
|---|---|
| 400 | No active WhatsApp connection configured |
/api/v1/templatesCreate Template
Submits a new template to Meta for approval. Approval is not instant — poll List Templates or check the dashboard to see when status flips to APPROVED.
Request Body
| Field | Type | Description |
|---|---|---|
| name | string | Required. Lowercase letters, numbers and underscores only. |
| category | string | Required. MARKETING, UTILITY, or AUTHENTICATION. |
| language | string | Optional. Defaults to en_US. |
| content | string | Required. Body text. Use {{1}}, {{2}}… for variables. |
| buttons | array | Optional. Quick-reply or URL buttons. |
| headerImageUrl | string | Optional. Public image URL for a media header. |
Request
curl -X POST https://your-domain.com/api/v1/templates \
-H "Authorization: Bearer wsa_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "order_ready",
"category": "UTILITY",
"language": "en_US",
"content": "Hello {{1}}, your order {{2}} is ready for pickup!"
}'Response
{
"success": true,
"status": "PENDING"
}Possible Errors
| Status | Message |
|---|---|
| 400 | name and content are required |
| 400 | Template name must be lowercase alphanumeric and underscores only |
| 400 | No active WhatsApp connection configured |
/api/v1/messages/sendSend Template
Queues an approved template for delivery to one or many recipients. Sending is asynchronous — this returns immediately with a send_id you use to check delivery via Delivery Logs.
Request Body
| Field | Type | Description |
|---|---|---|
| template_name | string | Required. Must be APPROVED on Meta. |
| language | string | Optional. Defaults to en_US. |
| recipients | array | Required, non-empty. Each item is a phone string, or { phone, params: [] }. |
params fill the template's variables in order: header text variable first (if the template has one), then body variables, then dynamic URL button variables — matching how the template was defined when created.
Request
curl -X POST https://your-domain.com/api/v1/messages/send \
-H "Authorization: Bearer wsa_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"template_name": "order_ready",
"language": "en_US",
"recipients": [
{ "phone": "923001234567", "params": ["Ahmed", "ORD-001"] },
{ "phone": "923009876543", "params": ["Sara", "ORD-002"] }
]
}'Response
// 202 Accepted
{
"success": true,
"send_id": "c1b2a3d4-...",
"total_recipients": 2
}Possible Errors
| Status | Message |
|---|---|
| 400 | template_name is required |
| 400 | recipients must be a non-empty array |
| 400 | Template "<name>" must be APPROVED on Meta before sending |
| 400 | No active WhatsApp connection configured |
/api/v1/messages/logsDelivery Logs
Lists every send made through the API, or — pass send_id — the per-recipient delivery status for one send.
Query Parameters
| Param | Type | Description |
|---|---|---|
| send_id | string | Optional. Returns one send's full detail instead of the list. |
| page | number | Optional. Defaults to 1. |
| limit | number | Optional. Defaults to 50, max 100. |
Request
# All sends curl "https://your-domain.com/api/v1/messages/logs" \ -H "Authorization: Bearer wsa_your_api_key_here" # One send's per-recipient status curl "https://your-domain.com/api/v1/messages/logs?send_id=c1b2a3d4-..." \ -H "Authorization: Bearer wsa_your_api_key_here"
Response
// Without send_id
{
"sends": [
{
"send_id": "c1b2a3d4-...",
"template_name": "order_ready",
"status": "sending",
"total_recipients": 2,
"sent_count": 1,
"failed_count": 0,
"created_at": "2026-10-07T10:12:00.000Z"
}
],
"total": 1,
"page": 1,
"limit": 50
}
// With send_id
{
"send_id": "c1b2a3d4-...",
"template_name": "order_ready",
"status": "sending",
"total_recipients": 2,
"sent_count": 1,
"failed_count": 0,
"created_at": "2026-10-07T10:12:00.000Z",
"messages": [
{
"id": "...",
"recipient_phone": "923001234567",
"status": "delivered",
"message_id": "wamid....",
"delivery_timestamp": "2026-10-07T10:12:04.000Z",
"created_at": "2026-10-07T10:12:01.000Z",
"content": "..."
}
],
"page": 1,
"limit": 50
}Possible Errors
| Status | Message |
|---|---|
| 404 | send_id not found |
Errors & Status Codes
Every error response is { "error": "message" } with a matching HTTP status code.
| Status | Message | Meaning |
|---|---|---|
| 401 | Missing or invalid Authorization header | No Bearer token was sent, or it's empty. |
| 401 | Invalid or revoked API key | The key doesn't match any active key on file. |
| 403 | API access is disabled for this account | Your account's API access toggle is off — ask your administrator. |
| 400 | Request-specific validation error | See each endpoint's error list below — usually a missing or malformed field. |
| 404 | Resource not found | e.g. an unknown send_id on Delivery Logs. |
| 500 | Unexpected server error | Safe to retry; contact support if it persists. |
Frequently Asked Questions
Is this the official WhatsApp Business API, or an unofficial workaround?
It's the official WhatsApp Cloud API from Meta. Every request documented here sends messages through an approved WhatsApp Business number — not an unofficial or scraped integration.
How much does BAMNEXA's WhatsApp API cost in Pakistan?
API access is included with a BAMNEXA plan, starting at Rs. 4,999 per month — one of the most affordable official WhatsApp API options available to businesses in Pakistan. Meta's own per-conversation charges are billed separately, same as with any WhatsApp Cloud API provider.
Can I connect this WhatsApp API to my own CRM or software?
Yes. It's a plain REST API authenticated with a bearer token, so it works from any backend, CRM, or internal tool that can make an HTTPS request — PHP, Node.js, Python, Laravel, or low-code tools like Zapier and n8n.
Do I need a developer to integrate the WhatsApp API?
Basic integration only needs someone comfortable making an HTTP request with a bearer token — the four endpoints above cover the full send-and-track flow. The WhatsApp Business API approval process itself is handled by BAMNEXA, not something you have to navigate yourself.
What can I send with this API — only templates, or any message?
Only pre-approved WhatsApp templates, which is how the official WhatsApp Business API works for business-initiated messages. You create and submit templates through the API or dashboard, and send them once Meta approves them.