Update a template

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
FieldTypeDescription
idrequiredstring · path—
Request body5 fields
FieldTypeDescription
namestring—
subjectobject—
statusenumdraft | published—
htmlstringThe email body as HTML (compose with @unitpost/email `render()` or any HTML; `{{variables}}` fill at send). Pass exactly one of `html` or `text`.
textstringSimple 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
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
namerequiredstring—
subjectrequiredobject—
statusrequiredenumdraft | published—
htmlobject—
created_atrequiredstring—
updated_atrequiredstring—
200401404422

Search docs and guides

Search the docs and product guides.