Skip to content
API PlatformDevelopers
POST/v1/messages/templatestable

Send a WhatsApp template

Needs
Send WhatsApp messages; manage templates, quick messages and WhatsApp short links (messaging:write)
Plan
Any plan with API access
Limits
60 a minute per key · 200 an hour · 1000 a day · 25 per contact a day (workspace defaults; live values in x-platform-send-caps)
Dry run
Yes — a full preview with ?dry_run=true
Undo
Cannot be undone: the customer receives the message. A contact created for the number stays; delete it if you do not want it.

Sends one approved WhatsApp template to one customer, now. The customer receives it and it cannot be undone.

Say who receives it with exactly one of contact_id (an existing contact) or phone (a WhatsApp number in international format). A phone that belongs to one of your contacts is sent to that contact. A number that is not a contact yet becomes one, named name when you give it, right before the message is sent, so you do not need to create the contact first. Creating it is the same as creating a contact any other way: it fires the contact.created webhook event, so your webhook endpoints and any automation that starts when a contact is created react to it. A number that already belongs to a contact creates nothing and fires no contact event; that contact (and its name) stays as it is. A created contact counts against your plan's contact limit. Your key needs the permission to send messages (messaging:write), plus the permission to read your data, which every key has. A dry run creates nothing.

The variables are checked against the template first, and nothing is created when a check fails. A contact with do-not-disturb on is not messaged: the answer is 409 with reason: contact_dnd and nothing is sent (a dry run reports it too). For bulk sends, use a broadcast in the app instead.

One-time login codes: an approved AUTHENTICATION template can be sent from your server (an API key or an app access token) — put the code (at most 15 characters) in body_variables[0]; its copy-code / one-tap button is filled with the same code (or pass it in button_url_suffixes). The AI assistant never sends authentication templates. Each code counts against the normal send limits.

Try it with ?dry_run=true: every check runs, the preview tells you which number it would send from and whether a contact would be created (would_create_contact: no contact your key can see has the number — if a contact hidden from your key already has it, the message goes to that contact instead), but nothing is sent or created.

Try it

Body

An APPROVED template.

Who receives it: an existing contact. Or `phone` instead.

Who receives it, instead of `contact_id`: the customer's WhatsApp number in international format, e.g. `+15555550123` (spaces and dashes are fine). A number that is not a contact yet becomes one.

With `phone` only: the name of the contact created for a new number. An existing contact keeps its name.

Send from this WhatsApp channel. Default: your default WhatsApp channel.

One value per `{{n}}` in the body, in order. No new lines or tabs.

Value for a `{{1}}` in a TEXT header.

https link to the image, video or document for a media header.

One per dynamic URL button.

Protects against doing it twice if you retry: a retry with the same key gets the first answer back instead of running again.

Test mode (dry run): nothing will change
Turns test mode off for this page only. It switches back when you leave the page.

Code and response

curl -X POST 'https://api.wa-api.cloud/v1/messages/template?dry_run=true' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "contact_id": "48213",
  "template_id": "9120",
  "channel_id": "301",
  "body_variables": [
    "Jane",
    "#1001",
    "https://track.example.com/1001"
  ]
}'

The code reads your key from $API_KEY.

Body

Body fields
FieldTypeWhat it is
contact_idstring | integerWho receives it: an existing contact. Or phone instead.Signed in? Pick one from your data with “My data”.
phonestringWho receives it, instead of contact_id: the customer's WhatsApp number in international format, e.g. +15555550123 (spaces and dashes are fine). A number that is not a contact yet becomes one.3–32 characters
namestringWith phone only: the name of the contact created for a new number. An existing contact keeps its name.1–255 characters
template_idrequiredstring | integerAn APPROVED template.Signed in? Pick one from your data with “My data”.
channel_idstringSend from this WhatsApp channel. Default: your default WhatsApp channel.0–20 charactersSigned in? Pick one from your data with “My data”.
body_variablesarray of stringOne value per {{n}} in the body, in order. No new lines or tabs.0–100 items · default []
header_textstringValue for a {{1}} in a TEXT header.0–60 characters
header_media_urlstringhttps link to the image, video or document for a media header.uri · 0–2000 characters
button_url_suffixesarray of objectOne per dynamic URL button.0–2 items · default []
button_indexrequiredintegerButton position (0-based, from GET /v1/templates/{template_id}).0–9
valuerequiredstringSuffix replacing {{1}} in the URL.0–2000 characters

Headers

Headers
FieldTypeWhat it is
AuthorizationrequiredheaderBearer $API_KEY — your API key.
Api-VersionheaderThe API version to use, e.g. 2026-10-01. Default: the version your key is pinned to.one of: 2026-10-01 · pattern ^\d{4}-\d{2}-\d{2}$
Idempotency-KeyrequiredheaderRequired here. Any unique string (8–128 characters), e.g. your order id plus the step. Kept 24 hours. Not needed with dry_run=true.pattern ^[A-Za-z0-9._:-]+$ · 8–128 characters

Response 202

Accepted for delivery (or the dry-run preview), with the contact it went to (`contact_created: true` when it was created for the number).

