Skip to content

Switch an e-mail template on or off

PATCH /program/emails/{type}
Scopeprogram:write
Customer session tokenNot accepted: call from your server with an API key
Rate limit classwrite (limits)
Idempotency keyRequired (idempotency)
MCP toolcharm_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.

NameInTypeDescription
typepathstringThe template id from GET /program/emails.
FieldTypeDescription
enabledboolean
dry_runbooleanPreview 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_revisionintegerThe 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)

Returns EmailTemplateWriteResult.

FieldTypeDescription
dry_runboolean
revisioninteger
operationstring: update, none
diffarray of FieldChange
summarystring or null(nullable)
email_templateEmailTemplate
emails_enabledboolean
reachobject
{
"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
}
}
Terminal window
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}'

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.