# Templates

## Make a template [#make-a-template]

1. **Email → Templates → New template**, then pick a starter or start blank.
2. Design in the editor. Changes save as you go, and teammates can edit with you at
   the same time.
3. Choose who it's **from**, and under **⋯ → Type and brand kit** whether it's
   **service** or **marketing** email.
4. **Publish.** A published version is what campaigns and code send. You can keep
   editing; your changes go out once you publish again.

Every publish is checked first: a sender with a verified domain, working links, no
empty image slots, a plain-text version, and an unsubscribe link in marketing
email.

## Personal values [#personal-values]

Write `{{contact.first_name}}` to fill in each person's details. Use **Preview as a
contact** to see the email as a specific person will.

## Variables for code [#variables-for-code]

When your app sends a template, it can pass values like an order number or a
sign-in link. Declare them under **⋯ → Variables**:

| Field | |
|---|---|
| Name | Like `order.total` or `magic_link`. Dots group values. |
| Type | Text, number, date or URL |
| Required | A send without it is refused |
| Fallback | Used when a send leaves it out |
| Example | Used in previews and code samples |

Then use them in the design: `{{order.total}}`, or as a link: `{{magic_link}}`.

## Send it from code [#send-it-from-code]

**⋯ → Developers** has what your code needs: copy the template ID, copy its alias
(a readable name like `order-shipped`), or copy a ready send request.
**Use from code** sets the alias and shows the request in several languages. See
[Templates from code](/docs/developers/templates).

## Versions [#versions]

**⋯ → Version history** lists every published version. A send records exactly which
version it used.
