# `bird email templates create`

## Usage

```bash
bird email templates create <slug> [flags]
```

## Description

Create an email template and its first editable draft

The slug is the permanent, workspace-unique handle a send names the template by;
it cannot be changed later. Nothing a draft holds is sendable until it is submitted
with "bird email templates versions submit".

This creates an empty draft. Add content one language at a time with
"bird email templates versions languages set", which is also how you edit it later.
To seed content at creation instead, pass the whole wire body with --body-file: the
"languages" object maps a BCP-47 tag to that language's {subject, html, text}, a
shape no flag can express.

Build the request from the &lt;slug> argument and flags, a JSON EmailTemplateCreate body via
--body-file ("-" reads stdin), or both — an inline value overrides the matching
body field. Run --example to print a ready-to-edit body, or --dry-run to print
the resolved request without sending it.

## Procedure

Step 1 of 3 of "Author a template and make it sendable". Next: bird email templates versions languages set.

## Examples

```bash
# print the body shape (no credentials needed)
bird email templates create --example

# the body it prints:
```

```json
{
  "category": "transactional",
  "default_language": "en",
  "description": "Sent to new customers after signup.",
  "languages": {
    "en": {
      "html": "<h1>Hi {{ bird.contact.first_name }}</h1>",
      "subject": "Welcome to Acme, {{ bird.contact.first_name }}!"
    }
  },
  "name": "Welcome email",
  "on_missing_language": "fallback",
  "slug": "welcome-email",
  "source": "html"
}
```

```bash
# create an empty draft, then author its English content
bird email templates create welcome-email --category marketing --source html

# seed the draft's content at creation
bird email templates create welcome-email --category marketing --source html --body-file body.json
```

## Options

#### Identity

| Name            | Description                                                                                               |
| --------------- | --------------------------------------------------------------------------------------------------------- |
| `--name`        | Display name shown wherever the template is listed. Free text, changeable any time; defaults to the slug. |
| `--description` | Optional description of the template's purpose.                                                           |
| `--category`    | Content classification: transactional or marketing. Fixed at creation.                                    |
| `--source`      | Authoring format the template is written in — currently html. Fixed at creation.                          |

#### Languages

| Name                         | Description                                                                                                                                            |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--default-language`         | Language a send uses when it names none, and the last resort when a requested language is unavailable. Must be one of the languages the draft carries. |
| `--on-missing-language`      | How a send behaves when it asks for a language the template does not carry: fallback (default) or fail.                                                |
| `--language-source-required` | Reject a send that names no language instead of serving the default. A template with this set cannot be used for a broadcast.                          |

#### Request

| Name                | Description                                                  |
| ------------------- | ------------------------------------------------------------ |
| `--body-file`       | Read the JSON request body from this file; "-" reads stdin   |
| `--example`         | Print a complete example request body, then exit             |
| `--dry-run`         | Print the resolved request without sending it, then exit     |
| `--idempotency-key` | Deduplication key; a retry with the same key won't act twice |

#### Options

| Name                | Description                                      |
| ------------------- | ------------------------------------------------ |
| `--response-schema` | Print the fields this command returns, then exit |

## Related

| Name                                                                              | Description                          |
| --------------------------------------------------------------------------------- | ------------------------------------ |
| [`bird email templates delete`](/docs/cli/reference/email-templates-delete)       | Delete an email template             |
| [`bird email templates duplicate`](/docs/cli/reference/email-templates-duplicate) | Duplicate an email template          |
| [`bird email templates get`](/docs/cli/reference/email-templates-get)             | Get an email template                |
| [`bird email templates list`](/docs/cli/reference/email-templates-list)           | List email templates                 |
| [`bird email templates preview`](/docs/cli/reference/email-templates-preview)     | Render a template with sample values |
| [`bird email templates update`](/docs/cli/reference/email-templates-update)       | Update an email template             |