Developers
API reference
The REST API for sending WhatsApp messages programmatically from your connected number.
Preview. The REST API is available on the Growth and Scale plans. New endpoints are being added — this page documents what is live today. See Documentation for a guided start.
Reference
Authentication
Send your secret API key as a Bearer token on every request. Create and revoke keys in Developer Studio → API keys in your dashboard.
Authorization: Bearer ag_live_sk_xxxxxxxxxxxxxxxxxxxx
Missing or revoked keys return 401. Keys are bound to your workspace's active WhatsApp connection.
Base URL
https://wagate.app
Conventions
- All endpoints accept and return
application/json(POSTbodies may also be form-encoded). - Successful responses include
"ok": true. - Errors return
"ok": falsewith a human-readableerror, an optional machinecode, and a matching HTTP status.
Send a message
POST /api/messages.php
Sends a WhatsApp message through your connected number and logs the attempt. Supports text, template, media, and interactive messages.
Request body
| Field | Type | Description |
|---|---|---|
to | string | Required. Recipient phone number in international format (digits only, e.g. 15551234567). |
type | string | One of text (default), template, image, document, audio, video, sticker, interactive. |
body | string | Message text for type: text (alias: text). |
template | string | Approved template name for type: template (alias: template_name). |
language | string | Template language code, e.g. en_US. Defaults to the template's language. |
components | array | Template variable components, in the WhatsApp Cloud API format. |
media_id / link | string | Media handle or public URL for media message types. |
caption | string | Optional caption for image, video, and document messages. |
phone_number_id | string | Optional. Send from a specific connected number; defaults to your first number. |
Example — text
curl -X POST https://wagate.app/api/messages.php \
-H "Authorization: Bearer ag_live_sk_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "to": "15551234567", "type": "text", "body": "Your order has shipped!" }'
Example — template
{
"to": "15551234567",
"type": "template",
"template": "order_confirmation",
"language": "en_US",
"components": [
{ "type": "body", "parameters": [ { "type": "text", "text": "#RS-48217" } ] }
]
}
Response 200
{ "ok": true, "wamid": "wamid.HBgLMTU1NTEyMzQ1Njc...", "status": "sent" }
Errors
Errors share one envelope:
{ "ok": false, "error": "Recipient \"to\" is required.", "code": "..." }
| HTTP | Meaning |
|---|---|
401 | Missing, invalid, or revoked API key. |
403 | API access is not included in your plan — upgrade to Growth. |
409 | No active WhatsApp connection on the workspace. |
422 | Invalid request — a required field is missing or malformed. |
502 | Upstream error from the WhatsApp Cloud API while sending. |