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

# updateEmailTemplate

> Update template metadata and/or apply section operations. Returns null if no owned template matches the id. Pass `input`, `operations`, or both.

**Required scopes:** [`marketing_templates_write`](/docs/api-reference/v3/reference/scopes#scope-marketing_templates_write)

## Arguments

<ResponseField name="id" type="ID!" required>
  The template's `id`, or its `legacyId` from an earlier version of the Redo API.
</ResponseField>

<ResponseField name="input" type={<a href="/docs/api-reference/v3/reference/marketing/update-email-template-input">UpdateEmailTemplateInput</a>}>
  Metadata fields to change.

  <Expandable title="fields" lazyRender>
    <ResponseField name="contentBackgroundColor" type="String">
      Content canvas background from Email styles.
    </ResponseField>

    <ResponseField name="emailBackgroundColor" type="String">
      Email background from Email styles.
    </ResponseField>

    <ResponseField name="linkColor" type="String">
      Default link color. Pass null to clear it.
    </ResponseField>

    <ResponseField name="name" type="String">
      The merchant-facing name of the template.
    </ResponseField>

    <ResponseField name="previewText" type="String">
      Inbox preview text. Pass null to clear it.
    </ResponseField>

    <ResponseField name="subject" type="String">
      The authored subject line.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="operations" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section-operation">[EmailTemplateSectionOperation!]</a>}>
  Surgical section edits, applied in order.

  <Expandable title="fields" lazyRender>
    <ResponseField name="insert" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section-insert-input">EmailTemplateSectionInsertInput</a>}>
      Insert a new section.

      <Expandable title="fields" lazyRender>
        <ResponseField name="after" type="ID">
          Insert immediately after this section id. Column children are not valid anchors. Omit after, before, and parent to insert last but above the footer.
        </ResponseField>

        <ResponseField name="before" type="ID">
          Insert immediately before this section id. Column children are not valid anchors.
        </ResponseField>

        <ResponseField name="button" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-button-section-input">EmailTemplateButtonSectionInput</a>}>
          Insert a button section.
        </ResponseField>

        <ResponseField name="chromeDino" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-chrome-dino-section-input">EmailTemplateChromeDinoSectionInput</a>}>
          Insert a Chrome dinosaur section.
        </ResponseField>

        <ResponseField name="column" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-column-section-input">EmailTemplateColumnSectionInput</a>}>
          Insert a column layout. Pass `columns` for the complete child list, or omit it for empty slots (columnCount, default 2).
        </ResponseField>

        <ResponseField name="discount" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-discount-section-input">EmailTemplateDiscountSectionInput</a>}>
          Insert a discount section.
        </ResponseField>

        <ResponseField name="footer" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-footer-section-input">EmailTemplateFooterSectionInput</a>}>
          Insert a footer section.
        </ResponseField>

        <ResponseField name="header" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-header-section-input">EmailTemplateHeaderSectionInput</a>}>
          Insert a header section.
        </ResponseField>

        <ResponseField name="html" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-html-section-input">EmailTemplateHtmlSectionInput</a>}>
          Insert an HTML section.
        </ResponseField>

        <ResponseField name="image" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-image-section-input">EmailTemplateImageSectionInput</a>}>
          Insert an image section.
        </ResponseField>

        <ResponseField name="index" type="Int">
          Deprecated. Do not send. Column children are a complete `columns` list; `parent` without this field still appends to an interactive-review success section.
        </ResponseField>

        <ResponseField name="line" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-line-section-input">EmailTemplateLineSectionInput</a>}>
          Insert a line section.
        </ResponseField>

        <ResponseField name="menu" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-menu-section-input">EmailTemplateMenuSectionInput</a>}>
          Insert a menu section.
        </ResponseField>

        <ResponseField name="parent" type="ID">
          An interactive-review id. Appends the inserted block to that review's success section. Cannot combine with after or before. Column children are not filled this way; pass `columns` on the column payload.
        </ResponseField>

        <ResponseField name="products" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-products-section-input">EmailTemplateProductsSectionInput</a>}>
          Insert a products section. The trigger must provide Cart Context. Not a column child. recommendedProductFilterId is a product filter id, or 00000000feedb10cfeedb10c when this trigger already carries products.
        </ResponseField>

        <ResponseField name="qrCode" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-qr-code-section-input">EmailTemplateQrCodeSectionInput</a>}>
          Insert a QR code section.
        </ResponseField>

        <ResponseField name="scratchToReveal" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-scratch-to-reveal-section-input">EmailTemplateScratchToRevealSectionInput</a>}>
          Insert a scratch-to-reveal section.
        </ResponseField>

        <ResponseField name="shoppableProducts" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-shoppable-products-section-input">EmailTemplateShoppableProductsSectionInput</a>}>
          Insert a shoppable products section. The trigger must provide Cart Context. Not a column child. productFilterId is a product filter id.
        </ResponseField>

        <ResponseField name="socials" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-socials-section-input">EmailTemplateSocialsSectionInput</a>}>
          Insert a socials section.
        </ResponseField>

        <ResponseField name="spacer" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-spacer-section-input">EmailTemplateSpacerSectionInput</a>}>
          Insert a spacer section.
        </ResponseField>

        <ResponseField name="subscriptionAddToOrder" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-add-to-order-section-input">EmailTemplateSubscriptionAddToOrderSectionInput</a>}>
          Insert a subscription add-to-order section.
        </ResponseField>

        <ResponseField name="subscriptionSkipOrDelay" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-skip-or-delay-section-input">EmailTemplateSubscriptionSkipOrDelaySectionInput</a>}>
          Insert a skip-or-delay section.
        </ResponseField>

        <ResponseField name="subscriptionSwapProduct" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-swap-product-section-input">EmailTemplateSubscriptionSwapProductSectionInput</a>}>
          Insert a subscription swap-product section.
        </ResponseField>

        <ResponseField name="table" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-table-section-input">EmailTemplateTableSectionInput</a>}>
          Insert a table section.
        </ResponseField>

        <ResponseField name="text" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-text-section-input">EmailTemplateTextSectionInput</a>}>
          Insert a text section.
        </ResponseField>

        <ResponseField name="trackableSummary" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-trackable-summary-section-input">EmailTemplateTrackableSummarySectionInput</a>}>
          Insert an order-summary section. The trigger must provide a Trackable Summary. Not a column child.
        </ResponseField>

        <ResponseField name="trackingInfo" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-tracking-info-section-input">EmailTemplateTrackingInfoSectionInput</a>}>
          Insert a tracking-info section. The trigger must provide a Tracker. Not a column child.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="move" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section-move-input">EmailTemplateSectionMoveInput</a>}>
      Move a section.

      <Expandable title="fields" lazyRender>
        <ResponseField name="after" type="ID">
          Place immediately after this section id.
        </ResponseField>

        <ResponseField name="before" type="ID">
          Place immediately before this section id.
        </ResponseField>

        <ResponseField name="id" type="ID!" required>
          The section to move.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="remove" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section-remove-input">EmailTemplateSectionRemoveInput</a>}>
      Remove a section.

      <Expandable title="fields" lazyRender>
        <ResponseField name="id" type="ID!" required>
          The section's id (`blockId`).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="update" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section-update-input">EmailTemplateSectionUpdateInput</a>}>
      Patch an existing section.

      <Expandable title="fields" lazyRender>
        <ResponseField name="button" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-button-section-input">EmailTemplateButtonSectionInput</a>}>
          Patch a button section.
        </ResponseField>

        <ResponseField name="chromeDino" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-chrome-dino-section-input">EmailTemplateChromeDinoSectionInput</a>}>
          Patch a Chrome dinosaur section.
        </ResponseField>

        <ResponseField name="column" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-column-section-input">EmailTemplateColumnSectionInput</a>}>
          Patch column layout, or replace children with a complete `columns` list. Decreasing columnCount without columns is rejected if trailing slots still have sections.
        </ResponseField>

        <ResponseField name="discount" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-discount-section-input">EmailTemplateDiscountSectionInput</a>}>
          Patch a discount section.
        </ResponseField>

        <ResponseField name="footer" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-footer-section-input">EmailTemplateFooterSectionInput</a>}>
          Patch a footer section.
        </ResponseField>

        <ResponseField name="header" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-header-section-input">EmailTemplateHeaderSectionInput</a>}>
          Patch a header section.
        </ResponseField>

        <ResponseField name="html" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-html-section-input">EmailTemplateHtmlSectionInput</a>}>
          Patch an HTML section.
        </ResponseField>

        <ResponseField name="id" type="ID!" required>
          The section's id (`blockId`).
        </ResponseField>

        <ResponseField name="image" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-image-section-input">EmailTemplateImageSectionInput</a>}>
          Patch an image section.
        </ResponseField>

        <ResponseField name="line" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-line-section-input">EmailTemplateLineSectionInput</a>}>
          Patch a line section.
        </ResponseField>

        <ResponseField name="menu" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-menu-section-input">EmailTemplateMenuSectionInput</a>}>
          Patch a menu section.
        </ResponseField>

        <ResponseField name="products" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-products-section-input">EmailTemplateProductsSectionInput</a>}>
          Patch a products section.
        </ResponseField>

        <ResponseField name="qrCode" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-qr-code-section-input">EmailTemplateQrCodeSectionInput</a>}>
          Patch a QR code section.
        </ResponseField>

        <ResponseField name="scratchToReveal" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-scratch-to-reveal-section-input">EmailTemplateScratchToRevealSectionInput</a>}>
          Patch a scratch-to-reveal section.
        </ResponseField>

        <ResponseField name="shoppableProducts" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-shoppable-products-section-input">EmailTemplateShoppableProductsSectionInput</a>}>
          Patch a shoppable products section.
        </ResponseField>

        <ResponseField name="socials" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-socials-section-input">EmailTemplateSocialsSectionInput</a>}>
          Patch a socials section.
        </ResponseField>

        <ResponseField name="spacer" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-spacer-section-input">EmailTemplateSpacerSectionInput</a>}>
          Patch a spacer section.
        </ResponseField>

        <ResponseField name="subscriptionAddToOrder" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-add-to-order-section-input">EmailTemplateSubscriptionAddToOrderSectionInput</a>}>
          Patch a subscription add-to-order section.
        </ResponseField>

        <ResponseField name="subscriptionSkipOrDelay" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-skip-or-delay-section-input">EmailTemplateSubscriptionSkipOrDelaySectionInput</a>}>
          Patch a skip-or-delay section.
        </ResponseField>

        <ResponseField name="subscriptionSwapProduct" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-subscription-swap-product-section-input">EmailTemplateSubscriptionSwapProductSectionInput</a>}>
          Patch a subscription swap-product section.
        </ResponseField>

        <ResponseField name="table" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-table-section-input">EmailTemplateTableSectionInput</a>}>
          Patch a table section.
        </ResponseField>

        <ResponseField name="text" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-text-section-input">EmailTemplateTextSectionInput</a>}>
          Patch a text section.
        </ResponseField>

        <ResponseField name="trackableSummary" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-trackable-summary-section-input">EmailTemplateTrackableSummarySectionInput</a>}>
          Patch an order-summary section.
        </ResponseField>

        <ResponseField name="trackingInfo" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-tracking-info-section-input">EmailTemplateTrackingInfoSectionInput</a>}>
          Patch a tracking-info section.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Returns

<ResponseField name="updateEmailTemplate" type={<a href="/docs/api-reference/v3/reference/marketing/email-template">EmailTemplate</a>}>
  The content of an email, as the merchant authored it.

  <Expandable title="fields" lazyRender>
    <ResponseField name="contentBackgroundColor" type="String!" required>
      The content canvas background, as set under Email styles in the email builder.
    </ResponseField>

    <ResponseField name="createdAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the template was created.
    </ResponseField>

    <ResponseField name="emailBackgroundColor" type="String!" required>
      The email background, as set under Email styles in the email builder.
    </ResponseField>

    <ResponseField name="id" type="ID!" required>
      The id of this template.
    </ResponseField>

    <ResponseField name="legacyId" type="String!" required>
      The template's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.
    </ResponseField>

    <ResponseField name="linkColor" type="String">
      The default link color, as set under Email styles in the email builder. Null when the merchant left it unset.
    </ResponseField>

    <ResponseField name="name" type="String!" required>
      The merchant-facing name of the template.
    </ResponseField>

    <ResponseField name="preview" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-preview">EmailTemplatePreview</a>}>
      Render this template, to see what recipients get. Use a width of about 375 for a phone.

      **Requires:** [`marketing_templates_read`](/docs/api-reference/v3/reference/scopes#scope-marketing_templates_read)

      <Expandable title="fields" lazyRender>
        **Arguments**

        <ResponseField name="eventId" type="ID">
          Render with this recent event's data instead of sample data: a 24-character hex event id. A well-formed id that can't be found falls back to sample data.
        </ResponseField>

        <ResponseField name="width" type="Int">
          Viewport width of the screenshot, 320-1200 pixels.
        </ResponseField>

        **Fields**

        <ResponseField name="height" type="Int">
          The screenshot's full height in pixels.
        </ResponseField>

        <ResponseField name="html" type="String!" required>
          The rendered email HTML, as a recipient's client would receive it.
        </ResponseField>

        <ResponseField name="imageUrl" type="String">
          A link to a full-length PNG screenshot at the requested width. It expires after an hour.
        </ResponseField>

        <ResponseField name="width" type="Int">
          The screenshot's width in pixels.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="previewText" type="String">
      The preview text shown after the subject in an inbox. Null when the merchant left it unset.
    </ResponseField>

    <ResponseField name="sections" type={<a href="/docs/api-reference/v3/reference/marketing/email-template-section">[EmailTemplateSection!]!</a>} required>
      The blocks that make up the email body, in order. Nested column children keep their own ids. A type this API version does not model field-by-field is returned as EmailTemplateUnknownSection.
    </ResponseField>

    <ResponseField name="sectionsJson" type={<a href="/docs/api-reference/v3/reference/common/json">[JSON!]!</a>} required>
      `sections` with every field selected, as JSON: one element per root block, in order, with `__typename` and nested column children. Empty or unreadable stored sections are \[]. Edits go through operations.
    </ResponseField>

    <ResponseField name="subject" type="String!" required>
      The subject line **as authored**, before per-recipient substitution. A subject containing `{{ }}` placeholders is filled in per customer at send time, and some sends prepend a prefix, so this is not necessarily the subject any one customer saw. Empty when the template has no subject of its own.
    </ResponseField>

    <ResponseField name="trigger" type={<a href="/docs/api-reference/v3/reference/marketing/marketing-trigger">MarketingTrigger!</a>} required>
      The trigger context this template is valid for. Immutable after create. UNKNOWN when the stored trigger is not modeled in this API version.
    </ResponseField>

    <ResponseField name="updatedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime!</a>} required>
      When the template was last edited. Templates stay editable after the campaigns that used them have finished, so compare this against a campaign's `finishedAt` to tell whether the content here is still what that campaign actually sent.
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

```graphql theme={null}
mutation {
  updateEmailTemplate(id: "...", input: { ... }, operations: { ... }) {
    contentBackgroundColor
    createdAt
    emailBackgroundColor
    id
    legacyId
    linkColor
    name
    previewText
    # ...
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.