Overview
This document provides detailed, developer-focused instructions for using the WhatsApp API. For interactive testing, we recommend using the API Control Center on the Admin Dashboard.
Making API Requests
Base URLs
Important: The base URL format depends on your deployment environment:
| Environment | V1 API Base URL | Legacy API Base URL |
|---|---|---|
| Local Development | http://localhost:3000/api/v1 |
http://localhost:3000/api/v1/legacy |
| cPanel (HTTP) | http://yourdomain.com/api/v1 |
http://yourdomain.com/api/v1/legacy |
| cPanel (HTTPS) | https://yourdomain.com/api/v1 |
https://yourdomain.com/api/v1/legacy |
| Custom Port | http://yourdomain.com:8080/api/v1 |
http://yourdomain.com:8080/api/v1/legacy |
Note for cPanel users: Most cPanel deployments use standard HTTP/HTTPS ports (80/443), so you don't need to specify a port in your API calls. Just use your domain name directly.
Content-Type
For most endpoints, you will be sending data in JSON format. Ensure your requests include the
Content-Type: application/json header. For file uploads, the API expects
multipart/form-data.
Authentication
All API requests to the /api/v1/* endpoints must be
authenticated using a Bearer Token, with these exceptions:
POST /api/v1/sessions- Requires Master API Key OR admin authentication
The token is unique per session and is returned when you create a session. You can also view tokens in the Admin Dashboard.
Header Format
Legacy endpoints have moved to /api/v1/legacy/* and now require Bearer token authentication.
cURL Example
V1 API Endpoints
The V1 API provides comprehensive functionality for managing WhatsApp sessions, sending messages, and handling media.
About the Examples: Most examples in this documentation use
localhost:3000 for local development. If you're using cPanel or a production
deployment:
- Replace
http://localhost:3000withhttps://yourdomain.com - No port number is needed for standard HTTP/HTTPS deployments
- Use HTTPS for production environments for better security
Session Management
Create Session
Creates a new WhatsApp session with a unique ID. Requires Master API Key OR admin dashboard authentication.
Authentication:
- Via API: Include
X-Master-Keyheader with your master API key - Via Dashboard: Automatic when logged in as admin
Request Body (JSON):
Success Response (JSON):
Note: Save the returned token - it's required for all other API calls for this session.
cURL Examples:
Local Development:
cPanel Deployment:
List Sessions
Retrieves all sessions with their current status. Requires authentication.
Success Response (JSON):
cURL Examples:
Local Development:
cPanel Deployment:
Delete Session
Deletes a specific session and all its data. Requires authentication.
cURL Example:
Get Session QR Code
Returns the current pairing QR code for a session that is waiting to be linked. Requires authentication.
cURL Example:
List Session Groups
Lists the WhatsApp groups the session is a member of. Requires authentication.
cURL Example:
Webhook Management
Set Webhook URL
Configures or updates the URL where the server will send event notifications for a specific session.
Request Body (JSON):
cURL Example:
Get Webhook URL
Retrieves the configured webhook URL for a specific session.
Success Response (JSON):
cURL Example:
Delete Webhook
Removes the webhook URL for a specific session. No events will be sent until a new webhook is set.
Request Body (JSON):
cURL Example:
Webhook Event Payloads
When a webhook URL is configured for a session, the server sends JSON events to it. Each event has this envelope:
session.update â data:
message.received â data:
Deliveries are retried up to 3 times with exponential backoff. Webhook URLs must be HTTPS and may not point at private/local addresses (SSRF-guarded).
Media Management
Upload Media
Uploads an image or document to the server's media directory. The server returns a
mediaId which can be used to send the file in a subsequent API call.
- Allowed types: JPEG, PNG, GIF, WebP, PDF, Word, Excel only
- Maximum size: 25MB
- MIME types:
image/jpeg,image/png,image/gif,image/webp,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Request Body (form-data):
file: The media file to upload (must be JPEG, PNG, GIF, WebP, PDF, Word, or Excel; max 25MB).
Success Response (JSON):
Error Response (JSON):
cURL Example:
Message Management
Send Messages
A powerful and flexible endpoint to send various types of messages. You must specify the
sessionId as a query parameter. You can send a single message (as a JSON object) or
multiple messages in a batch (as a JSON array).
Common Body Fields (JSON):
| Field | Type | Required | Description |
|---|---|---|---|
recipient_type |
string | Yes | individual or group |
to |
string | Yes | Phone number (e.g., 628123...) or group ID |
type |
string | Yes | text, image, or document |
Type-Specific Fields:
Text Message:
Image Message:
Document Message:
cURL Example (Single Text Message):
cURL Example (Bulk Mixed Messages):
Delete Message
Deletes a message that you have previously sent. You must provide the session ID, the recipient's JID, and the ID of the message to be deleted.
Request Body (JSON):
cURL Example:
Campaign Management
Create and manage bulk WhatsApp messaging campaigns with scheduling, real-time progress tracking, and recipient list integration.
Create Campaign
Creates a new campaign with recipients and message content. Supports scheduling and various message types.
Request Body (JSON):
cURL Example:
List Campaigns
Retrieves all campaigns created by the authenticated user (or all campaigns for admin users).
Success Response (JSON):
cURL Example:
Get Campaign Details
Retrieves detailed information about a specific campaign, including full recipient list and delivery status.
cURL Example:
Start Campaign
Manually starts a campaign immediately, regardless of its scheduled time.
cURL Example:
Pause Campaign
Pauses an active campaign. Can be resumed later.
cURL Example:
Resume Campaign
Resumes a paused campaign from where it left off.
cURL Example:
Delete Campaign
Permanently deletes a campaign and all its data.
cURL Example:
Export Campaign Results (CSV)
Downloads the campaign's recipient delivery results as a CSV file. Cell values are formula-injection safe.
cURL Example:
Get Campaign Status
Returns the campaign's live status, progress and recipient statistics.
cURL Example:
Retry Failed Recipients
Re-queues recipients whose delivery failed so the campaign can attempt them again.
cURL Example:
Download CSV Template
Downloads a template CSV for bulk recipient import.
Preview CSV Upload
Uploads a CSV (form-data field file) and returns parsed recipients with validation
errors, without creating a campaign.
Check Scheduled Campaigns
Returns campaigns whose scheduled time has passed and are ready to start.
Overdue Campaigns
Lists campaigns that missed their scheduled start.
Recipient Lists
Manage reusable recipient lists for campaigns. Create named lists that can be used across multiple campaigns.
Create Recipient List
Creates a new named recipient list that can be reused in multiple campaigns.
Request Body (JSON):
cURL Example:
List Recipient Lists
Retrieves all recipient lists created by the authenticated user.
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
search |
string | Search lists by name or description |
tag |
string | Filter lists by tag |
Success Response (JSON):
cURL Example:
Get Recipient List Details
Retrieves detailed information about a specific recipient list, including all recipients.
cURL Example:
Update Recipient List
Updates an existing recipient list. Can modify name, description, tags, and recipients.
Request Body (JSON):
cURL Example:
Delete Recipient List
Permanently deletes a recipient list. This action cannot be undone.
cURL Example:
Clone Recipient List
Creates a copy of an existing recipient list with a new name.
Request Body (JSON):
cURL Example:
Search Recipients
Searches all accessible lists for recipients matching a number, name, company or job title.
Recipient List Statistics
Returns aggregate statistics: total lists, total recipients, total usage and average list size.
Mark List as Used
Records usage of a list (increments usageCount, updates lastUsed).
Add Recipient
Adds a single recipient to a list.
Update Recipient
Updates the name, job title, company or custom fields of a specific recipient.
Remove Recipient
Removes a specific recipient from a list.
Chats (Live Inbox)
Message history and reply endpoints used by the Live Inbox dashboard. Mounted at
/api/v1/chats.
List Conversations
Returns recent conversations for a session with unread counts.
Chat History
Returns the message history with a specific contact (JID).
Send Reply
Sends a reply message to a contact from the inbox.
Auto Replies
Keyword-triggered auto-response rules. Mounted at /api/v1/auto-replies.
List Rules
Create Rule
Update Rule
Delete Rule
Analytics
Dashboard statistics. Mounted at /api/v1/analytics.
Summary
Total sessions, campaigns, auto-replies, recipient lists and chat messages.
Trends
Activity trends over time.
AI Chatbot
Configuration and sandbox testing for the AI auto-reply assistant.
Get AI Settings
Returns the current AI configuration (API key excluded).
Update AI Settings
Test Playground
Generates an AI response with the given settings without saving them.
User Management
Manage dashboard users. Requires Admin Session Authentication (these endpoints are primarily for the Dashboard).
List Users
Retrieves a list of all users (Admin) or the current user (Non-Admin).
Create User
Creates a new user. Admin only.
Request Body (JSON):
Update User
Updates a user's role, is_active or password.
Admin only.
Activity Logs
View system activity history. Requires Admin Session Authentication.
List Activities
Retrieves recent system activities.
Activity Summary
Aggregated totals and per-action/per-user breakdown for the dashboard.
Legacy API Endpoints
Updated: Legacy endpoints now require Bearer token
authentication and have moved to /api/v1/legacy/*. They are
simpler but less flexible than the main API.
Base URL Examples:
| Environment | Base URL |
|---|---|
| Local Development | http://localhost:3000/api/v1/legacy |
| cPanel (HTTPS) | https://yourdomain.com/api/v1/legacy |
Send Text (JSON)
Simple endpoint to send a text message. Requires authentication.
Request Body (JSON):
cURL Example:
Send Text (Form Data)
Simple endpoint to send a text message using form data. Requires authentication.
Request Body (form-data):
phone: The recipient's phone number (8-15 digits).message: The text message content (max 4096 chars).sessionId(optional): The session to use. Defaults toputra.
cURL Example:
Rate Limiting: Legacy endpoints are limited to 10 requests per minute per IP address.