API Documentation
V2Complete reference for the WAB2C WhatsApp Business API v2. Build integrations, automate messaging, manage contacts, and extend your WhatsApp operations programmatically.
V2 API Release
/api/ prefix. Previous v1 endpoints have been deprecated and are no longer supported.Base URL & Endpoint Structure
All WAB2C API requests are made against the following base URL. Your tenant subdomain is part of the URL path to isolate your workspace data.
Base URL: https://app.wab2c.com/api/
Tenant Path: https://app.wab2c.com/api/{tenant}/
Example: https://app.wab2c.com/api/mycompany/contacts| Parameter | Type | Required | Description |
|---|---|---|---|
| Base URL | string | Required | Root URL for all API calls: https://app.wab2c.com/api/ |
| {tenant} | string | Required | Your unique tenant subdomain (e.g., mycompany, lahore-mart) |
| Resource Path | string | Required | The specific resource you are accessing (e.g., /contacts, /messages/send) |
Authentication
All API requests must include a Bearer token in the Authorization header. Generate your API token from the API Management section in your WAB2C tenant settings.
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/jsonHow to Generate Your API Token
- 1Log in to your WAB2C tenant panel at app.wab2c.com/tenant
- 2Navigate to Tenant Settings → API Management
- 3Toggle "Enable API Access" to ON
- 4Click "Generate New Token" to create your authentication token
- 5Copy the token immediately — it will not be shown again
- 6Save your changes to activate
Token Security
Token Abilities (Permissions)
API tokens have granular permissions. Configure abilities when generating your token to follow the principle of least privilege.
| Category | Permissions | Description |
|---|---|---|
| Contacts | CreateReadUpdateDelete | Full CRUD access to contact records |
| Statuses | CreateReadUpdateDelete | Manage contact and campaign statuses |
| Sources | CreateReadUpdateDelete | Manage lead and contact sources |
| Groups | CreateReadUpdateDelete | Manage contact groups for segmentation |
| Templates | Read | Access approved WhatsApp message templates |
| Message Bots | Read | View message bot configurations |
| Template Bots | Read | View template bot configurations |
| Message Sending | TextMediaTemplate | Permission to send WhatsApp messages by type |
Send Text Message
/api/{tenant}/messages/sendSend a plain text WhatsApp message to a phone number.
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone_number | string | Required | Recipient phone with country code (e.g., +923001234567) |
| type | string | Required | Message type: "text" |
| message | string | Required | The text content of the message |
Code Examples
curl -X POST "https://app.wab2c.com/api/{tenant}/messages/send" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"phone_number": "+923001234567",
"type": "text",
"message": "Assalam o Alaikum! Your order #1042 has been confirmed. Thank you for shopping with us."
}'Success Response (200)
{
"success": true,
"message": "Message sent successfully",
"data": {
"message_id": "wamid.HBgLOTIzMDAxMjM0NTY3...",
"phone_number": "+923001234567",
"status": "sent"
}
}Send Media Message
/api/{tenant}/messages/mediaSend an image, document, video, or audio file via WhatsApp.
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone_number | string | Required | Recipient phone with country code |
| type | string | Required | "image", "document", "video", or "audio" |
| media_url | string | Required | Public URL of the media file |
| caption | string | Optional | Optional caption for the media |
| filename | string | Optional | Filename for document type |
Supported Media Types
Send Template Message
/api/{tenant}/messages/templateSend a pre-approved WhatsApp template message with dynamic variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone_number | string | Required | Recipient phone with country code (e.g., +923001234567) |
| template_name | string | Required | Name of the approved WhatsApp template |
| template_language | string | Required | Language code (e.g., "en", "ur") |
| field_1 | string | Optional | Value for template variable {{1}} |
| field_2 | string | Optional | Value for template variable {{2}} |
| field_3 | string | Optional | Value for template variable {{3}} |
| header_media_url | string | Optional | Media URL for header (image/document/video templates) |
Code Examples
curl -X POST "https://app.wab2c.com/api/{tenant}/messages/template" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"phone_number": "+923001234567",
"template_name": "order_confirmation",
"template_language": "en",
"field_1": "Ahmed",
"field_2": "PKR 4,500",
"field_3": "12 Feb 2026"
}'Template Variables
field_1, field_2, etc.) correspond to the {{1}}, {{2}} placeholders in your approved WhatsApp template. Ensure the order matches your template structure.Send Auth Template (OTP)
Send WhatsApp authentication templates for OTP verification. Supports auto-generated OTPs, manual OTPs, and automatic contact creation during signup flows.
/api/{tenant}/messages/templateSend an authentication template with OTP verification.
Method 1: Auto-Generate OTP
WAB2C generates a random OTP, inserts it into your template, sends it, and returns the OTP in the response.
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone_number | string | Required | Recipient phone with country code |
| template_name | string | Required | Approved auth template name (e.g., verify_otp) |
| template_language | string | Required | Language code (en, ur, etc.) |
| auto_generate_otp | boolean | Required | Set to true for auto OTP generation |
Method 2: Manual OTP
Send an OTP generated by your own system. Pass the OTP as field_1.
{
"phone_number": "+923451234567",
"template_name": "verify_otp",
"template_language": "en",
"field_1": "847293"
}Method 3: OTP + Auto Contact Creation
Send an auth template and automatically create a contact in WAB2C if the phone number does not already exist. Ideal for signup verification flows.
curl -X POST "https://app.wab2c.com/api/{tenant}/messages/template" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"phone_number": "+923331234567",
"template_name": "verify_otp",
"template_language": "en",
"auto_generate_otp": true,
"contact": {
"firstname": "Fatima",
"lastname": "Khan",
"email": "fatima.khan@example.com"
}
}'| Parameter | Type | Required | Description |
|---|---|---|---|
| contact | object | Required | Contact information to create |
| contact.firstname | string | Required | First name |
| contact.lastname | string | Optional | Last name |
| contact.email | string | Optional | Email address |
Success Response (200)
{
"success": true,
"message": "Template sent successfully",
"data": {
"message_id": "wamid.HBgLOTIzMzMxMjM0NTY3...",
"phone_number": "+923331234567",
"otp": "847293",
"status": "sent"
}
}Message Status
/api/{tenant}/messages/{message_id}Retrieve the delivery status of a sent message.
{
"success": true,
"data": {
"message_id": "wamid.HBgLOTIzMDAxMjM0NTY3...",
"status": "delivered",
"timestamp": "2026-02-17T10:30:00Z"
}
}Contacts API
Create Contact
/api/{tenant}/contactsCreate a new contact in your WAB2C CRM.
| Parameter | Type | Required | Description |
|---|---|---|---|
| firstname | string | Required | Contact first name |
| lastname | string | Optional | Contact last name |
| phone | string | Required | Phone with country code (e.g., +923211234567) |
| string | Optional | Email address | |
| company | string | Optional | Company or organization name |
| city | string | Optional | City (e.g., Lahore, Karachi, Islamabad) |
| status_id | integer | Optional | Status ID to assign |
| source_id | integer | Optional | Source ID to assign |
| group_ids | array | Optional | Array of group IDs to assign |
Code Examples
curl -X POST "https://app.wab2c.com/api/{tenant}/contacts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"firstname": "Ali",
"lastname": "Raza",
"phone": "+923211234567",
"email": "ali.raza@example.com",
"company": "Lahore Traders",
"city": "Lahore"
}'List Contacts
/api/{tenant}/contactsRetrieve a paginated list of all contacts.
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | Optional | Page number (default: 1) |
| per_page | integer | Optional | Results per page (default: 25, max: 100) |
| search | string | Optional | Search by name, phone, or email |
Update Contact
/api/{tenant}/contacts/{id}Update an existing contact record.
PUT /api/{tenant}/contacts/142
{
"firstname": "Ali",
"lastname": "Ahmed",
"company": "Karachi Electronics",
"city": "Karachi"
}Delete Contact
/api/{tenant}/contacts/{id}Permanently delete a contact record.
Irreversible Action
Statuses API
Manage contact and lead statuses programmatically. Statuses help categorize contacts by pipeline stage (e.g., New, Qualified, Converted, Closed).
/api/{tenant}/statusesCreate a new status.
/api/{tenant}/statusesList all statuses.
/api/{tenant}/statuses/{id}Update a status.
/api/{tenant}/statuses/{id}Delete a status.
POST /api/{tenant}/statuses
{
"name": "Interested",
"color": "#22c55e",
"description": "Lead has shown interest in our services"
}Sources API
Manage lead and contact sources to track where your contacts originated (e.g., Website, Facebook Ad, Referral, Walk-in).
/api/{tenant}/sourcesCreate a new source.
/api/{tenant}/sourcesList all sources.
/api/{tenant}/sources/{id}Update a source.
/api/{tenant}/sources/{id}Delete a source.
POST /api/{tenant}/sources
{
"name": "Facebook Ads - Lahore Campaign",
"description": "Leads from Feb 2026 Facebook campaign targeting Lahore"
}Groups API
Organize contacts into groups for targeted campaign segmentation and bulk operations.
/api/{tenant}/groupsCreate a new contact group.
/api/{tenant}/groupsList all groups.
/api/{tenant}/groups/{id}Update a group.
/api/{tenant}/groups/{id}Delete a group.
POST /api/{tenant}/groups
{
"name": "VIP Customers - Islamabad",
"description": "High-value customers from Islamabad region"
}Templates API
/api/{tenant}/templatesRetrieve all approved WhatsApp message templates linked to your WABA.
{
"success": true,
"data": [
{
"id": 1,
"name": "order_confirmation",
"language": "en",
"status": "APPROVED",
"category": "UTILITY",
"components": [
{
"type": "BODY",
"text": "Assalam o Alaikum {{1}}, your order worth {{2}} has been confirmed and will be delivered by {{3}}."
}
]
}
]
}Read-Only Access
Bots API
/api/{tenant}/message-botsList all configured message bots and their trigger keywords.
/api/{tenant}/template-botsList all configured template bots and their templates.
Bot Configuration
Webhooks
Receive real-time notifications when events occur in your WAB2C tenant. Configure a webhook URL in Tenant Settings to receive instant updates for contacts, statuses, and sources.
Setup Steps
- 1Go to Tenant Settings → Webhook Integrations at app.wab2c.com/tenant
- 2Toggle "Enable Webhook Access" to ON
- 3Enter your Webhook URL (e.g., https://your-app.com/api/wab2c-webhook)
- 4Click Save Changes to activate
- 5Test using webhook.site or your own endpoint
Webhook Events
| Category | Event | Triggered When |
|---|---|---|
| Contacts | contact.created | A new contact is added |
| Contacts | contact.read | A contact record is accessed |
| Contacts | contact.updated | A contact is modified |
| Contacts | contact.deleted | A contact is removed |
| Statuses | status.created | A new status is created |
| Statuses | status.updated | A status is modified |
| Statuses | status.deleted | A status is removed |
| Sources | source.created | A new source is added |
| Sources | source.updated | A source is modified |
| Sources | source.deleted | A source is removed |
Webhook Handler Examples
# Webhook events are sent TO your endpoint.
# Test with:
curl -X POST "https://your-app.com/api/wab2c-webhook" \
-H "Content-Type: application/json" \
-d '{
"event": "contact.created",
"data": {
"id": 142,
"firstname": "Zain",
"phone": "+923451234567"
}
}'WooCommerce Integration
Connect your WooCommerce store to WAB2C to send automatic WhatsApp order notifications, shipping updates, and abandoned cart reminders.
Setup Steps
1Access Webhook Settings
Navigate to WooCommerce → Settings → Advanced → Webhooks
2Create New Webhook
Click "Add webhook" and configure the webhook data box
3Configure Settings
Set Name (e.g., "WAB2C Order Notifications"), Status to Active, and Topic to "Order Created"
4Set Delivery URL
Enter your WAB2C webhook endpoint URL from the Webhook Dashboard
5Save Webhook
Click Save. WooCommerce sends a test ping on first activation.
Available Webhook Topics
eCommerce Webhook Dashboard
The Webhook Dashboard in your WAB2C tenant provides a centralized interface to create, monitor, and manage all eCommerce webhook integrations.
Create & Manage
Multiple webhooks with unique endpoints
Monitor Activity
Real-time performance metrics
Configure Endpoints
Custom authentication & settings
Track Success Rates
Request statistics & analytics
Test & Debug
Built-in testing tools
Secure Auth
Secret key verification
Webhook URL Format:
https://app.wab2c.com/api/webhooks/{webhook_id}
Use this URL as the Delivery URL in WooCommerce, Shopify, or any eCommerce platform.Rate Limits
API rate limits are enforced per token. Exceeding limits returns a 429 Too Many Requests response.
| Plan | Requests / min | Messages / day |
|---|---|---|
| Starter | 60 | 1,000 |
| Growth | 120 | 5,000 |
| Pro | 300 | 15,000 |
| Enterprise | 600 | Unlimited |
Error Codes
| Status | Description | Solution |
|---|---|---|
| 200 | Success | Request completed successfully |
| 400 | Bad Request | Check request body and parameters |
| 401 | Unauthorized | Verify API token is valid and included |
| 403 | Forbidden | Token lacks required permissions (check Token Abilities) |
| 404 | Not Found | Check endpoint URL and tenant subdomain |
| 422 | Validation Error | Review required fields and data types |
| 429 | Rate Limited | Reduce request frequency; retry after delay |
| 500 | Server Error | Retry request; contact WAB2C support if persistent |
Error Response Format
{
"success": false,
"message": "Error description",
"errors": {
"phone_number": ["The phone number field is required."],
"template_name": ["The selected template was not found."]
}
}Best Practices
Token Security
Store API tokens in server-side environment variables. Never expose tokens in client-side code or public repos.
Phone Number Format
Always include the country code with + prefix (e.g., +923001234567 for Pakistan). Never include spaces or dashes.
Template Approval
Ensure WhatsApp templates are approved before sending. Sending unapproved templates will fail silently.
Retry Logic
Implement exponential backoff for 429 and 5xx errors. Wait at least 1 second before retrying.
Validate Inputs
Validate phone numbers and required fields on your side before making API calls to reduce errors.
Use HTTPS
All API endpoints use HTTPS. Never send API requests over plain HTTP.
Need Integration Help?
Our engineering team is available to assist with your V2 API integration.