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.

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

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

FieldTypeDescription
tostringRequired. Recipient phone number in international format (digits only, e.g. 15551234567).
typestringOne of text (default), template, image, document, audio, video, sticker, interactive.
bodystringMessage text for type: text (alias: text).
templatestringApproved template name for type: template (alias: template_name).
languagestringTemplate language code, e.g. en_US. Defaults to the template's language.
componentsarrayTemplate variable components, in the WhatsApp Cloud API format.
media_id / linkstringMedia handle or public URL for media message types.
captionstringOptional caption for image, video, and document messages.
phone_number_idstringOptional. 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": "..." }
HTTPMeaning
401Missing, invalid, or revoked API key.
403API access is not included in your plan — upgrade to Growth.
409No active WhatsApp connection on the workspace.
422Invalid request — a required field is missing or malformed.
502Upstream error from the WhatsApp Cloud API while sending.