Manage templates
List, create, update and delete the WhatsApp templates of a number.
A template is a message WhatsApp has approved in advance. It is the only kind of message you can send outside the 24-hour window. To send one, see Template.
List templates
GET/v1/numbers/{phone_number}/templatesReference →
curl -X GET "$WAPIU_API/v1/numbers/$WAPIU_NUMBER/templates?status=APPROVED&limit=20" \ -H "Authorization: Bearer $WAPIU_TOKEN"| Query | Description |
|---|---|
status | APPROVED, PENDING, REJECTED, IN_APPEAL, PAUSED, DISABLED or LIMIT_EXCEEDED. |
category | MARKETING, UTILITY or AUTHENTICATION. |
limit | Page size, default 9. |
after | The cursor of the next page, from the previous response. |
To find a template by name or text, use GET …/templates/search?name=… or ?content=….
Create a template
POST/v1/numbers/{phone_number}/templatesReference →
The body follows WhatsApp's template format: name, language, category and components.
curl -X POST "$WAPIU_API/v1/numbers/$WAPIU_NUMBER/templates" \ -H "Authorization: Bearer $WAPIU_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "order_shipped", "language": "it", "category": "UTILITY", "components": [ { "type": "BODY", "text": "Ciao {{1}}, il tuo ordine {{2}} è in viaggio.", "example": { "body_text": [ [ "Mario", "A1234" ] ] } } ] }'A new template starts as PENDING. WhatsApp reviews it, usually within minutes, and moves it to APPROVED or REJECTED.
Update a template
PUT/v1/numbers/{phone_number}/templates/{template_id}Reference →
PUT replaces the whole template: send name, language, category and components every time.
Delete a template
DELETE/v1/numbers/{phone_number}/templates/{name}Reference →
Without hsm_id, this deletes every language of the template. To delete one language only, pass its ID as ?hsm_id=….
Media for a header
POST/v1/numbers/{phone_number}/templates/mediaReference →
Upload an image, video or document as multipart/form-data (field file). Use the handle in the response in a template's HEADER component.
curl -X POST "$WAPIU_API/v1/numbers/$WAPIU_NUMBER/templates/media" \
-H "Authorization: Bearer $WAPIU_TOKEN" \
-F file=@header.pngErrors
Template calls use the same codes as sends: 404 auth_unknown_sender, 422 provider_permanent (WhatsApp rejected the request), 429 provider_rate_limited, 503 provider_retryable. See Errors.