Send a template message▾
POST

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.

CategoryOpens a conversation billed asTypical use
MARKETINGMarketingPromotions, re-engagement, announcements
UTILITYUtilityOrder updates, receipts, appointment reminders
AUTHENTICATIONAuthenticationOne-time passcodes
POST/v1/messages

Body parameters

tostringrequired

Recipient in E.164 format.

typeenumrequired

Set to template.

template

templateobjectrequired

Which template to send and the values for its placeholders.

namestringrequired

Approved template name.

languagestringrequired

BCP-47 code, e.g. en, ar, pt_BR.

componentsarray

Header, body and button parameters, in the order the template declares them.

typeenumrequired

Component being filled.

headerbodybutton

sub_typeenum

Required when type is button.

quick_replyurl

indexinteger

Zero-based button position.

parametersarrayrequired

Values, 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