API Documentation

v1

REST API · v1

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

1

Get API access

Enabled by your administrator from the Developer page.

2

Generate a key

Dashboard → Developer API → New Key. Shown once — save it.

3

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.

GET/api/v1/templates

List 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

StatusMessage
400No active WhatsApp connection configured
POST/api/v1/templates

Create 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

FieldTypeDescription
namestringRequired. Lowercase letters, numbers and underscores only.
categorystringRequired. MARKETING, UTILITY, or AUTHENTICATION.
languagestringOptional. Defaults to en_US.
contentstringRequired. Body text. Use {{1}}, {{2}}… for variables.
buttonsarrayOptional. Quick-reply or URL buttons.
headerImageUrlstringOptional. 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

StatusMessage
400name and content are required
400Template name must be lowercase alphanumeric and underscores only
400No active WhatsApp connection configured
POST/api/v1/messages/send

Send 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

FieldTypeDescription
template_namestringRequired. Must be APPROVED on Meta.
languagestringOptional. Defaults to en_US.
recipientsarrayRequired, 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

StatusMessage
400template_name is required
400recipients must be a non-empty array
400Template "<name>" must be APPROVED on Meta before sending
400No active WhatsApp connection configured
GET/api/v1/messages/logs

Delivery Logs

Lists every send made through the API, or — pass send_id — the per-recipient delivery status for one send.

Query Parameters

ParamTypeDescription
send_idstringOptional. Returns one send's full detail instead of the list.
pagenumberOptional. Defaults to 1.
limitnumberOptional. 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

StatusMessage
404send_id not found

Errors & Status Codes

Every error response is { "error": "message" } with a matching HTTP status code.

StatusMessageMeaning
401Missing or invalid Authorization headerNo Bearer token was sent, or it's empty.
401Invalid or revoked API keyThe key doesn't match any active key on file.
403API access is disabled for this accountYour account's API access toggle is off — ask your administrator.
400Request-specific validation errorSee each endpoint's error list below — usually a missing or malformed field.
404Resource not founde.g. an unknown send_id on Delivery Logs.
500Unexpected server errorSafe 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.