Send a template message▾
Send a template message
Start a conversation with a pre-approved template — the only way to message outside the 24-hour window.
Templates are the only messages WhatsApp accepts outside an open session window. The template must already be approved for the language you request — see create a template.
| Category | Opens a conversation billed as | Typical use |
|---|---|---|
MARKETING | Marketing | Promotions, re-engagement, announcements |
UTILITY | Utility | Order updates, receipts, appointment reminders |
AUTHENTICATION | Authentication | One-time passcodes |
/v1/messagesBody parameters
tostringrequiredRecipient in E.164 format.
typeenumrequiredSet to template.
template
templateobjectrequiredWhich template to send and the values for its placeholders.
namestringrequiredApproved template name.
languagestringrequiredBCP-47 code, e.g. en, ar, pt_BR.
componentsarrayHeader, body and button parameters, in the order the template declares them.
typeenumrequiredComponent being filled.
headerbodybutton
sub_typeenumRequired when type is button.
quick_replyurl
indexintegerZero-based button position.
parametersarrayrequiredValues, positionally matched to {{1}}, {{2}}, …
curl -X POST https://api.sendport.tech/v1/messages \
-H "Authorization: Bearer $SENDPORT_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"+201005550123","type":"template","template":{"name":"order_shipped","language":"en","components":[{"type":"body","parameters":[{"type":"text","text":"A-4417"},{"type":"text","text":"Tuesday"}]}]}}'Responses
202Accepted
{
"object": "message",
"id": "msg_01JZQ3F8X2K7N4B6Y0R9M5TCWA",
"wamid": "wamid.SEJnTTIwMTAwNTU1MDEyM0ZRSUFFUmdT",
"conversation_id": "conv_01JZQ3F8X0QG7T2S4N8V1PZAKD",
"from": "+15550100200",
"to": "+201005550123",
"direction": "outbound",
"type": "template",
"template": { "name": "order_shipped", "language": "en", "category": "UTILITY" },
"status": "accepted",
"pricing": { "category": "utility", "billable": true, "amount": "0.0286", "currency": "USD" },
"created_at": "2026-09-06T09:14:22.114Z"
}400Parameter mismatch
{
"error": {
"type": "invalid_request_error",
"code": "template_param_mismatch",
"message": "Template 'order_shipped' declares 2 body placeholders, 1 supplied.",
"param": "template.components[0].parameters",
"doc_url": "https://sendport.tech/docs/errors#template_param_mismatch",
"request_id": "req_44b0c9e1287f4a3d8e12"
}
}401Unauthorized
{
"error": {
"type": "authentication_error",
"code": "missing_api_key",
"message": "No API key provided.",
"doc_url": "https://sendport.tech/docs/errors#missing_api_key",
"request_id": "req_9f3c2a7b41de08c5b2e6"
}
}Try itsandbox