Skip to the documentation
API

Update a template

Metadata is patched in place. Touching the body of a published template mints a new draft.

PATCHapi.openemail.uk/templates/{id}

Runs the real call against your workspace, with your own key.

PATCH /templates/{id}

Metadata is patched in place. Touching the body of a published template mints a new draft.

Example

Needs templates:write. name, description and status are metadata; subject, document, html, slots, props and engine are the body, and sending any of them is what mints a version.

curl
curl -X PATCH "$OE/templates/order-shipped" -H "$AUTH" -H "Content-Type: application/json" \  -d '{    "html": "<p>Hello {{customer}}, {{orderId}} is on its way.</p>",    "expectedVersion": 4  }'
Response
{  "object": "template",  "id": "tpl_9c1f0a4b7e05d3862c1f0a44",  "publishedVersion": 3,  "latestVersion": 5,  "latest": { "object": "template_version", "version": 5, "state": "draft", "publishedAt": null }}

The new draft is not sendable and nothing live has moved: sends keep resolving version 3 until you publish. That is the whole reason the edit does not happen in place.

expectedVersion is the version you read before editing. Supply it and a concurrent edit is a 409 version_conflict instead of a silent overwrite; omit it and the last write wins, which is fine for one person in one tab and wrong for a script.

status: "archived" takes a template out of the list without deleting it. An archived template still resolves for a send that names it. Archiving is a tidying-up, not a kill switch.