REST API Documentation
Integrate WhatsApp into your software, CRM, or online store with ZapWhat. A fast, stable API built to scale.
Base URL: https://zapwhat.com/api
Available endpoints
Send messages — text, images, videos, audio, documents, stickers, contacts
Send locations — GPS coordinates with address
Edit messages — update text within the first 15 minutes
List instances — check the status of your connections
Webhooks — receive incoming messages in real time
Secure authentication with an API Token
Authentication
All requests require your API Token in the Authorization header using the Bearer format.
Your unique token is generated automatically when you create your account. You can view it in the API Docs section of your Control Panel.
Authorization: Bearer YOUR_API_TOKEN_HERE
Important: Keep your token secret. Do not share it in public repositories or client-side code.
Error Codes
The API uses standard HTTP status codes to indicate the result of each request.
Code Meaning Description
200OK Successful request.
400Bad Request Required parameters are missing or the JSON is invalid.
401Unauthorized Missing or invalid API token.
403Forbidden You do not have permission to use this instance.
404Not Found Instance, message, or resource not found.
405Method Not Allowed The HTTP method is not available for this endpoint.
409Conflict The instance is not connected or is not ready for the operation.
422Unprocessable Entity The data is invalid or the operation is no longer available (for example, the 15-minute edit window has passed).
429Too Many Requests Too many requests. Wait a few seconds and try again.
500Internal Server Error Internal server error. Contact support if the problem persists.
502Bad Gateway The messaging service did not respond correctly. Try again later.
{
"error": "Error description"
}
List Instances
Get the list of your connected WhatsApp instances and their real-time status.
GET https://zapwhat.com/api/instances
Headers
Header Value
AuthorizationBearer YOUR_API_TOKEN
Response
{
"success": true,
"instances": [
{
"instance_id": "zapwhat_u1_User_MyPhone",
"status": "connected",
"created_at": "2026-06-01 12:00:00"
}
]
}
Send Text Message
Send a simple text message to any WhatsApp number.
POST https://zapwhat.com/api/send
Parameter Type Required Description
instance_idString Yes WhatsApp session ID (you can find it in your panel).
toString Yes Recipient number with country code (e.g., 5215512345678). No + or spaces.
messageString Yes* Message content. Supports emojis and line breaks.
textString No Optional alias for message for integrations that already use text.
Yes* You must provide message or its alias text.
Integration Examples
PHP
Node.js
Python
cURL
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://zapwhat.com/api/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"to" => "5215512345678",
"message" => "Hello from the ZapWhat API!"
)),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN_HERE',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
const axios = require('axios');
const data = {
instance_id: "YOUR_INSTANCE_ID",
to: "5215512345678",
message: "Hello from the ZapWhat API!"
};
axios.post('https://zapwhat.com/api/send', data, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
import requests, json
url = "https://zapwhat.com/api/send"
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"message": "Hello from the ZapWhat API!"
})
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
curl --location 'https://zapwhat.com/api/send' \
--header 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"message": "Hello from the ZapWhat API!"
}'
Save the message_id from the response. It is the numeric identifier you need to edit, check, or delete that message. You will also receive a message_log_id that you can use as an alternative.
Edit a Message
Edit a text message sent from ZapWhat. WhatsApp only allows editing messages during the first 15 minutes after sending; after that period the operation is rejected.
Important: use the message_id returned by POST /api/send. Do not use the internal WhatsApp ID (key.id) or the message ID on the recipient's phone.
PUT https://zapwhat.com/api/messages
Parameter Type Required Description
instance_idString Yes WhatsApp session ID (also accepts the numeric ID from the panel).
message_idString Yes* ID returned as message_id when the message was sent.
message_log_idInteger No Alternative to message_id. Identifier returned by ZapWhat when sending.
textString Yes New message content. Supports emojis and line breaks.
Yes* You must provide message_id or message_log_id.
Response
{
"success": true,
"message_id": "123456789",
"message_log_id": 42,
"message": {
"id": "123456789",
"text": "Hi, the event starts at 7 pm.",
"status": "edited",
"edited_at": "2026-10-20T18:30:00+00:00"
}
}
Integration Examples
PHP
Node.js
Python
cURL
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://zapwhat.com/api/messages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"message_id" => "123456789",
"text" => "Hi, the event starts at 7 pm."
)),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN_HERE',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
const axios = require('axios');
const data = {
instance_id: "YOUR_INSTANCE_ID",
message_id: "123456789",
text: "Hi, the event starts at 7 pm."
};
axios.put('https://zapwhat.com/api/messages', data, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
import requests, json
url = "https://zapwhat.com/api/messages"
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"message_id": "123456789",
"text": "Hi, the event starts at 7 pm."
})
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Content-Type': 'application/json'
}
response = requests.put(url, headers=headers, data=payload)
print(response.text)
curl --request PUT 'https://zapwhat.com/api/messages' \
--header 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"message_id": "123456789",
"text": "Hi, the event starts at 7 pm."
}'
Common errors: 422 when the 15 minutes have passed or the message is not text; 404 when the message was not sent from ZapWhat or the identifier does not exist; 409 when the instance is not connected or does not have credentials ready.
Check or delete the message
The same endpoint accepts GET to check the current status and DELETE to delete it for everyone, using the same identification parameters.
# Check
curl --request GET 'https://zapwhat.com/api/messages?instance_id=YOUR_INSTANCE_ID&message_id=123456789' \
--header 'Authorization: Bearer YOUR_API_TOKEN_HERE'
# Delete
curl --request DELETE 'https://zapwhat.com/api/messages' \
--header 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"message_id": "123456789"
}'
Send File / Media
Send images, videos, audio, documents, stickers, or contact cards to any WhatsApp number. All media types are sent to the same endpoint.
POST https://zapwhat.com/api/send-media
Parameter Type Required Description
instance_idString Yes Your WhatsApp session ID.
toString Yes Recipient number with country code.
typeString Yes File type: image, video, audio, document, sticker, contact
urlString Yes* Public URL of the file. Not required if type=contact.
captionString No Descriptive text (applies to image and video).
filenameString No File name to display (useful for document).
contact_nameString Yes* Contact name (required if type=contact).
contact_phoneString Yes* Contact phone (required if type=contact).
Audio files are sent as voice notes. Stickers must be in WebP format.
Integration Examples
PHP
Node.js
Python
cURL
// Example: send image with caption
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://zapwhat.com/api/send-media',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"to" => "5215512345678",
"type" => "image",
"url" => "https://example.com/image.jpg",
"caption" => "Look at this image!"
)),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
// Example: send sticker
$payload = json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"to" => "5215512345678",
"type" => "sticker",
"url" => "https://example.com/sticker.webp"
));
// Example: send contact
$payload = json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"to" => "5215512345678",
"type" => "contact",
"contact_name" => "John Doe",
"contact_phone" => "5215598765432"
));
const axios = require('axios');
// Send image with caption
const data = {
instance_id: "YOUR_INSTANCE_ID",
to: "5215512345678",
type: "image",
url: "https://example.com/image.jpg",
caption: "Look at this image!"
};
axios.post('https://zapwhat.com/api/send-media', data, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
// Send document
const docData = {
instance_id: "YOUR_INSTANCE_ID",
to: "5215512345678",
type: "document",
url: "https://example.com/report.pdf",
filename: "Report_2026.pdf"
};
axios.post('https://zapwhat.com/api/send-media', docData, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
// Send contact
const contactData = {
instance_id: "YOUR_INSTANCE_ID",
to: "5215512345678",
type: "contact",
contact_name: "John Doe",
contact_phone: "5215598765432"
};
axios.post('https://zapwhat.com/api/send-media', contactData, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
import requests, json
url = "https://zapwhat.com/api/send-media"
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
# Send image with caption
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"type": "image",
"url": "https://example.com/image.jpg",
"caption": "Look at this image!"
})
response = requests.post(url, headers=headers, data=payload)
print(response.text)
# Send sticker
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"type": "sticker",
"url": "https://example.com/sticker.webp"
})
response = requests.post(url, headers=headers, data=payload)
print(response.text)
# Send contact
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"type": "contact",
"contact_name": "John Doe",
"contact_phone": "5215598765432"
})
response = requests.post(url, headers=headers, data=payload)
print(response.text)
# Send image
curl --location 'https://zapwhat.com/api/send-media' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"type": "image",
"url": "https://example.com/image.jpg",
"caption": "Look at this image!"
}'
# Send document
curl --location 'https://zapwhat.com/api/send-media' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"type": "document",
"url": "https://example.com/report.pdf",
"filename": "Report_2026.pdf"
}'
Send Location
Send GPS coordinates with an optional name and address.
POST https://zapwhat.com/api/send-location
Parameter Type Required Description
instance_idString Yes Your WhatsApp session ID.
toString Yes Recipient number with country code.
latFloat Yes Location latitude. Example: 19.4326
lngFloat Yes Location longitude. Example: -99.1332
addressString No Physical address as text.
nameString No Place or business name.
Integration Examples
PHP
Node.js
Python
cURL
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://zapwhat.com/api/send-location',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(array(
"instance_id" => "YOUR_INSTANCE_ID",
"to" => "5215512345678",
"lat" => 19.4326,
"lng" => -99.1332,
"address" => "Mexico City Zocalo",
"name" => "Historic Center"
)),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
const axios = require('axios');
const data = {
instance_id: "YOUR_INSTANCE_ID",
to: "5215512345678",
lat: 19.4326,
lng: -99.1332,
address: "Mexico City Zocalo",
name: "Historic Center"
};
axios.post('https://zapwhat.com/api/send-location', data, {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
}).then(res => console.log(res.data));
import requests, json
url = "https://zapwhat.com/api/send-location"
payload = json.dumps({
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"lat": 19.4326,
"lng": -99.1332,
"address": "Mexico City Zocalo",
"name": "Historic Center"
})
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
curl --location 'https://zapwhat.com/api/send-location' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"to": "5215512345678",
"lat": 19.4326,
"lng": -99.1332,
"address": "Mexico City Zocalo",
"name": "Historic Center"
}'
Check if a Number is on WhatsApp
Check whether a phone number is registered on WhatsApp. Requires a connected instance.
POST https://zapwhat.com/api/check-number
Parameter Type Required Description
instance_idString Yes ID of your connected WhatsApp session.
phoneString Yes Number to check (e.g., 5215512345678).
curl --location 'https://zapwhat.com/api/check-number' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"phone": "5215512345678"
}'
List Groups
Get all groups your WhatsApp session belongs to.
POST https://zapwhat.com/api/groups
curl --location 'https://zapwhat.com/api/groups' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"action": "list"
}'
Create Group
Create a new WhatsApp group with the specified participants.
POST https://zapwhat.com/api/groups
Parameter Type Required Description
instance_idString Yes Your session ID.
actionString Yes create
nameString Yes Group name.
participantsArray Yes Array of numbers to add (e.g., ["5215512345678"]).
curl --location 'https://zapwhat.com/api/groups' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"action": "create",
"name": "My Group",
"participants": ["5215512345678", "5215598765432"]
}'
Manage Group
Manage participants, settings, and more from a single endpoint.
POST https://zapwhat.com/api/groups
Action Description Additional parameters
metadataGet group info group_id
participantsList participants group_id
add-participantsAdd members group_id, participants [array]
remove-participantsRemove members group_id, participants [array]
settingsChange name/description group_id, subject, description
invite-linkGet invite link group_id
leaveLeave the group group_id
# Get metadata
curl --location 'https://zapwhat.com/api/groups' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"action": "metadata",
"group_id": "
[email protected] "
}'
# Add participants
curl --location 'https://zapwhat.com/api/groups' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"instance_id": "YOUR_INSTANCE_ID",
"action": "add-participants",
"group_id": "
[email protected] ",
"participants": ["5215512345678"]
}'
The
group_id is the group JID (e.g.,
[email protected] ). You can get it with the
list action.
Receive Messages (Webhooks)
To receive incoming messages, configure a Webhook URL from the Instances section of your Control Panel. Every time your number receives a message, ZapWhat sends a POST request to your server with the details.
You can configure a different webhook URL for each instance from the panel.
Received JSON Structure
{
"event": "message.incoming",
"sessionId": "TU_SESSION_ID",
"text": "Hi, I need information",
"from": "5215512345678",
"data": {
"messages": {
"key": {
"remoteJid": "
[email protected] ",
"fromMe": false,
"id": "MSG_ID_12345"
},
"message": {
"conversation": "Hi, I need information"
},
"messageTimestamp": 1781289344
}
}
}
PHP Implementation Example
// webhook.php - Receive ZapWhat notifications
// 1. Read the POST data
$input = file_get_contents('php://input');
$data = json_decode($input, true);
if (!$data) {
http_response_code(400);
exit('Invalid JSON');
}
// 2. Extract the main data
$messageText = $data['text'] ?? '';
$senderNumber = $data['from'] ?? '';
// 3. Process or log
if (!empty($senderNumber) && !empty($messageText)) {
$log = date('Y-m-d H:i:s') . " | Sender: $senderNumber | Message: $messageText" . PHP_EOL;
file_put_contents('webhooks.log', $log, FILE_APPEND);
}
// 4. Respond with success
http_response_code(200);
echo json_encode(['status' => 'processed']);
Best Practices
1. Anti-Spam and WhatsApp Limits
The API does not impose a strict messages-per-second limit, but your WhatsApp number is still subject to Meta's anti-spam policies. To avoid blocks:
Add random pauses (3–8 seconds) between bulk sends
Vary message content (do not use identical templates)
Avoid sending messages to users who do not have you in their contacts
Monitor block rates and adjust your speed
2. Error Handling
Implement retries with exponential backoff (wait 1s, 2s, 4s...)
Log all API errors and responses for debugging
3. Security
Never expose your API Token in client-side code
Use environment variables to store tokens
4. Built-in Proxies
ZapWhat includes a global network of rotating proxies built into all your instances automatically for maximum stability. You do not need to configure or buy additional proxies.
Automatic protection against blocks using dynamic IPs
Smart location assignment to match your region
High availability guaranteed with no extra configuration