> 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/send-a-template.md).

# Send a template

Sends an approved WhatsApp template to one phone number. Cekat creates the contact and conversation if they don't exist yet.

**Check `success` in the body, not only the HTTP status.** If Meta rejects the message (for example, an invalid number or insufficient balance), the endpoint still returns HTTP 200, with `success: false`, `status_code: 400`, `data.status: failed`, and the reason in `data.error`.

```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":{"SentMessage":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid","description":"Message ID."},"message":{"type":"string","description":"The text that was sent, with variables filled in."},"conversation_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["sent","failed"]},"error":{"type":"string","nullable":true,"description":"Why the message failed, when `status` is `failed`."},"platform_mid":{"type":"string","nullable":true,"description":"WhatsApp message ID returned by Meta."},"media_type":{"type":"string"},"media_url":{"type":"string","nullable":true},"is_template":{"type":"boolean"},"template_id":{"type":"string","description":"The template's `wa_template_id`."},"template_category":{"type":"string"},"sent_by":{"type":"string","description":"ID of the agent the message is sent as."},"sent_by_name":{"type":"string"},"sent_by_type":{"type":"string"},"additional_data":{"type":"object","nullable":true,"additionalProperties":true,"description":"Billing details for the message."},"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/send":{"post":{"tags":["Broadcast"],"operationId":"SendTemplate","summary":"Send a template","description":"Sends an approved WhatsApp template to one phone number. Cekat creates the contact and conversation if they don't exist yet.\n\n**Check `success` in the body, not only the HTTP status.** If Meta rejects the message (for example, an invalid number or insufficient balance), the endpoint still returns HTTP 200, with `success: false`, `status_code: 400`, `data.status: failed`, and the reason in `data.error`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["wa_template_id","inbox_id","phone_number"],"properties":{"wa_template_id":{"type":"string","description":"The template's `wa_template_id`. The template must be `APPROVED`."},"inbox_id":{"type":"string","format":"uuid","description":"The WhatsApp inbox that owns the template and sends the message."},"phone_number":{"type":"string","description":"Recipient's number, digits only with country code."},"phone_name":{"type":"string","description":"Contact name to save if the contact is new. Defaults to the phone number."},"template_body_variables":{"type":"array","description":"One value per body variable, in order (`{{1}}`, `{{2}}`, ...). The count must match the template. Send `[]` for templates without variables.","items":{"type":"string"}},"otp_code":{"type":"string","maxLength":15,"description":"One-time code, for `AUTHENTICATION` templates only."},"file_url":{"type":"string","format":"uri","description":"Header media URL to use instead of the template's default, for templates with a media header."},"assign_agent_id":{"type":"string","format":"uuid","description":"Optional agent ID. The conversation is assigned to this agent after sending."}}}}}},"responses":{"200":{"description":"The message was processed. Check `success` to see whether it was sent.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"False when Meta rejected the message."},"status_code":{"type":"integer","description":"200 when sent, 400 when the message failed."},"data":{"$ref":"#/components/schemas/SentMessage"}}}}}},"400":{"description":"A required field is missing, the template is not approved, the variable count does not match, or the message contains a blocked phrase.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"The inbox or template was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```
