Restore a template version

Restore a template version

POST/api/v1/email/templates/{id}/versions/{version}/restore

POST /email/templates/{id}/versions/{version}/restore
curl -X POST 'https://www.unitpost.com/api/v1/email/templates/tmpl_123/versions/3/restore' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "status": "draft",
  "editor": "simple",
  "kind": "simple",
  "preview_text": "string",
  "category": "transactional",
  "html": "string",
  "tsx": "string",
  "text": "string",
  "warnings": [
    "string"
  ],
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Put a version's subject and body back, as the dashboard's version restore does. It is an update, so the update rules apply: a system template, or one a live campaign renders, is a 409 naming why (Get a template's usage says so up front). On a published template the restore adds a new version; history is never rewritten. Takes no body. Requires the templates:write capability.

Parameters2 fields
FieldTypeDescription
idrequiredstring · path—
versionrequiredinteger · pathA `version` from the template's history.
Response · 200 fields15 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
namerequiredstring—
subjectrequiredstring | null—
statusrequiredenumdraft | published—
editorenumsimple | design | codeWhich editor this template is authored in — and so which body field updates it. `design`: built from @unitpost/email components (the dashboard's Design tab) — update with `tsx`. `simple`: a plain, personal Gmail-style email (the Simple tab) — update with `text`. `code`: raw HTML (the Code tab) — update with `html`. Keep the editor unless the user asked to switch; to switch, send the other body field or `editor` alone to convert the current body.
kindrequiredenumsimple | designedThe coarse kind: `simple` (editor `simple`) or `designed` (editor `design` or `code`). Prefer `editor`.
preview_textstringInbox preview text: the snippet most inboxes show after the subject. Empty when unset.
categoryenumtransactional | marketing`marketing` (a campaign can send it; it gets the unsubscribe footer at send) or `transactional` (receipts, sign-in codes, notifications: no footer, and campaigns refuse it). Change it with `category` on an update.
htmlstring | null—
tsxstring | nullA `design` template's body as @unitpost/email component TSX, wrapped in the `<Email …>` element that carries its theme, preview text and category — edit it and send it back as `tsx`. Null for `simple` and `code` templates. Present on single reads; omitted from list rows.
textstring | nullA `simple` template's body in the Simple `text` format: edit it and send it back as `text`. Null for `design` and `code` templates, and for a Simple email the format can't carry whole (an indented line): change that one in the dashboard, or send a whole new `text`. Present on single reads; omitted from list rows.
warningsstring[]Create or update only: what changed that you didn't write, in plain words — markup the Simple format removed from `text`, `<Email>` attributes or theme values that were ignored, what an `editor` conversion flattened or couldn't keep, a `tsx` write that switched the template's editor. Absent when nothing did. Tell the user.
created_atrequiredstring—
updated_atrequiredstring—
200400401403404409422

Search docs and guides

Search the docs and product guides.