Messages
Send Message
Sends one approved template to one number and records it in that customer's conversation. Marketing templates are refused for a customer who opted out; utility and authentication templates are not, since an order confirmation is not something a customer opts out of. Each send is charged like any WhatsApp template from your number, and the Free plan stops at its included messages. At most 60 sends a minute per workspace; send an Idempotency-Key so a retry never sends twice. Needs a full key.
POST/messages
Headers
- Idempotency-Keystring
- Any unique string. A retry with the same key within 24 hours returns the first request's answer instead of acting twice.
- Katexs-Workspacestring
- Developers only: the customer workspace this request acts in — its
org_…id fromPOST /customers. Leave it out to act in your own workspace. Refused with404(Workspace not found.) when the id is unknown, is not one of your customers, or is not anorg_…id;410when that customer was deleted (restore it withPOST /customers/{id}/restoreuntil it is erased);403when the key belongs to one customer workspace (it cannot act as another);400when your workspace is not a developer workspace./customers/*andGET /customers/usageare your own workspace's and refuse the header with400: call them without it.
Request body
- tostringrequired
- The customer's number. Include the
+and the country code (a leading00works too); spaces are fine. A number without its country code is refused: nothing is assumed about the country. - templatestringrequired
- The name of an approved template in your workspace. Templates are named, not given by id, so the name stays stable across edits.
- languagestring
- Which approved language version to send, exactly as approved —
en,hi,en_US. Leave it out for the oldest approved version, so adding a language in the console never changes what a working integration sends. - variablesstring[]
- Values for the body's
{{1}},{{2}}… in order. Numbers are sent as text. For an authentication template, the code goes here once — it is copied into the copy-code button for you. - buttonVariablesstring[]
- The value for a link button's placeholder. Separate from
variablesbecause WhatsApp addresses the button on its own. Leave it out on an authentication template. - headerMediaUrlstring (uri)
- A public link to the picture, video or document for a template with a media header. WhatsApp needs one on every send; leave it out and the template's own stored file is used.
- formDataobject
- Pre-fills a WhatsApp form the template's button opens. Only fields the form marked pre-fillable reach the screen; other keys are ignored rather than refused. Values are sent as text.
- idempotencyKeystring
- Same as the
Idempotency-Keyheader, for clients that cannot set headers. The header wins when both are sent.
Example request
bash
curl -X POST "https://app.katexs.com/api/v1/messages" \
-H "Authorization: Bearer $KATEXS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+1 415 555 0134",
"template": "order_confirmation_v1",
"language": "en",
"variables": [
"Priya",
"#10432",
"Tuesday"
],
"buttonVariables": [
"10432"
]
}'Responses
| Status | Description |
|---|---|
200 | WhatsApp accepted the message — not yet that it arrived; delivery and read are reported afterwards. A replay of an Idempotency-Key that already succeeded answers the same with deduplicated: true and an Idempotent-Replayed: true header. |
400 | The body is not JSON, to or template is missing, or the number cannot be read. |
401 | The key is missing, wrong or revoked. The answer is always the same, whichever it is. |
402 | The Free plan's WhatsApp messages are used up. Switching to pay-as-you-go lifts it. |
403 | The key's access level (read-only or build) does not allow this request, the plan does not include it, or a customer's key named another workspace in Katexs-Workspace. code says which: key_scope_read, key_scope_build, workspace_header_forbidden, or forbidden. |
404 | No template of that name, or it is not approved in the language you asked for — then available lists the languages it is approved in. |
409 | The state of things refuses it, and retrying unchanged will not help (code says which: template_not_approved, whatsapp_not_connected, whatsapp_blocked, opted_out, template_unsendable or idempotency_in_progress): the template is not approved yet, WhatsApp is not connected (or the number's connection was never finished), sending is restricted on the number, the customer opted out of marketing messages, the template carries something a send cannot fill (such as a media header with no picture), or a request with the same Idempotency-Key is still in flight. |
410 | The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date. |
429 | Over 60 sends a minute for this workspace. Wait for Retry-After seconds. |
502 | WhatsApp refused the message, in its own words. Often transient; read the sentence before retrying. |
503 | WhatsApp sending is not available right now. Retry later. |
Response fields
- okbooleanrequired
- WhatsApp accepted the message.
- messageRefstring | nullrequired
- WhatsApp's own receipt for the message — what delivery and read reports refer to, and what to quote when asking what happened to one.
- deduplicatedboolean
- Present, and
true, only on a replay of anIdempotency-Keythat already succeeded: nothing was sent this time.
200 response
{
"ok": true,
"messageRef": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSQjM2RDVGMEU4QzA3RjE2QTYA"
}Last updated November 2026 · Found a problem? Email support@katexs.com
