Managing Templates via API
Create, edit, delete and sync your WhatsApp message templates with the same API
token you use for sending, and get a webhook when WhatsApp approves, rejects,
pauses or re-categorises one. All endpoints are under https://chatrixa.com/api and use
Authorization: Bearer YOUR_API_TOKEN. Templates are identified by their Chatrixa uuid.
| Method and path | What it does |
|---|---|
GET /api/templates |
List templates. Optional filters: status, category, language, name. |
GET /api/templates/{uuid} |
One template with its components, rejection reason and quality. |
POST /api/templates |
Create a template and submit it to WhatsApp. |
PUT /api/templates/{uuid} |
Edit the components of a template. |
DELETE /api/templates/{uuid} |
Delete one language, or all languages with ?all_languages=true. |
POST /api/templates/sync |
Pull your templates from WhatsApp. |
Success responses are { "statusCode": 200, "data": { ... } } (201 on create).
Errors are { "statusCode": 409, "code": "TEMPLATE_NAME_TAKEN", "message": "...", "errors": { ... } };
errors is present for field validation failures. A template that belongs to another
organization is always 404 TEMPLATE_NOT_FOUND.
Write endpoints (POST, PUT, DELETE, sync) are limited to 30 requests per
minute per API token; beyond that you get 429 with a Retry-After header.
Create a template
curl -X POST https://chatrixa.com/api/templates \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "order_update",
"language": "en_US",
"category": "UTILITY",
"body": { "text": "Your order {{1}} has shipped", "example": ["1001"] },
"footer": { "text": "Thanks for shopping with us" },
"buttons": [ { "type": "URL", "text": "Track", "url": "https://example.com/track" } ]
}'
The response is 201 with the stored template, usually "status": "PENDING". WhatsApp
reviews it; you learn the result from a webhook (below) or by polling GET /api/templates/{uuid}.
Rules checked before anything is sent to WhatsApp (422 TEMPLATE_VALIDATION_FAILED, with
errors per field):
categoryisMARKETING,UTILITYorAUTHENTICATION.nameis 1 to 512 characters of lowercase letters, digits and underscores.body.textis required unless the category isAUTHENTICATION.message_send_ttl_secondsforMARKETINGis between 43200 (12 hours) and 2592000 (30 days).- Media headers (IMAGE, VIDEO, DOCUMENT) and carousels are not supported yet. Use a TEXT header or none.
- URL buttons: at most 2 per template, button text up to 25 characters, URL up to 2000
characters starting with
https://orhttp://. See Buttons with a dynamic link below. COPY_CODEsample code (example) is at most 15 characters.
Buttons with a dynamic link
A URL button can end with a variable, so each message opens a different link โ for example a payment link created by your own system:
"buttons": [
{ "type": "URL", "text": "Pay now", "url": "https://pay.example.com/link/{{1}}", "example": "AbC123" }
]
WhatsApp's rules, checked before anything is sent:
- Only one variable, written
{{1}}, at the very end of the URL. - The website domain is fixed. You cannot pass a whole URL per message, only its ending:
https://{{1}}is refused. Put the part of your links that never changes inurl. exampleis required with{{1}}: a realistic ending that WhatsApp's reviewers can open, as a string. No spaces.
Quick-reply buttons are always stored before the other buttons, so check the button order
with GET /api/templates/{uuid} before you send. You fill in the ending each time you send the template. See Buttons with a dynamic link in
Template Messages.
If the same name and language already exists in your account you get 409 TEMPLATE_NAME_TAKEN
and nothing is sent to WhatsApp. WhatsApp's own duplicate error returns the same code. When
WhatsApp rejects the content, 422 carries WhatsApp's message in message.
Edit a template
PUT /api/templates/{uuid} replaces the components: send the full body, header, footer
and buttons you want. The template goes back to PENDING for review. Anything you leave out
is removed or reset to its default โ for AUTHENTICATION templates that means
add_security_recommendation (default true) and code_expiration_minutes (default 5),
so send them again if you changed them.
- Only
APPROVED,REJECTEDandPAUSEDtemplates can be edited. Otherwise409 TEMPLATE_NOT_EDITABLE. nameandlanguagecannot change, and neither can the category of an approved template (422).- WhatsApp limits how often a template can be edited. When it refuses, you get
429 TEMPLATE_EDIT_RATE_LIMITEDwith aRetry-Afterheader. Retry later. - The default OTP template (
ramz_otp) is managed by Chatrixa and cannot be edited.
Delete a template
DELETE /api/templates/{uuid} deletes that language only. DELETE /api/templates/{uuid}?all_languages=true
deletes every language of the same name (WhatsApp deletes by name). The response lists what was removed:
{ "statusCode": 200, "data": { "deleted_uuids": ["9b1e7f44-3c1a-4d0e-8f1b-2a7c5d6e8f90"] } }
The default OTP template (ramz_otp) cannot be deleted (409 TEMPLATE_NOT_EDITABLE).
Sync
POST /api/templates/sync pulls your WhatsApp account's templates. It creates the ones Chatrixa
does not have, refreshes status and category, and never deletes. Response:
{ "statusCode": 200, "data": { "created": 2, "updated": 1, "unchanged": 14 } }.
One sync per organization per 60 seconds: a second call returns 429 TEMPLATE_SYNC_THROTTLED
with Retry-After. A sync that fails does not start the wait.
Errors
code |
Status | Meaning |
|---|---|---|
TEMPLATE_NOT_FOUND |
404 | No such template in your organization. |
TEMPLATE_VALIDATION_FAILED |
422 | Invalid fields (errors), or WhatsApp rejected the content. |
TEMPLATE_NAME_TAKEN |
409 | Name and language already exist. |
TEMPLATE_NOT_EDITABLE |
409 | Status does not allow edits, or a protected platform template. |
TEMPLATE_EDIT_RATE_LIMITED |
429 | WhatsApp refused a too-recent edit. Retry later. |
TEMPLATE_SYNC_THROTTLED |
429 | A sync ran less than 60 seconds ago. |
TEMPLATE_WHATSAPP_NOT_CONNECTED |
422 | Connect your WhatsApp account first. |
TEMPLATE_UPSTREAM_PROVIDER_ERROR |
502 | WhatsApp could not be reached or failed. Safe to retry. |
Template webhooks
Subscribe an endpoint in Settings โ Webhooks (https://chatrixa.com/settings/webhooks) to these events
(or to template.*):
| Event | Fires when |
|---|---|
template.status_updated |
The stored status changes (PENDING to APPROVED, REJECTED, PAUSED, DISABLED, ...). |
template.category_updated |
The stored category changes (for example WhatsApp re-categorises UTILITY to MARKETING, which changes price and opt-in rules). |
No event fires when nothing changed, so WhatsApp retries and duplicate deliveries are silent.
Each delivery is signed with HMAC-SHA256 in the X-Chatrixa-Signature header (sha256=<hex> of the raw body,
using your webhook secret).
{
"event": "template.status_updated",
"event_id": "6f0e9a3e-5a39-4d26-9d2a-0a8f7c1b2d11",
"delivered_at": "2026-11-09T10:15:01Z",
"organization_id": 42,
"data": {
"template": {
"uuid": "9b1e7f44-3c1a-4d0e-8f1b-2a7c5d6e8f90",
"meta_id": "1234567890",
"name": "order_confirmation",
"language": "en_US",
"status": "REJECTED",
"category": "UTILITY"
},
"change": { "field": "status", "previous": "PENDING", "new": "REJECTED", "reason": "INVALID_FORMAT" },
"source": "meta_webhook",
"occurred_at": "2026-11-09T10:15:00Z"
}
}
change.fieldisstatusorcategory.change.reasonis WhatsApp's reason when it gave one, elsenull.sourceismeta_webhook(WhatsApp told us) orsync(a sync found the difference).templateis the state after the change. New fields may be added; ignore keys you do not know.event_idis new for every delivery; deduplicate on it. Ordering is best effort, so compareoccurred_atand treat the latesttemplateas the truth.
The full request and response schemas are in the OpenAPI spec.