Response fields
FieldTypeWhat it is
message_idrequiredstring or null
contact_idrequiredstring or nullThe contact it was sent to (created or found by phone, or the one given). Dry run: the existing contact, or null when one would be created.
contact_createdbooleanReal send: true when a contact was created for the phone number.
would_create_contactboolean or nullDry run only: true when no contact this connection can see has the number, so a real send creates one — unless a contact hidden from this connection already has it (the message then goes to that contact). null = unknown: a connection without read access cannot look the number up.
conversation_idrequiredstring or null
statusrequiredstringqueued (accepted for delivery) or failed.
templaterequiredobject
idrequiredstring
namerequiredstring
languagerequiredstring or null
sent_atrequiredstring or null
would_send_fromobject or nullDry run only: the channel it would send from.
idrequiredstring
namerequiredstring or null
identifierrequiredstring or null
dry_runbooleantrue when this was a dry run: every check ran and nothing changed.

Errors

Errors are application/problem+json. Branch on code.

StatusCodeWhen
400invalid_input

A field is missing or has the wrong format. errors[] points at each field. No recipient or both (reason: target_required, target_conflict; name without phone is target_conflict too), a phone number that is not in international format (reason: invalid_phone), several contacts with that number (reason: contact_ambiguous: choices lists them, send contact_id), a number that too many other contacts' numbers contain to find it exactly (reason: lookup_incomplete: nothing is created, so no duplicate; send contact_id), or variables that do not fit the template. Also returned when the Idempotency-Key header is missing, or was used before with a different body.

401unauthenticated

The Authorization header is missing, the key is unknown, expired or revoked, or the request came from an address outside the key's IP allowlist (checked on every operation, before anything runs).

403entitlement_required

The workspace's plan does not include API access (api_access).

403forbidden

A contact had to be created and your plan's contact limit is reached (reason: plan_contact_limit; nothing was sent), or the key's staff member may not send templates to this customer here (reason: template_send_denied: the conversation is someone else's, or no access to the channel; nothing sent or created).

403insufficient_scope

The key does not have the permission this operation needs. Checked before the body and headers: without the permission, this is the answer whatever was sent.

404not_found

The contact, template or channel does not exist.

409conflict

The template is not APPROVED, the channel is not connected, the contact has do-not-disturb on (reason: contact_dnd; nothing sent), or the channel refused the message after it was stored (reason: send_failed; when it was by phone and the contact was created for it, contact_id and contact_created: true say so — the contact stays). Also returned while a request with the same Idempotency-Key is still running.

429rate_limited

The key or workspace went over its rate limit, or a service behind the API asked to slow down. Wait for Retry-After seconds (always sent). A send cap was reached (reason: send_cap, with window: hour, day or contact_day), or another request to the same number is still running (reason: busy: retry after Retry-After; nothing was sent and no contact created). A send the caps refuse creates no contact.

503upstream_unavailable

A service behind the API is briefly unavailable. Safe to retry with backoff. The send was submitted but no clear answer came back (reason: outcome_unknown): the message may have been sent. Check the conversation before sending again; a retry with the same Idempotency-Key is refused.

504timeout

The change did not finish in time. Retry with the same Idempotency-Key: it never runs twice.

Examples

Tell a customer their order shipped

Request body

{
  "contact_id": "48213",
  "template_id": "9120",
  "channel_id": "301",
  "body_variables": [
    "Jane",
    "#1001",
    "https://track.example.com/1001"
  ]
}

Response 202

{
  "message_id": "5501233",
  "contact_id": "48213",
  "contact_created": false,
  "conversation_id": "77410",
  "status": "queued",
  "template": {
    "id": "9120",
    "name": "order_shipped",
    "language": "en_US"
  },
  "sent_at": "2026-09-25T09:10:00.000Z"
}
Check a send to a number that is not a contact yet (dry run)

Request body

{
  "phone": "+15555550188",
  "name": "Sam Lee",
  "template_id": "9120",
  "body_variables": [
    "Sam",
    "#1002",
    "https://track.example.com/1002"
  ]
}

Response 202

{
  "message_id": null,
  "contact_id": null,
  "would_create_contact": true,
  "conversation_id": null,
  "status": "dry_run",
  "template": {
    "id": "9120",
    "name": "order_shipped",
    "language": "en_US"
  },
  "sent_at": null,
  "would_send_from": {
    "id": "301",
    "name": "Main WhatsApp",
    "identifier": "+15555550100"
  },
  "dry_run": true
}
Send to a new number: the contact is created

Request body

{
  "phone": "+15555550188",
  "name": "Sam Lee",
  "template_id": "9120",
  "body_variables": [
    "Sam",
    "#1002",
    "https://track.example.com/1002"
  ]
}

Response 202

{
  "message_id": "5501240",
  "contact_id": "48377",
  "contact_created": true,
  "conversation_id": "77502",
  "status": "queued",
  "template": {
    "id": "9120",
    "name": "order_shipped",
    "language": "en_US"
  },
  "sent_at": "2026-09-25T09:12:00.000Z"
}

Webhook events

These events can fire after this call. Subscribe an endpoint to hear about them.

Operation path

The same operation is also at POST /v1/ops/messaging_send_template_message, with every field in the JSON body.