Switch an e-mail template on or off
PATCH /program/emails/{type}| Scope | program:write |
| Customer session token | Not accepted: call from your server with an API key |
| Rate limit class | write (limits) |
| Idempotency key | Required (idempotency) |
| MCP tool | charm_update_email_template |
Switches one customer e-mail on or off. The dry run answers how many members have an e-mail address (reach). The global e-mail switch stays in the admin; while it is off a template switched on sends nothing yet. Campaign e-mails are switched per campaign, the launch announcement from the launch wizard. Call with dry_run: true first.
Parameters
Section titled “Parameters”| Name | In | Type | Description |
|---|---|---|---|
type | path | string | The template id from GET /program/emails. |
Request body
Section titled “Request body”| Field | Type | Description |
|---|---|---|
enabled | boolean | |
dry_run | boolean | Preview only: validate, resolve references and return the diff and summary, but write nothing. Costs no idempotency key and is limited as a read. Call with this first, show the merchant, then repeat without it. (optional) |
if_revision | integer | The program revision you last read (from GET /program or a previous write). When the program changed since, the write is refused with 409 revision_conflict instead of overwriting a concurrent admin edit. (optional) |
Response 200
Section titled “Response 200”Returns EmailTemplateWriteResult.
| Field | Type | Description |
|---|---|---|
dry_run | boolean | |
revision | integer | |
operation | string: update, none | |
diff | array of FieldChange | |
summary | string or null | (nullable) |
email_template | EmailTemplate | |
emails_enabled | boolean | |
reach | object |
{ "dry_run": false, "revision": 1, "operation": "update", "diff": [ { "path": "path", "before": null, "after": null } ], "summary": "summary", "email_template": { "type": "earn", "name": "Gold", "description": "Points for order #1042", "sends_when": "sends when", "enabled": true, "sends": false, "toggleable": false }, "emails_enabled": false, "reach": { "members_with_email": 1 }}Example
Section titled “Example”curl -X PATCH "https://charm.appfleece.app/api/v1/program/emails/<type>" \ -H "Authorization: Bearer chrm_live_..." \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"enabled":true}'Errors
Section titled “Errors”unauthorized · invalid_token · insufficient_scope · access_required · not_found · validation_error · rate_limited · idempotency_conflict
Every error body carries code, message, request_id and a doc_url pointing at the matching entry in the error catalog.