Skip to content

Change an e-mail template's text

PATCH /program/emails/{type}/copy
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_copy

Changes some fields of one customer e-mail’s text, logged in the program changes. copy is the shop’s primary language, translations its other languages; a string sets the line ("" sends it blank), null puts Charm’s default back. Keep the {{placeholders}} the default line uses. Text with a link in it is refused, as in the admin editor. Campaign e-mails are edited with their campaign. Call with dry_run: true first and show the merchant the diff.

NameInTypeDescription
typepathstringThe template id from GET /program/emails.
FieldTypeDescription
copyobjectField → text in the shop’s primary language; fields from GET /program/emails/{type}/copy. (optional)
translationsobjectLanguage → field → text, for the shop’s other languages. (optional)
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 EmailTemplateCopyWriteResult.

FieldTypeDescription
dry_runboolean
revisioninteger
operationstring: update, none
diffarray of FieldChange
typestring
namestring
primary_languagestring or null(nullable)
languagesarray of string
fieldsarray of string
copyobject
translationsobject
{
"dry_run": false,
"revision": 1,
"operation": "update",
"diff": [
{
"path": "path",
"before": null,
"after": null
}
],
"type": "earn",
"name": "Gold",
"primary_language": "primary language",
"languages": [
"languages"
],
"fields": [
"fields"
],
"copy": {},
"translations": {}
}
Terminal window
curl -X PATCH "https://charm.appfleece.app/api/v1/program/emails/<type>/copy" \
-H "Authorization: Bearer chrm_live_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'

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.