> For the complete documentation index, see [llms.txt](https://docs.cekat.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cekat.ai/api-documentation/chat/broadcast/create-a-template.md).

# Create a template

Creates a WhatsApp message template on the inbox's WhatsApp Business Account and submits it to Meta for review. The new template usually starts with `status: PENDING`; check `GET /api/templates` to see when it becomes `APPROVED`.

* Template names must follow Meta's rules: lowercase letters, numbers and underscores.
* Use `{{1}}`, `{{2}}`, and so on for variables in `body`, and send one sample value per variable in `body_placeholder`. Meta uses the samples during review.
* Attach an image as `file` to give the template an image header.
* Meta may change the category if it does not match the content.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Broadcast","description":"Use these endpoints to manage WhatsApp message templates, upload recipient lists, and run broadcast campaigns.\n\n## Typical flow\n1. **Create a template** with `POST /templates`. Meta reviews it; its `status` starts as `PENDING`.\n2. **Check approval** with `GET /api/templates`. Only templates with `status: APPROVED` can be sent. If you created or edited templates directly in Meta, call `POST /templates/sync` first to copy them into Cekat.\n3. **Send to one contact** with `POST /templates/send`, or continue below to send to many.\n4. **Upload a recipient list** with `POST /api/recipients`. Contacts are imported in the background; poll `GET /api/recipients` until the list's `total_contacts` matches the number returned by the upload.\n5. **Create a campaign** with `POST /api/campaigns`, using the template's `wa_template_id` as `template_id`. Leave out `schedule_at` to send right away.\n6. **Track results** with `GET /api/campaigns` for totals and `GET /api/v2/campaigns/{id}/messages` for each recipient's delivery status and replies.\n\nEvery step needs the `inbox_id` of a connected WhatsApp inbox. Get it from `GET /api/inboxes` (the `id` of an inbox whose `type` is `whatsapp`).\n"}],"servers":[{"url":"https://api.cekat.ai","description":"Production"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your business's Cekat API key, from **Settings → Developers & API** in the Cekat dashboard (https://chat.cekat.ai/developers?section=apikeys). Available on the Business and Enterprise plans."}},"schemas":{"Template":{"type":"object","description":"A WhatsApp message template. Additional fields may be present.","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid","description":"Cekat's internal template ID."},"created_at":{"type":"string","description":"Creation time. See **Versioning** for the format."},"wa_template_id":{"type":"string","description":"Meta's template ID. Use this value to send, delete, or run a campaign with the template."},"name":{"type":"string"},"category":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"]},"language":{"type":"string"},"status":{"type":"string","description":"Meta review status, for example `APPROVED`, `PENDING`, or `REJECTED`. Only `APPROVED` templates can be sent."},"body":{"type":"string"},"body_placeholder":{"type":"array","nullable":true,"description":"Sample values for the body variables, as submitted to Meta.","items":{"type":"string"}},"header_type":{"type":"string","nullable":true,"enum":["TEXT","DOCUMENT","IMAGE","VIDEO",null]},"header":{"type":"string","nullable":true,"description":"Header text, for templates with a text header."},"file_url":{"type":"string","nullable":true,"description":"URL of the header media, for templates with a media header."},"footer":{"type":"string","nullable":true},"buttons":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":true}},"inbox_id":{"type":"string","format":"uuid"},"business_id":{"type":"string","format":"uuid"},"inbox":{"$ref":"#/components/schemas/TemplateInbox"}}},"TemplateInbox":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"business_id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","description":"Error body returned by the `/templates` endpoints.","properties":{"success":{"type":"boolean"},"status_code":{"type":"integer"},"error":{"type":"object","properties":{"message":{"type":"string"}}}}},"RateLimitError":{"type":"object","properties":{"message":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded. Wait and retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}}}},"paths":{"/templates":{"post":{"tags":["Broadcast"],"operationId":"CreateTemplate","summary":"Create a template","description":"Creates a WhatsApp message template on the inbox's WhatsApp Business Account and submits it to Meta for review. The new template usually starts with `status: PENDING`; check `GET /api/templates` to see when it becomes `APPROVED`.\n\n- Template names must follow Meta's rules: lowercase letters, numbers and underscores.\n- Use `{{1}}`, `{{2}}`, and so on for variables in `body`, and send one sample value per variable in `body_placeholder`. Meta uses the samples during review.\n- Attach an image as `file` to give the template an image header.\n- Meta may change the category if it does not match the content.\n","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["name","category","language","body","inbox_id"],"properties":{"name":{"type":"string","maxLength":512,"description":"Template name, using lowercase letters, numbers and underscores."},"category":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"]},"language":{"type":"string","description":"Meta language code. Supported codes: Afrikaans (af), Albanian (sq), Arabic (ar), Azerbaijani (az), Bengali (bn), Bulgarian (bg), Catalan (ca), Chinese (CHN: zh_CN; HKG: zh_HK; TAI: zh_TW), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), English (en), English (UK: en_GB; US: en_US), Estonian (et), Filipino (fil), Finnish (fi), French (fr), Georgian (ka), German (de), Greek (el), Gujarati (gu), Hausa (ha), Hebrew (he), Hindi (hi), Hungarian (hu), Indonesian (id), Irish (ga), Italian (it), Japanese (ja), Kannada (kn), Kazakh (kk), Kinyarwanda (rw_RW), Korean (ko), Kyrgyz (Kyrgyzstan: ky_KG), Lao (lo), Latvian (lv), Lithuanian (lt), Macedonian (mk), Malay (ms), Malayalam (ml), Marathi (mr), Norwegian (nb), Persian (fa), Polish (pl), Portuguese (BR: pt_BR; POR: pt_PT), Punjabi (pa), Romanian (ro), Russian (ru), Serbian (sr), Slovak (sk), Slovenian (sl), Spanish (es), Spanish (ARG: es_AR; SPA: es_ES; MEX: es_MX), Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Thai (th), Turkish (tr), Ukrainian (uk), Urdu (ur), Uzbek (uz), Vietnamese (vi), and Zulu (zu)."},"body":{"type":"string","maxLength":1024,"description":"Message text. Use `{{1}}`, `{{2}}`, and so on for variables."},"inbox_id":{"type":"string","format":"uuid","description":"ID of a connected WhatsApp inbox."},"body_placeholder":{"type":"string","description":"JSON array of sample values, one per body variable, in order. Required when `body` contains variables."},"file":{"type":"string","format":"binary","description":"Optional header image (JPEG or PNG)."}}}}}},"responses":{"201":{"description":"Template created and submitted to Meta.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"status_code":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"400":{"description":"A field is missing or invalid, the inbox is not a WhatsApp inbox, or Meta rejected the template. `error.message` explains why.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"The inbox was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```
