> ## 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.

# Email messages

> Get and update draft email messages.

<Warning>
  Content API endpoints are currently in an open alpha and are subject to
  change.
</Warning>

The `email-messages` command lets you view and edit the email message attached to a campaign. Email messages are created automatically when you [create a campaign](/cli/campaigns#create).

## `get`

Get an email message by ID, including its current content and `contentRevisionId`.

```bash theme={"dark"}
loops email-messages get clx1234abc
```

## `update`

Update fields on a draft email message. The owning campaign must be in `Draft` status.

```bash theme={"dark"}
loops email-messages update clx1234abc \
  --expected-revision-id rev_01h... \
  --subject "Welcome to Acme" \
  --preview-text "Here's how to get started" \
  --lmx-file ./email.lmx
```

### Concurrency control

Every update must include either `--expected-revision-id` or `--force`:

* `--expected-revision-id` — pass the `contentRevisionId` from a prior `email-messages get`. The request is rejected with a conflict if the server's revision has advanced, so you don't overwrite a concurrent edit.
* `--force` — fetch the current revision automatically and use it. This overwrites any concurrent edits.

### Setting content

Pass [LMX](/creating-emails/lmx) inline with `--lmx` or from a file with `--lmx-file`:

```bash theme={"dark"}
loops email-messages update clx1234abc \
  --force \
  --lmx-file ./email.lmx
```

### Flags

| Flag                     | Short | Description                                                                                                            |
| ------------------------ | ----- | ---------------------------------------------------------------------------------------------------------------------- |
| `--expected-revision-id` | `-r`  | Last-seen `contentRevisionId` from `email-messages get`. Mutually exclusive with `--force`.                            |
| `--force`                | `-f`  | Fetch the current revision and use it (overwrites concurrent edits). Mutually exclusive with `--expected-revision-id`. |
| `--subject`              |       | Email subject                                                                                                          |
| `--preview-text`         |       | Email preview text                                                                                                     |
| `--from-name`            |       | Sender display name                                                                                                    |
| `--from-email`           |       | Sender username (the part before `@` — the team's sending domain is appended automatically)                            |
| `--reply-to`             |       | Reply-to email address                                                                                                 |
| `--lmx`                  |       | [LMX](/creating-emails/lmx) markup (inline). Mutually exclusive with `--lmx-file`.                                     |
| `--lmx-file`             |       | Path to a file containing [LMX](/creating-emails/lmx) markup. Mutually exclusive with `--lmx`.                         |

At least one content flag (`--subject`, `--preview-text`, `--from-name`, `--from-email`, `--reply-to`, `--lmx`, or `--lmx-file`) must be provided.
