# Templates

Create, sync, send, and delete WhatsApp Business message templates.

## Template

> Retrieve all WhatsApp message templates associated with your business.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Create, sync, send, and delete WhatsApp Business message templates."}],"servers":[{"url":"https://api.cekat.ai","description":"Production server"},{"url":"http://localhost:3000","description":"Local development server"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your Cekat API key. Obtain this by calling `POST /register` or from your Cekat dashboard under Settings → API."}}},"paths":{"/templates":{"get":{"summary":"Template","tags":["Templates"],"operationId":"Templates_Template","description":"Retrieve all WhatsApp message templates associated with your business.","parameters":[{"name":"inbox_id","in":"query","required":false,"description":"UUID of the WhatsApp Business inbox this template belongs to. Obtainable via the `GET /inboxes` endpoint.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"description":"Bad request — check required fields and formats."},"401":{"description":"Unauthorized — API key is missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Create template

> Create a new WhatsApp Business message template. Templates must be approved by Meta before they can be sent.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Create, sync, send, and delete WhatsApp Business message templates."}],"servers":[{"url":"https://api.cekat.ai","description":"Production server"},{"url":"http://localhost:3000","description":"Local development server"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your Cekat API key. Obtain this by calling `POST /register` or from your Cekat dashboard under Settings → API."}}},"paths":{"/templates":{"post":{"summary":"Create template","tags":["Templates"],"operationId":"Templates_Create_template","description":"Create a new WhatsApp Business message template. Templates must be approved by Meta before they can be sent.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"description":"Unique snake_case name for the template, e.g. `promo_ramadan`. Must match Meta's naming rules (lowercase, no spaces).","type":"string"},"category":{"description":"Template category. Accepted values: `AUTHENTICATION`, `MARKETING`, or `UTILITY`. Most use cases fall under `MARKETING`.","type":"string"},"language":{"description":"Language code accepted by Meta (e.g. `id` for Indonesian, `en_US` for English US). See full list in the description.","type":"string"},"body":{"description":"Main text content of the template. Use `{{1}}`, `{{2}}`, etc. to define dynamic variables. Example: `Halo {{1}}, ada promo spesial untukmu!`","type":"string"},"inbox_id":{"description":"UUID of the WhatsApp Business inbox this template belongs to. Obtainable via the `GET /inboxes` endpoint.","type":"string"},"body_placeholder":{"description":"Example values for body variables in JSON array format. Required if body contains `{{N}}` placeholders. Example: `[\"Jane\", \"10\"]`.","type":"string"},"file":{"description":"Optional header image file. Accepted formats: `jpeg`, `jpg`, `png`.","type":"string","format":"binary"}},"required":["name","category","language","body","inbox_id"]}}}},"responses":{"200":{"description":"Successful response"},"400":{"description":"Bad request — check required fields and formats."},"401":{"description":"Unauthorized — API key is missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Delete template by wa\_template\_id

> Delete a specific WhatsApp template by its \`wa\_template\_id\`.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Create, sync, send, and delete WhatsApp Business message templates."}],"servers":[{"url":"https://api.cekat.ai","description":"Production server"},{"url":"http://localhost:3000","description":"Local development server"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your Cekat API key. Obtain this by calling `POST /register` or from your Cekat dashboard under Settings → API."}}},"paths":{"/templates":{"delete":{"summary":"Delete template by wa_template_id","tags":["Templates"],"operationId":"Templates_Delete_template_by_wa_template_id","description":"Delete a specific WhatsApp template by its `wa_template_id`.","responses":{"200":{"description":"Successful response"},"400":{"description":"Bad request — check required fields and formats."},"401":{"description":"Unauthorized — API key is missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Template Sync

> Synchronize WhatsApp templates from the Meta server to Cekat. Use this after creating or modifying templates directly in Meta Business Manager.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Create, sync, send, and delete WhatsApp Business message templates."}],"servers":[{"url":"https://api.cekat.ai","description":"Production server"},{"url":"http://localhost:3000","description":"Local development server"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your Cekat API key. Obtain this by calling `POST /register` or from your Cekat dashboard under Settings → API."}}},"paths":{"/templates/sync":{"post":{"summary":"Template Sync","tags":["Templates"],"operationId":"Templates_Template_Sync","description":"Synchronize WhatsApp templates from the Meta server to Cekat. Use this after creating or modifying templates directly in Meta Business Manager.","parameters":[{"name":"inbox_id","in":"query","required":false,"description":"UUID of the WhatsApp Business inbox this template belongs to. Obtainable via the `GET /inboxes` endpoint.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"description":"Bad request — check required fields and formats."},"401":{"description":"Unauthorized — API key is missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Send template

> Send an approved WhatsApp template message to a contact. Only templates with status \`APPROVED\` will be processed.

```json
{"openapi":"3.0.3","info":{"title":"Cekat Open API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Create, sync, send, and delete WhatsApp Business message templates."}],"servers":[{"url":"https://api.cekat.ai","description":"Production server"},{"url":"http://localhost:3000","description":"Local development server"}],"security":[{"CekatApiKey":[]}],"components":{"securitySchemes":{"CekatApiKey":{"type":"apiKey","in":"header","name":"api_key","description":"Your Cekat API key. Obtain this by calling `POST /register` or from your Cekat dashboard under Settings → API."}}},"paths":{"/templates/send":{"post":{"summary":"Send template","tags":["Templates"],"operationId":"Templates_Send_template","description":"Send an approved WhatsApp template message to a contact. Only templates with status `APPROVED` will be processed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wa_template_id":{"type":"string","description":"The WhatsApp template ID. Obtainable via `GET /templates`."},"inbox_id":{"type":"string","description":"UUID of the WhatsApp Business inbox this template belongs to. Obtainable via the `GET /inboxes` endpoint."},"phone_number":{"type":"string","description":"Business phone number in international format, e.g. `6285695209520`."},"phone_name":{"type":"string","description":"Display name of the recipient."}}}}}},"responses":{"200":{"description":"Successful response"},"400":{"description":"Bad request — check required fields and formats."},"401":{"description":"Unauthorized — API key is missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```
