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

# Update an email message

> Update an email message's subject, preview text, sender, or LMX content.

Supply `expectedRevisionId` matching the current `contentRevisionId`.

<Info>The campaign or transactional email that owns this email message must be in `Draft` status..</Info>


## OpenAPI

````yaml /openapi.json post /v1/email-messages/{emailMessageId}
openapi: 3.1.0
info:
  title: Loops OpenAPI Spec
  description: This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
  version: 1.21.0
servers:
  - url: https://app.loops.so/api
security: []
tags:
  - name: API key
  - name: Audience segments
    description: View audience segments
  - name: Campaigns
    description: Create and manage email campaigns
  - name: Campaign groups
    description: Organize campaigns into groups
  - name: Components
    description: View email components
  - name: Configuration
    description: View configuration settings
  - name: Contacts
    description: Manage contacts in your audience
  - name: Contact properties
    description: Manage contact properties
  - name: Email messages
    description: Manage email message content for campaigns
  - name: Events
    description: Trigger workflows with events
  - name: Event patterns
    description: View workflow event patterns
  - name: Mailing lists
    description: View mailing lists
  - name: Themes
    description: View email themes
  - name: Transactional emails
    description: Create, manage, and send transactional emails
  - name: Transactional groups
    description: Organize transactional emails into groups
  - name: Uploads
    description: Upload image assets
  - name: Workflows
    description: View and mutate workflow graphs
  - name: Workflow nodes
    description: View and mutate workflow nodes
paths:
  /v1/email-messages/{emailMessageId}:
    parameters:
      - name: emailMessageId
        in: path
        required: true
        description: The ID of the email message.
        schema:
          type: string
    post:
      tags:
        - Email messages
      summary: Update an email message
      description: >-
        Update fields on an email message (subject, preview text, sender, LMX
        content). The campaign must be in draft status. Supply
        `expectedRevisionId` matching the current `contentRevisionId` — the
        server rejects mismatched revisions with 409.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEmailMessageRequest'
      responses:
        '200':
          description: Email message updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageResponse'
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageFailureResponse'
        '401':
          description: Invalid API key or content API not enabled for this team.
        '404':
          description: Email message not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageFailureResponse'
        '405':
          description: Wrong HTTP request method.
        '409':
          description: >-
            Campaign is not in draft status, `contentRevisionId` is stale,
            content cannot be parsed, or email message uses MJML format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageFailureResponse'
        '413':
          description: LMX payload exceeds the 100KB limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageFailureResponse'
        '422':
          description: LMX failed to compile.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageFailureResponse'
      security:
        - apiKey: []
components:
  schemas:
    UpdateEmailMessageRequest:
      type: object
      properties:
        expectedRevisionId:
          type: string
          description: >-
            The `contentRevisionId` you last fetched, or the
            `emailMessageContentRevisionId` you received when creating the
            campaign.
        subject:
          type: string
        previewText:
          type: string
        fromName:
          type: string
        fromEmail:
          type: string
          description: >-
            The sender username (without `@` or domain). The team's sending
            domain is appended automatically.
        replyToEmail:
          type: string
          description: Reply-to email. Must be empty or a valid email address.
        ccEmail:
          type: string
          description: CC email address. Requires the team to have CC/BCC enabled.
        bccEmail:
          type: string
          description: BCC email address. Requires the team to have CC/BCC enabled.
        languageCode:
          type: string
          description: >-
            Language code for the email. Requires translation to be enabled for
            the team.
        emailFormat:
          type: string
          enum:
            - styled
            - plain
          description: The rendering format of the email.
        lmx:
          type: string
          description: >-
            The email body serialized as LMX. Styles must be embedded in the LMX
            `<Style />` tag.
        contactPropertiesFallbacks:
          type: object
          description: >-
            Fallback values for contact properties, keyed by property name.
            Per-key merge: a string value sets the fallback, a null value
            deletes it, and keys omitted from the map are left unchanged.
          additionalProperties:
            type:
              - string
              - 'null'
        eventPropertiesFallbacks:
          type: object
          description: >-
            Fallback values for event properties, keyed by property name.
            Per-key merge: a string value sets the fallback, a null value
            deletes it, and keys omitted from the map are left unchanged.
          additionalProperties:
            type:
              - string
              - 'null'
        dataVariablesFallbacks:
          type: object
          description: >-
            Fallback values for data variables, keyed by variable name. Per-key
            merge: a string value sets the fallback, a null value deletes it,
            and keys omitted from the map are left unchanged.
          additionalProperties:
            type:
              - string
              - 'null'
      additionalProperties: false
    EmailMessageResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the email message.
        campaignId:
          type: string
          description: >-
            The campaign this email message belongs to. Present only when the
            message belongs to a campaign (mutually exclusive with
            `transactionalId`).
        transactionalId:
          type: string
          description: >-
            The transactional email this email message belongs to. Present only
            when the message belongs to a transactional email (mutually
            exclusive with `campaignId`).
        subject:
          type: string
          description: The email subject.
        previewText:
          type: string
          description: The email preview text.
        fromName:
          type: string
          description: The email sender name.
        fromEmail:
          type: string
          description: The email sender email address.
        replyToEmail:
          type: string
          description: The email reply-to address.
        ccEmail:
          type: string
          description: The email CC address. Only present when set.
        bccEmail:
          type: string
          description: The email BCC address. Only present when set.
        languageCode:
          type: string
          description: Only present when set.
        emailFormat:
          type: string
          enum:
            - styled
            - plain
          description: The rendering format of the email.
        lmx:
          type: string
          description: The email body serialized as LMX.
        contentRevisionId:
          type:
            - string
            - 'null'
          description: >-
            The current content revision. Pass this as `expectedRevisionId` on
            your next update.
        updatedAt:
          type: string
          format: date-time
        contactPropertiesFallbacks:
          type: object
          description: Fallback values for contact properties. Only present when set.
          additionalProperties:
            type: string
        eventPropertiesFallbacks:
          type: object
          description: Fallback values for event properties. Only present when set.
          additionalProperties:
            type: string
        dataVariablesFallbacks:
          type: object
          description: Fallback values for data variables. Only present when set.
          additionalProperties:
            type: string
        warnings:
          type: array
          description: >-
            Non-fatal issues raised while compiling the submitted LMX. Only
            present on update responses when warnings were produced.
          items:
            type: object
            properties:
              rule:
                type: string
              severity:
                type: string
                enum:
                  - warning
              message:
                type: string
              path:
                type: string
            required:
              - rule
              - severity
              - message
      required:
        - id
        - subject
        - previewText
        - fromName
        - fromEmail
        - replyToEmail
        - emailFormat
        - lmx
        - contentRevisionId
        - updatedAt
    EmailMessageFailureResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

## Related topics

- [Workflows API examples](/docs/api-reference/examples/workflows.md)
- [LMX](/docs/creating-emails/lmx.md)
- [API Introduction](/docs/api-reference/intro.md)
- [Create a transactional email](/docs/api-reference/create-transactional-email.md)
- [Email messages](/docs/cli/email-messages.md)
