Message templates
Message templates are used to send structured, variable-driven messages outside the 24-hour free-form messaging window — primarily WhatsApp Business HSM templates that go through Meta moderation. The API covers template CRUD, submitting for approval (`submit`), archiving, and syncing approval status back from Meta. An approved template is sent to a contact via `POST /messages/send-template` (see the Messages group).
Endpoints
| Method | Path | Summary |
|---|---|---|
| GET | /v1/templatesList templates with pagination, search, and facets by status/language/channel. | List templates with pagination, search, and facets by status/language/channel. |
| GET | /v1/templates/channel-typesChannel types that templates can be created for. | Channel types that templates can be created for. |
| GET | /v1/templates/{template}Get a template by id (body, parameters, buttons). | Get a template by id (body, parameters, buttons). |
| GET | /v1/templates/{template}/channelsChannels the template is available to send on. | Channels the template is available to send on. |
| POST | /v1/templatesCreate a draft template. | Create a draft template. |
| PATCH | /v1/templates/{template}Update a draft template. | Update a draft template. |
| DELETE | /v1/templates/{template}Delete a template. | Delete a template. |
| POST | /v1/templates/{template}/submitSubmit the template for Meta moderation (WhatsApp Business). | Submit the template for Meta moderation (WhatsApp Business). |
| POST | /v1/templates/{template}/publishPublish an approved template (make it available for sending). | Publish an approved template (make it available for sending). |
| POST | /v1/templates/{template}/archiveArchive a template. | Archive a template. |
| POST | /v1/templates/{template}/unarchiveUnarchive a template. | Unarchive a template. |
| POST | /v1/templates/syncSync moderation statuses of all company templates from Meta. | Sync moderation statuses of all company templates from Meta. |
Examples
Create a template
Request
curl -X POST "https://api.aisar.app/v1/templates" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel_type": "whatsapp_business",
"name": "Order shipped",
"language": "ru",
"category": "utility",
"body": "Здравствуйте, {{1}}! Ваш заказ №{{2}} передан в доставку.",
"parameters": [
{ "name": "first_name", "type": "text", "sample_value": "Иван", "position": 1 },
{ "name": "order_number", "type": "text", "sample_value": "1045", "position": 2 }
]
}'Response
{
"data": {
"id": 12,
"company_id": 1,
"channel_type": { "id": 4, "key": "whatsapp_business", "name": "WhatsApp Business" },
"name": "Order shipped",
"slug": "order_shipped",
"status": "draft",
"language": "ru",
"category": "utility",
"body": "Здравствуйте, {{1}}! Ваш заказ №{{2}} передан в доставку.",
"parameters": [
{ "id": 1, "name": "first_name", "type": "text", "sample_value": "Иван", "position": 1 },
{ "id": 2, "name": "order_number", "type": "text", "sample_value": "1045", "position": 2 }
],
"buttons": [],
"uses_count": 0,
"created_at": "2026-02-09T18:00:00Z",
"updated_at": "2026-02-09T18:00:00Z"
}
}Submit a template for moderation
Request
curl -X POST "https://api.aisar.app/v1/templates/12/submit" \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
{
"data": {
"message": "Template submitted for review.",
"template": {
"id": 12,
"status": "pending"
}
}
}