Bulk status change
Enables or disables multiple templates in a single request. Users with BSP_CN can operate across clients.
Endpoint: PATCH /v1/templates/status
Body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | No | Global action: enable or disable. Can be omitted if each item defines its own. |
templates | array | Yes | List of IDs or {id, action} objects. |
templates format
Each item can be:
- A string:
"id_template_1"(uses the global action). - An object:
{"id": "id_template_2", "action": "disable"}(per-item override).
Request
Global action
curl --request PATCH \
--url 'https://api.chattigo.com/v1/templates/status' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"action": "enable",
"templates": ["id_template_1", "id_template_2"]
}'Mixed action (global + override)
curl --request PATCH \
--url 'https://api.chattigo.com/v1/templates/status' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"action": "enable",
"templates": [
"id_template_1",
{ "id": "id_template_2", "action": "disable" }
]
}'Per-item action (no global)
curl --request PATCH \
--url 'https://api.chattigo.com/v1/templates/status' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"templates": [
{ "id": "id_template_1", "action": "enable" },
{ "id": "id_template_2", "action": "disable" }
]
}'Response
Success (200)
{
"results": [
{
"id": "664a1b2c3d4e5f6000000001",
"action": "enable",
"success": true,
"previous_active": false,
"current_active": true
},
{
"id": "664b1b2c3d4e5f6000000002",
"action": "enable",
"success": false,
"reason": "template_not_approved"
},
{
"id": "664b1b2c3d4e5f6000000002",
"action": "disable",
"skipped": true,
"reason": "conflicting_action"
}
],
"summary": {
"total": 3,
"succeeded": 1,
"skipped": 1,
"failed": 1
}
}Per-item fields
| Field | Type | Description |
|---|---|---|
id | string | Template ID. |
action | string | Processed or attempted action. |
success | boolean | true if the change was applied. |
skipped | boolean | true if the item was discarded without touching the DB (duplicate or conflict). |
reason | string | Reason for success: false or skipped: true. |
previous_active / current_active | boolean | State before/after (success only). |
Possible reason values
not_found, forbidden, already_enabled, already_disabled, channel_unassigned, campaign_unassigned, template_not_approved.
Duplicates and conflicts
- If the same
idrepeats with the same action, only the first occurrence is processed; the rest are returned withskipped: trueandreason: duplicate_request. - If the same
idappears with different actions (global + override, or two items with different actions), none of that id’s occurrences are processed: all returnsuccess: falseandreason: conflicting_action, with no database write.
Errors
| Code | Case |
|---|---|
400 | Empty templates, invalid action, or item without a resolvable action |
403 | Cross-client without BSP_CN |