Welcome to the WhatsApp Messaging API reference page. Exposing a secure, reliable, and credit-checked gateway API, this interface allows third-party applications to trigger WhatsApp dispatches instantly.
Authenticate your API requests by providing your API key as a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY_HERE
Alternatively, you may pass the API key in the post payload or URL query string under the api_key parameter (not recommended for production).
All accounts trigger a balance validation.
Successful WhatsApp dispatches deduct 1 credit.
If your account is configured as Unlimited, your credit balance remains untouched.
If your credit balance drops to 0, requests are rejected with an HTTP 402 Payment Required code.
| Field | Type & Status | Description |
|---|---|---|
| to |
string Required |
The recipient WhatsApp number. Symbols, dashes, and country codes (e.g. +91 98765-43210) are automatically cleaned. |
| message |
string Required |
The text content of your WhatsApp message. Supports WhatsApp formatting: *bold*, _italics_, ~strike~. |
| type |
string Optional |
Categorizes the message for logs. Supported types:
otp, promotion, invoice, report, general. Defaults to general.
|
|
string Optional |
Base64 encoded string of the PDF file to attach (recommended for invoice and report types). |
|
| filename |
string Optional |
Custom name for the attached PDF document. Defaults to document.pdf. |
| Code | Condition | JSON Payload Response |
|---|---|---|
200 OK |
Message sent successfully. | {"success":true,"message":"Message sent successfully.","message_id":"...","credits_remaining":142} |
400 Bad Request |
Missing required fields (e.g. target or message text empty). | {"success":false,"error":"Bad Request: Recipient phone number (to) is required."} |
401 Unauthorized |
Incorrect, missing, or malformed API Key. | {"success":false,"error":"Unauthorized: Invalid API Key."} |
402 Payment Required |
Out of credits on a limited account balance. | {"success":false,"error":"Payment Required: Your account is out of credits."} |
403 Forbidden |
The API Key is currently suspended by the Admin. | {"success":false,"error":"Forbidden: This API key is suspended."} |
502 Bad Gateway |
The underlying WhatsApp server gateway failed to process the request. | {"success":false,"error":"Message dispatch failed: HTTP Request error: ..."} |
Triggering a message using standard cURL:
curl -X POST "https://www.whatsapp.zamzy.in/api/whatsapp.php" \
-H "Authorization: Bearer teh_api_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"to": "+919876543210",
"message": "*Dear Client,* \nYour OTP verification code is *884729*.",
"type": "otp"
}'
Sending via PHP using curl_exec:
<?php
$api_url = "https://www.whatsapp.zamzy.in/api/whatsapp.php";
$api_key = "teh_api_your_key_here";
$data = [
"to" => "919876543210",
"message" => "Hello! This is a promotional alert.",
"type" => "promotion"
];
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Sending via Javascript using Fetch API:
const apiKey = 'teh_api_your_key_here';
const payload = {
to: '+919876543210',
message: 'Hello, your invoice statement report is ready.',
type: 'report'
};
fetch('https://www.whatsapp.zamzy.in/api/whatsapp.php', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
Sending via Python using the requests library:
import requests
import json
url = "https://www.whatsapp.zamzy.in/api/whatsapp.php"
api_key = "teh_api_your_key_here"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
payload = {
"to": "+919876543210",
"message": "*Invoice delivery:* Click here to download.",
"type": "invoice"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
{
"success": true,
"message": "Message sent successfully.",
"message_id": "e3b0c44298fc1c14",
"credits_remaining": 99
}