Edit template
Updates an existing template. After the edit, the template returns to PENDING for Meta review.
Endpoint: PUT /v1/templates/{did}/{messageTemplateId}
Parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
did | string | Yes | Target ID. |
messageTemplateId | string | Yes | Template ID. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Template name. |
language | string | No | Language code. |
category | string | No | Template category. |
components | array | Yes | Full components (replaced, no merge). |
client_id | number | No | Client (requires BSP_CN for another client). |
allow_button_url_change | boolean | No | Allows migrating URL buttons. |
optimization_spec | object | No | Bid cap (max price). |
Only
components is strictly required. name and language cannot be changed when editing: the API ignores them for Meta. If the template is APPROVED, the category cannot be changed either.Request
curl --request PUT \
--url 'https://api.chattigo.com/v1/templates/{did}/{messageTemplateId}' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"category": "MARKETING",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Sale {{1}}",
"example": { "header_text": ["Summer"] }
},
{
"type": "BODY",
"text": "Get {{1}} off",
"example": { "body_text": [["50%"]] }
}
]
}'Response
Success (200)
{
"success": true,
"changed": true
}No changes (200)
If the edit introduces no real changes (e.g. same header_handle), the API detects differs()=false, skips the Meta PATCH and responds with changed: false and a message:
{
"success": true,
"changed": false,
"message": "No changes detected — template already up to date"
}The changed field lets you tell a “no-op” 200 (nothing was touched) apart from one where the template was actually updated in Meta.
Errors
| Code | Case |
|---|---|
400 | Failed edit rules or examples validation |
403 | DID outside the hierarchy, or access to another client without BSP_CN |
502 | External service unreachable |