Update a template
PATCH/api/v1/email/templates/{id}
PATCH /email/templates/{id}
curl -X PATCH 'https://www.unitpost.com/api/v1/email/templates/tmpl_123' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'User-Agent: my-app/1.0' \
-H 'Content-Type: application/json' \
-d '{
"subject": "Welcome aboard!"
}'Response · 200
{
"object": "template",
"id": "id_123",
"name": "Example",
"subject": "Welcome to Acme",
"status": "draft",
"html": "string",
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}Update a template's metadata and/or html. Changes take effect for future sends only — emails already sent or queued keep the body they were rendered with. Writing html switches the template to code mode. Read the current body first with Retrieve a template. Requires the templates:write capability.
Parameters1 field
| Field | Type | Description |
|---|---|---|
idrequired | string · path | — |
Request body5 fields
| Field | Type | Description |
|---|---|---|
name | string | — |
subject | object | — |
status | enumdraft | published | — |
html | string | The email body as HTML (compose with @unitpost/email `render()` or any HTML; `{{variables}}` fill at send). Pass exactly one of `html` or `text`. |
text | string | Simple email body instead of `html` — plain text exactly as you'd type it into Gmail: lines, a blank line between paragraphs, '- ' or '1. ' list items, and inline <b>, <i>, <u>, <a href="…"> for emphasis and links. No Markdown (it stays literal). Sent as a bare mail-client fragment with no layout or colours; marketing templates get a one-line unsubscribe footer at send time. Max 20,000 characters. Pass exactly one of `html` or `text`. |
Response · 200 fields8 fields
| Field | Type | Description |
|---|---|---|
objectrequired | string | — |
idrequired | string | — |
namerequired | string | — |
subjectrequired | object | — |
statusrequired | enumdraft | published | — |
html | object | — |
created_atrequired | string | — |
updated_atrequired | string | — |
200401404422