---
title: Hosted templates | SendHQ Docs
description: Create typed drafts, preview exact output, publish immutable releases, and preserve send provenance.
canonical: https://sendhq.cc/docs/templates
last-updated: 2026-09-07
---
# Hosted templates

Create typed drafts, preview exact output, publish immutable releases, and preserve send provenance.

## Lifecycle

A template has a stable ID and key, one editable draft, zero or more immutable published releases, and an active or archived lifecycle. Archiving prevents new key-based sends without deleting historical releases or usage.

## Variables

Declare variables with keys, types, required state, and optional defaults. Rendering fails with `422` when supplied data does not satisfy the published contract. Inserted values are escaped by context.

## Optimistic autosave

Each draft carries a revision. Send the current revision to `PUT /templates/:id/draft`. If another editor saved first, SendHQ returns `409`; reload before overwriting.

## Preview, test, publish

1. Render with representative sample data.
2. Resolve every error finding.
3. Send a test snapshot to an address you control.
4. Publish the exact draft as an immutable release.

## Send by key

```json
{
  "from": "hello@example.com",
  "to": [
    "customer@example.net"
  ],
  "template": {
    "key": "account-welcome",
    "data": {
      "first_name": "Asha"
    }
  }
}
```

A personalized template send requires exactly one To recipient and no Cc or Bcc. Use the batch endpoint for individualized recipients.

## Provenance

Every template send records the template, release, compiler version, and rendered-content hash so an historical message can be traced to the content that produced it.
