Skip to content

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

FieldTypeRequiredDescription
actionstringNoGlobal action: enable or disable. Can be omitted if each item defines its own.
templatesarrayYesList 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

FieldTypeDescription
idstringTemplate ID.
actionstringProcessed or attempted action.
successbooleantrue if the change was applied.
skippedbooleantrue if the item was discarded without touching the DB (duplicate or conflict).
reasonstringReason for success: false or skipped: true.
previous_active / current_activebooleanState 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 id repeats with the same action, only the first occurrence is processed; the rest are returned with skipped: true and reason: duplicate_request.
  • If the same id appears with different actions (global + override, or two items with different actions), none of that id’s occurrences are processed: all return success: false and reason: conflicting_action, with no database write.

Errors

CodeCase
400Empty templates, invalid action, or item without a resolvable action
403Cross-client without BSP_CN