/v1/messages/templatestableSend 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
Protects against doing it twice if you retry: a retry with the same key gets the first answer back instead of running again.
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
| Field | Type | What it is |
|---|---|---|
| contact_id | string | integer | Who receives it: an existing contact. Or phone instead.Signed in? Pick one from your data with “My data”. |
| phone | string | 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.3–32 characters |
| name | string | With phone only: the name of the contact created for a new number. An existing contact keeps its name.1–255 characters |
| template_idrequired | string | integer | An APPROVED template.Signed in? Pick one from your data with “My data”. |
| channel_id | string | Send from this WhatsApp channel. Default: your default WhatsApp channel.0–20 charactersSigned in? Pick one from your data with “My data”. |
| body_variables | array of string | One value per {{n}} in the body, in order. No new lines or tabs.0–100 items · default [] |
| header_text | string | Value for a {{1}} in a TEXT header.0–60 characters |
| header_media_url | string | https link to the image, video or document for a media header.uri · 0–2000 characters |
| button_url_suffixes | array of object | One per dynamic URL button.0–2 items · default [] |
| button_indexrequired | integer | Button position (0-based, from GET /v1/templates/{template_id}).0–9 |
| valuerequired | string | Suffix replacing {{1}} in the URL.0–2000 characters |
Headers
| Field | Type | What it is |
|---|---|---|
| Authorizationrequired | header | Bearer $API_KEY — your API key. |
| Api-Version | header | The 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-Keyrequired | header | Required 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).
| Field | Type | What it is |
|---|---|---|
| message_idrequired | string or null | |
| contact_idrequired | string or null | The 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_created | boolean | Real send: true when a contact was created for the phone number. |
| would_create_contact | boolean or null | Dry 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_idrequired | string or null | |
| statusrequired | string | queued (accepted for delivery) or failed. |
| templaterequired | object | |
| idrequired | string | |
| namerequired | string | |
| languagerequired | string or null | |
| sent_atrequired | string or null | |
| would_send_from | object or null | Dry run only: the channel it would send from. |
| idrequired | string | |
| namerequired | string or null | |
| identifierrequired | string or null | |
| dry_run | boolean | true when this was a dry run: every check ran and nothing changed. |
Errors
Errors are application/problem+json. Branch on code.
| Status | Code | When |
|---|---|---|
| 400 | invalid_input | A field is missing or has the wrong format. |
| 401 | unauthenticated | 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). |
| 403 | entitlement_required | The workspace's plan does not include API access ( |
| 403 | forbidden | A contact had to be created and your plan's contact limit is reached ( |
| 403 | insufficient_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. |
| 404 | not_found | The contact, template or channel does not exist. |
| 409 | conflict | The template is not APPROVED, the channel is not connected, the contact has do-not-disturb on ( |
| 429 | rate_limited | The key or workspace went over its rate limit, or a service behind the API asked to slow down. Wait for |
| 503 | upstream_unavailable | A service behind the API is briefly unavailable. Safe to retry with backoff. The send was submitted but no clear answer came back ( |
| 504 | timeout | 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.