---
title: "Restore a historical version into the draft"
method: POST
path: "/templates/{id}/versions/{version}"
tags: ["Templates"]
---

# Restore a historical version into the draft

`POST /templates/{id}/versions/{version}`

## Request

- Base URL: `https://api.groundmail.dev`
- URL: `https://api.groundmail.dev/templates/{id}/versions/{version}`
- Auth: HTTP bearer

## Path parameters

- `id` string, required
- `version` integer, required

## Request body

- object
  - `action` 'restore', required

## Response `200`

Draft restored from version

- TemplateResponse
  - `template` Template, required
    - `id` string, uuid, required
    - `name` string, required
    - `alias` string, nullable, required: Optional unique alias per account (must not start with `gm_`)
    - `status` 'draft' | 'published', required
    - `format` 'html' | 'blocks', required: html is legacy raw HTML; blocks is the visual builder document
    - `subject` string, required
    - `preheader` string, nullable: Inbox preview text injected as a hidden preheader
    - `html` string, nullable, required
    - `text` string, nullable, required
    - `design` object, nullable: TemplateDocument JSON when format is blocks. `settings.globalCss` accepts author-supplied CSS; bare-tag rules (body, p, h1, h2, h3, a, img, hr) are inlined on render and everything else is emitted into a style block.
    - `variables` string[], nullable, required: Variable names used in subject/html/text (auto-extracted for blocks)
    - `published_version_id` string, uuid, nullable: Immutable version snapshot used for sends
    - `published_at` string, date-time, nullable, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `unsubscribe_enabled` boolean, required: When true, sends using this published template inherit managed unsubscribe unless overridden with `unsubscribe` on `POST /emails`.
    - `category` 'transactional' | 'product', required: Email category for preference management and sending. `transactional` is default and ignores category opt-outs. `product` supports category-scoped unsubscribe and is sent from a separate IP pool.
    - `folder` string, nullable, required: Name of the dashboard folder it is filed in, or null.
    - `warnings` TemplateLintWarning[]: Non-blocking deliverability hints for template HTML (e.g. SVG image URLs)
      - `code` 'svg_image' | 'relative_image_url' | 'data_uri_image' | 'missing_alt' | 'non_https_image' | 'empty_href' | 'raw_html_block' | 'low_contrast' | 'html_too_large', required
      - `message` string, required
      - `detail` string, nullable

## Other responses

- `400`: Invalid request
- `404`: Template or version not found

---

[API](https://skmtc.dev/groundmail/apis/groundmail-api.md) · [All operations](https://skmtc.dev/groundmail/apis/groundmail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/groundmail/apis/groundmail-api/revisions/479821c9fecf?raw)
