> ## Documentation Index
> Fetch the complete documentation index at: https://loops.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Transactional

> Send and manage transactional emails.

The `transactional` command lets you send and manage transactional emails. There is also a top-level `loops send` shortcut for quickly sending a transactional email.

## `send`

Send a transactional email.

```
loops transactional send <id> [--flags]
```

Example:

```bash theme={"dark"}
loops transactional send cmnx1d95z001llilji4vapgqs \
  --email test@example.com
```

Pass [data variables](/docs/transactional#data-variables) inline with `--var` or from a JSON file with `--json-vars`:

```bash theme={"dark"}
loops transactional send cmnx1d95z001llilji4vapgqs \
  --email test@example.com \
  --var name=Alice \
  --var company=Acme
```

```bash theme={"dark"}
loops transactional send cmnx1d95z001llilji4vapgqs \
  --email test@example.com \
  --json-vars ./vars.json
```

Add attachments with `--attachment`:

```bash theme={"dark"}
loops transactional send cmnx1d95z001llilji4vapgqs \
  --email test@example.com \
  --attachment ./attachment.pdf
```

### Flags

| Flag                | Short | Description                                                           |
| ------------------- | ----- | --------------------------------------------------------------------- |
| `--email`           |       | Recipient email address <Badge color="red" size="sm">Required</Badge> |
| `--var`             | `-v`  | Data variable as `KEY=value` (repeatable)                             |
| `--json-vars`       | `-j`  | Path to a JSON file of data variables                                 |
| `--attachment`      | `-A`  | Path to a file to attach (repeatable)                                 |
| `--add-to-audience` | `-a`  | Create a contact in your audience if one doesn't exist                |
| `--idempotency-key` |       | Idempotency key to prevent duplicate sends                            |

## `create`

Create a transactional email with an empty draft.

```bash theme={"dark"}
loops transactional create --name "Password reset"
```

Assign the email to a [transactional group](/docs/cli/transactional-groups) with `--transactional-group-id`:

```bash theme={"dark"}
loops transactional create \
  --name "Password reset" \
  --transactional-group-id cmqz4t8b0002mkabc9wxyz123
```

### Flags

| Flag                       | Short | Description                                                            |
| -------------------------- | ----- | ---------------------------------------------------------------------- |
| `--name`                   | `-n`  | Transactional email name <Badge color="red" size="sm">Required</Badge> |
| `--transactional-group-id` |       | Transactional group ID to assign this email to                         |

## `get`

Get a transactional email.

```bash theme={"dark"}
loops transactional get cmnx1d95z001llilji4vapgqs
```

## `draft`

Ensure a draft exists for a transactional email. If a draft already exists it is returned unchanged; otherwise a new empty draft is created (seeded from the most recent published version when present).

```bash theme={"dark"}
loops transactional draft cmnx1d95z001llilji4vapgqs
```

## `publish`

Publish the current draft of a transactional email.

```bash theme={"dark"}
loops transactional publish cmnx1d95z001llilji4vapgqs
```

## `update`

Update a transactional email's name or group.

To update the email's content, edit its related [email message](/docs/cli/email-messages).

```bash theme={"dark"}
loops transactional update cmnx1d95z001llilji4vapgqs \
  --name "Password reset email"
```

Move the email to another [transactional group](/docs/cli/transactional-groups) with `--transactional-group-id`:

```bash theme={"dark"}
loops transactional update cmnx1d95z001llilji4vapgqs \
  --transactional-group-id cmqz4t8b0002mkabc9wxyz123
```

### Flags

| Flag                       | Short | Description                                                            |
| -------------------------- | ----- | ---------------------------------------------------------------------- |
| `--name`                   | `-n`  | Transactional email name <Badge color="red" size="sm">Required</Badge> |
| `--transactional-group-id` |       | Move the email to this transactional group                             |

## `list`

List published transactional emails.

```bash theme={"dark"}
loops transactional list
```

Pass `--pick` to filter the list interactively with [fzf](https://github.com/junegunn/fzf) and copy the selected transactional ID to your clipboard. Requires `fzf` to be installed and on your `PATH`.

```bash theme={"dark"}
loops transactional list --pick
```

### Flags

| Flag         | Description                                                                                                                 |
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| `--pick`     | Interactively pick a transactional email and copy its ID to the clipboard. Requires [fzf](https://github.com/junegunn/fzf). |
| `--per-page` | Results per page (10–50, default 20)                                                                                        |
| `--cursor`   | Pagination cursor for a specific page                                                                                       |

## `loops send` shortcut

`loops send` is a top-level shortcut for `loops transactional send`. It accepts the same flags.

```
loops send <id> [--flags]
```

Example:

```bash theme={"dark"}
loops send cmnx1d95z001llilji4vapgqs \
  --email test@example.com \
  --var name=Alice
```


## Related topics

- [Types of emails](/docs/types-of-emails.md)
- [Transactional email](/docs/transactional.md)
- [Transactional groups](/docs/cli/transactional-groups.md)
- [Update a transactional email](/docs/api-reference/update-transactional-email.md)
- [Get a transactional email](/docs/api-reference/get-transactional-email.md)
