Start Free — No Credit Card Required · IntelliReply AI now replies in Arabic and EnglishSee plans →

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.

Owner only

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/api

All 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#

  1. Sign in as the owner and open Developers › Access tokens.
  2. Click Generate API key. The new key appears in the list.
  3. Click Show token, then Copy token, and store the key in your system's secret settings.
Developers › Access tokens, with the Generate API key button highlighted and the token blurred
Developers › Access tokens, with the Generate API key button highlighted and the token blurred

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/json

Check 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"
Response
{
  "statusCode": 200,
  "message": "API key is valid and active"
}

A missing or wrong key returns 401:

401 Unauthorized
{
  "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:

429 Too Many Requests
{
  "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:

400 Bad Request
{
  "statusCode": 400,
  "message": "The given data was invalid.",
  "errors": {
    "phone": ["The phone number is not valid."]
  }
}
StatusMeaning
200The request worked. For message sends, also check data.success (see below).
400Something in the request is missing or invalid. See errors.
401The API key is missing or wrong.
403Your subscription has ended (Please renew or subscribe to a plan to continue!), or WhatsApp isn't connected yet (Please setup your whatsapp account!).
404The contact, group or reply doesn't exist in your organization, or the URL is wrong.
405The URL exists, but not with this HTTP method.
429Too many requests. Wait for Retry-After seconds.
500Something went wrong on our side. Try again later, and contact us if it keeps happening.
Message sends return 200 even when WhatsApp refuses them

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=50

The response wraps the items in data, with page details in meta and ready-made page links in links:

Response
{
  "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, formatted YYYY-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#

MethodEndpointWhat it does
POST/api/sendSend a text message, reply buttons, a list or a link button.
POST/api/send/templateSend an approved template, inside or outside the 24-hour window.
POST/api/send/mediaSend an image, video, audio file, document or sticker from a URL.
GET/api/contactsList contacts, search them or find one by phone number.
POST/api/contactsCreate a contact.
POST/api/contacts/upsertCreate 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-groupsList contact groups.
POST/api/contact-groupsCreate a group.
PUT/api/contact-groups/{uuid}Rename a group.
DELETE/api/contact-groups/{uuid}Delete a group.
GET/api/canned-repliesList basic auto-replies.
POST/api/canned-repliesCreate a text auto-reply.
PUT/api/canned-replies/{uuid}Update an auto-reply.
DELETE/api/canned-replies/{uuid}Delete an auto-reply.
GET/api/templatesList your message templates.
GET/api/chat-media/{id}Download a media file from a chat.
GET/api/verifyCheck that an API key works.

To receive messages and status updates instead of asking for them, set up webhooks.

Not available in the API yet

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.

Still stuck?Our team answers on WhatsApp and at [email protected].
Ask us on WhatsApp