# `bird email templates preview`

## Usage

```bash
bird email templates preview <template-ref> [flags]
```

## Description

Render a template with sample values

Returns the subject and the HTML and plain-text bodies a send would deliver, so
you can check a draft before submitting it. Renders the draft by default; pass
--version to render a published version instead. Works for your own templates and
for Bird's built-in ones. Nothing is sent and nothing is changed.

Build the request from the &lt;template_ref> argument and flags, a JSON EmailTemplatePreviewRequest 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.

## Examples

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

# the body it prints:
```

```json
{
  "language": "pt-BR",
  "parameters": {
    "animal": "otter",
    "bird": {
      "contact": {
        "first_name": "Ada"
      }
    }
  },
  "version": "emv_01krdgeqcxet5s7t44vh8rt9mg"
}
```

```bash
# render the draft with one variable filled in
bird email templates preview welcome-email --parameters '{"first_name":"Ada"}'

# render a published version in Brazilian Portuguese
bird email templates preview welcome-email --version emv_01krdgeqcxet5s7t44vh8rt9mh --language pt-BR
```

## Options

#### 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                                                                                                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--parameters`      | Sample values for the template's variables, as a JSON object (e.g. {"first_name":"Ada"})                                                                                            |
| `--language`        | Which of the template's languages to render. Omit it to render the default; the template's on_missing_language decides what an absent language does, exactly as it would on a send. |
| `--version`         | Preview a published version by its id instead of the current draft.                                                                                                                 |
| `--response-schema` | Print the fields this command returns, then exit                                                                                                                                    |

## Related

| Name                                                                              | Description                                           |
| --------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [`bird email templates create`](/docs/cli/reference/email-templates-create)       | Create an email template and its first editable draft |
| [`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 update`](/docs/cli/reference/email-templates-update)       | Update an email template                              |