Change an e-mail template's text
PATCH /program/emails/{type}/copy| 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_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.
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 |
|---|---|---|
copy | object | Field → text in the shop’s primary language; fields from GET /program/emails/{type}/copy. (optional) |
translations | object | Language → field → text, for the shop’s other languages. (optional) |
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 EmailTemplateCopyWriteResult.
| Field | Type | Description |
|---|---|---|
dry_run | boolean | |
revision | integer | |
operation | string: update, none | |
diff | array of FieldChange | |
type | string | |
name | string | |
primary_language | string or null | (nullable) |
languages | array of string | |
fields | array of string | |
copy | object | |
translations | object |
{ "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": {}}Example
Section titled “Example”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 '{}'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.