API overview
Connect your own systems to ZAPGEN with a REST API key. Covers the base URL, authentication, rate limits, errors, phone numbers and pagination.
The ZAPGEN API lets your website, CRM, store or booking system send WhatsApp messages and keep your contacts in sync. It's a JSON REST API on the same servers as the app. Every request uses an API key that belongs to one organization.
Only the organization owner can create API keys, and the API is only available while your subscription is active.
Base URL#
https://app.zapgen.ae/apiAll endpoints sit under this address, for example https://app.zapgen.ae/api/send. There's no version in the path. Always use https://.
Get an API key#
- Sign in as the owner and open Developers › Access tokens.
- Click Generate API key. The new key appears in the list.
- Click Show token, then Copy token, and store the key in your system's secret settings.

Each key gives full API access to your organization: it can send messages and read, change or delete contacts. Keep it on your server, never in a website's JavaScript or a mobile app. To revoke a key, click Delete token next to it; requests with that key stop working straight away. You can have several keys, for example one per system, so you can revoke one without touching the others.
Authentication#
Send the key in the Authorization header as a Bearer token. Send request bodies as JSON, and ask for JSON back:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: application/jsonCheck that a key works with GET /api/verify:
curl https://app.zapgen.ae/api/verify \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"const res = await fetch('https://app.zapgen.ae/api/verify', {
headers: { Authorization: 'Bearer YOUR_API_KEY', Accept: 'application/json' }
});
console.log(res.status, await res.json());$ch = curl_init('https://app.zapgen.ae/api/verify');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Accept: application/json'],
]);
echo curl_exec($ch);import requests
res = requests.get(
"https://app.zapgen.ae/api/verify",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
)
print(res.status_code, res.json()){
"statusCode": 200,
"message": "API key is valid and active"
}A missing or wrong key returns 401:
{
"statusCode": 401,
"message": "Unauthorized. Invalid Bearer Token.",
"error": "Unauthorized. Invalid Bearer Token."
}Rate limit#
Each API key can make 600 requests per minute. Every response includes X-RateLimit-Limit and X-RateLimit-Remaining headers. Over the limit, you get 429 Too Many Requests with a Retry-After header that says how many seconds to wait:
{
"statusCode": 429,
"message": "Too many requests"
}Sending to many people at once? Spread the requests out, or use a campaign from the app instead.
Errors#
Errors come back as JSON with the HTTP status in statusCode and a readable message. Validation errors also list the problem fields in errors:
{
"statusCode": 400,
"message": "The given data was invalid.",
"errors": {
"phone": ["The phone number is not valid."]
}
}| Status | Meaning |
|---|---|
200 | The request worked. For message sends, also check data.success (see below). |
400 | Something in the request is missing or invalid. See errors. |
401 | The API key is missing or wrong. |
403 | Your subscription has ended (Please renew or subscribe to a plan to continue!), or WhatsApp isn't connected yet (Please setup your whatsapp account!). |
404 | The contact, group or reply doesn't exist in your organization, or the URL is wrong. |
405 | The URL exists, but not with this HTTP method. |
429 | Too many requests. Wait for Retry-After seconds. |
500 | Something went wrong on our side. Try again later, and contact us if it keeps happening. |
POST /api/send, /api/send/template and /api/send/media answer 200 once ZAPGEN has passed your message to Meta, even if Meta rejected it. Always check data.success in the response. When it's false, data.message and data.data.error hold Meta's reason. Some messages fail even later, after Meta accepted them; those arrive as a failed status update. See Messages.
Phone numbers#
Send phone numbers in international format with the country code, ideally E.164: a +, the country code and the number, with no spaces or leading zero, for example +971501234567. Numbers are stored in that format, and searching by phone matches +971501234567, 00971501234567 and 971501234567 to the same contact.
Don't send local numbers like 0501234567. Without a country code the number can't be recognised and may be saved incorrectly.
Pagination#
List endpoints return 10 items per page by default. Use page and per_page (up to 100) in the query string:
GET /api/contacts?page=2&per_page=50The response wraps the items in data, with page details in meta and ready-made page links in links:
{
"data": [ { "uuid": "4d1f7a3e-…" } ],
"links": {
"first": "https://app.zapgen.ae/api/contacts?page=1",
"last": "https://app.zapgen.ae/api/contacts?page=7",
"prev": "https://app.zapgen.ae/api/contacts?page=1",
"next": "https://app.zapgen.ae/api/contacts?page=3"
},
"meta": {
"current_page": 2,
"from": 51,
"last_page": 7,
"path": "https://app.zapgen.ae/api/contacts",
"per_page": 50,
"to": 100,
"total": 312
}
}Keep requesting links.next until it's null.
Dates and IDs#
- Every record has a
uuid. Use it as the ID in your own system and in URLs such as/api/contacts/{uuid}. - Contact dates (
created_at,updated_at) are UTC, formattedYYYY-MM-DD HH:MM:SS. - Responses can contain more fields than these docs describe. Only rely on the documented ones: the others are internal and may change.
Endpoints#
| Method | Endpoint | What it does |
|---|---|---|
POST | /api/send | Send a text message, reply buttons, a list or a link button. |
POST | /api/send/template | Send an approved template, inside or outside the 24-hour window. |
POST | /api/send/media | Send an image, video, audio file, document or sticker from a URL. |
GET | /api/contacts | List contacts, search them or find one by phone number. |
POST | /api/contacts | Create a contact. |
POST | /api/contacts/upsert | Create or update a contact by phone number. Best for syncing. |
PUT | /api/contacts/{uuid} | Replace a contact's details. |
DELETE | /api/contacts/{uuid} | Delete a contact. |
GET | /api/contact-groups | List contact groups. |
POST | /api/contact-groups | Create a group. |
PUT | /api/contact-groups/{uuid} | Rename a group. |
DELETE | /api/contact-groups/{uuid} | Delete a group. |
GET | /api/canned-replies | List basic auto-replies. |
POST | /api/canned-replies | Create a text auto-reply. |
PUT | /api/canned-replies/{uuid} | Update an auto-reply. |
DELETE | /api/canned-replies/{uuid} | Delete an auto-reply. |
GET | /api/templates | List your message templates. |
GET | /api/chat-media/{id} | Download a media file from a chat. |
GET | /api/verify | Check that an API key works. |
To receive messages and status updates instead of asking for them, set up webhooks.
Creating templates, starting campaigns, fetching a single contact by ID and looking up a message's status are done in the app for now. Delivery and read updates reach you through the message.status.update webhook.