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 |
| cPanel (HTTP) | http://yourdomain.com/api/v1 |
http://yourdomain.com/api |
| cPanel (HTTPS) | https://yourdomain.com/api/v1 |
https://yourdomain.com/api |
| Custom Port | http://yourdomain.com:8080/api/v1 |
http://yourdomain.com:8080/api |
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 authenticationGET /api/v1/sessions- Lists all sessions (public endpoint)
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 at /api/* do not require 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. No authentication required.
Success Response (JSON):
cURL Examples:
Local Development:
cPanel Deployment:
Delete Session
Deletes a specific session and all its data. 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:
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:
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:
Legacy API Endpoints
These endpoints are provided for backward compatibility. They are simpler but less flexible and do not require token authentication.
Base URL Examples:
| Environment | Base URL |
|---|---|
| Local Development | http://localhost:3000/api |
| cPanel (HTTP) | http://yourdomain.com/api |
| cPanel (HTTPS) | https://yourdomain.com/api |
Send Text (JSON)
Request Body (JSON):
cURL Example:
Send Text (Form Data)
Request Body (form-data):
phone: The recipient's phone number.message: The text message content.sessionId(optional): The session to use. Defaults toputra.