# Templates

> Design an email once and reuse it in API sends, automations and campaigns. Aliases, versions, three editors, Temple variables and the Templates API.

A template stores an email's subject, sender details and content so you can design it once and reuse it. Build templates in the dashboard with a drag-and-drop, rich-text or HTML editor, or manage them through the API, then send them by alias and fill in the personal details at send time.

## How it works

1. **Create a template** in **Email Marketing → Templates** or with the API. Give it a name and an alias, such as `welcome-email`.
2. **Design the content** in one of three editors, with placeholders such as `{{first_name}}` where personal details go.
3. **Publish it.** The first template with a new alias is published automatically. Templates you add later with the same alias become draft versions that you publish when they're ready.
4. **Send it.** Call `POST /emails` with `"template": "welcome-email"` and a `variables` object. Emailit renders the published version with [Temple](/docs/templates/temple/) and sends it.

Because your code refers to the alias rather than a specific template, you can change the design and publish a new version without deploying code.

## What a template contains

| Field | Details |
| --- | --- |
| Name | A label for your team, up to 191 characters. |
| Alias | The identifier your code uses, up to 191 characters of `a–z`, `0–9`, `_` and `-`. All versions of a template share one alias. |
| Editor | **Dragit** (drag and drop), **Rich Text** or **HTML**. |
| Subject | The default subject line, up to 191 characters. It can contain placeholders. |
| From | The default sender, such as `Acme <hello@acme.com>`. |
| Reply-To | Optional reply address or addresses. |
| Content | The HTML body, an optional plain-text body (through the API) and, for Dragit templates, the design as Dragit JSON. |

## Where you can use templates

| Where | How it uses the template | Placeholders |
| --- | --- | --- |
| [Email API](/docs/email-api/send-email/#send-with-a-template) | `template` takes an alias (published version) or a `tem_` ID (that exact version). Subject, HTML, text and Reply-To come from the template unless the request overrides them. The request's `from` is always required. | [Temple](/docs/templates/temple/), filled from `variables` |
| [Automations](/docs/automations/steps/) | The **Send email** step sends a template. The template's From, subject and Reply-To are used unless the step overrides them. | Temple, filled from the contact and the trigger |
| [Campaigns](/docs/campaigns/create/) | **Choose from templates** copies a template's content into the campaign as a starting point. **Save as template** turns a campaign into a template. | [Campaign merge tags](/docs/campaigns/merge-tags/) |
| [SMTP relay](/docs/smtp/) | Not available. SMTP sends the message exactly as you built it. | None |

## What you can do

  - [Editors](/docs/templates/editors/): Create templates and design them with Dragit, Rich Text or HTML.
  - [Temple language](/docs/templates/temple/): Variables, defaults and conditionals, and where they're rendered.
  - [Versions](/docs/templates/versions/): Draft a new version under the same alias and publish it when ready.
  - [Import and export](/docs/templates/import-export/): Bring in Dragit JSON, HTML or ZIP packages, and export them again.

## Templates API

Manage templates from code with the [Templates API](/docs/api-reference/templates/):

| Endpoint | Purpose |
| --- | --- |
| [Create a template](/docs/api-reference/templates/create/) | Add a template or a new version of an existing alias. |
| [Retrieve a template](/docs/api-reference/templates/get/) | Get one version, including its content and the list of other versions. |
| [Update a template](/docs/api-reference/templates/update/) | Change a version's fields or content. |
| [List templates](/docs/api-reference/templates/list/) | List the published version of each alias. |
| [Publish a template](/docs/api-reference/templates/publish/) | Make a version the live one for its alias. |
| [Delete a template](/docs/api-reference/templates/delete/) | Delete one version. |

The API needs a **Full Access** key. Changes emit the `template.created`, `template.updated` and `template.deleted` webhook events. Importing and exporting files is available only in the dashboard.

## Availability

Templates are available on every plan at no extra cost. Storing templates doesn't use credits; each email you send with one is charged like any other send.

## Get started

  - [Create a template](/docs/templates/editors/#create-a-template): Set the name, alias and editor, then design it.
  - [Send with a template](/docs/email-api/send-email/#send-with-a-template): Send by alias with variables from your code.

---
Source: https://emailit.com/docs/templates/
