Skip to main content
The email-messages command lets you view and edit the email message of a campaign, a workflow email, or a transactional email. Email messages are created automatically when you create a campaign. Use this command when you want to keep email content in Git as .lmx files, review changes locally, and push updates to a draft email message with revision protection.

get

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

guardian

Run Guardian content validation on an email message. See Run Guardian checks for the checks performed and the response format.

preview

Send a test preview of an email message to the addresses passed in --email. The variable fields accepted depend on the parent type:
  • Campaign previews accept --contact-prop.
  • Workflow previews accept --contact-prop and --event-prop.
  • Transactional previews accept --var and --json-vars.

Flags

update

Update fields on a draft email message. The update is rejected when:
  • The owning campaign is not in Draft status.
  • The owning workflow is sending.
  • The email message is the published version of a transactional email.

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 inline with --lmx or from a file with --lmx-file:
Campaign and workflow emails can use a custom footer. Transactional emails and critical notices do not have a footer. Pass the ID of a published footer with --footer-id:
Pass --default-footer to remove the custom footer and use the Loops system default footer. email-messages get shows footerId when the email uses a custom footer.

Git workflow

For a safer file-based workflow:
  1. Run loops email-messages get <email-message-id> and save the current LMX in your repository.
  2. Commit the .lmx file or review it in a branch.
  3. Update the draft email with --lmx-file and the latest --expected-revision-id.
  4. Save the returned contentRevisionId before making another update.
Use --force only when you intentionally want to overwrite the latest draft content.

Flags

At least one flag other than --expected-revision-id and --force must be provided.
Last modified on November 24, 2026