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

# emailTemplateLocalizationSave

> Set an email template's source language and save its translations. Each language in `translations` replaces that language's saved copy, and each in `deleteLocales` is deleted; other saved languages are kept. Select `localization` on the result to read them back. Returns null if no owned template matches the id. Throws a 400 error with an extension code of INVALID_EMAIL_TEMPLATE_TRANSLATION when a language repeats, is the source language, a key is not in `localization.entries`, or a translation drops or breaks an HTML tag or `{{ }}` placeholder of the source; DUPLICATE_TRANSLATION_KEY when a key repeats within a language; and TOO_MANY_LANGUAGES past 20 languages. A request rejected with one of these errors saves nothing. Editing the template's source text later re-translates every saved language in full, replacing hand-edited strings.

**Required scopes:** [`marketing_templates_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_templates_write)

**Store must have one of:** `EMAIL_SMS`, `HSA`, `ORDER_TRACKING`, `RETURNS`, `TNPL`, `REVIEWS`

## Arguments

**deleteLocales** `[\[EmailTemplateLocale!\]](/docs/api-reference/v3/reference/marketing/email-template-locale)`

Languages whose saved copy is deleted. At most 20.

**id** `ID!` *required*

The template's `id`, or its `legacyId` from an earlier version of the Redo API.

**sourceLocale** `[EmailTemplateLocale!](/docs/api-reference/v3/reference/marketing/email-template-locale)` *required*

The language the template is written in.

**translations** `[\[EmailTemplateTranslationInput!\]](/docs/api-reference/v3/reference/marketing/email-template-translation-input)`

Languages to save, each replacing that language's saved copy. At most 20.

**fields**

**locale** `[EmailTemplateLocale!](/docs/api-reference/v3/reference/marketing/email-template-locale)` *required*

The language of this copy.

**texts** `[\[EmailTemplateTranslationTextInput!\]!](/docs/api-reference/v3/reference/marketing/email-template-translation-text-input)` *required*

The translated strings. Each key may appear once, and must be a `key` in `localization.entries`.

**fields**

**key** `String!` *required*

The `key` of the source string, from `localization.entries`.

**text** `String!` *required*

The translated string. Keep every HTML tag and `{{ }}` placeholder of the source. Blank falls back to the source string.

## Returns

**emailTemplateLocalizationSave** `[EmailTemplate](/docs/api-reference/v3/reference/marketing/email-template)`

The content of an email, as the merchant authored it.

**fields**

**contentBackgroundColor** `String!` *required*

The content canvas background, as set under Email styles in the email builder.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the template was created.

**emailBackgroundColor** `String!` *required*

The email background, as set under Email styles in the email builder.

**id** `ID!` *required*

The id of this template.

**legacyId** `String!` *required*

The template's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.

**linkColor** `String`

The default link color, as set under Email styles in the email builder. Null when the merchant left it unset.

**localization** `[EmailTemplateLocalization](/docs/api-reference/v3/reference/marketing/email-template-localization)`

The template's source language, its translatable strings and its saved translations. Null if the template was deleted while reading.

**Requires:** [`marketing_templates_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_templates_read)

**fields**

**entries** `[\[EmailTemplateTranslationEntry!\]!](/docs/api-reference/v3/reference/marketing/email-template-translation-entry)` *required*

The template's translatable strings, in the source language.

**fields**

**field** `[EmailTemplateTranslationField!](/docs/api-reference/v3/reference/marketing/email-template-translation-field)` *required*

Where in the email the string lives.

**key** `String!` *required*

The string's key, stable while its block exists. Translations are written against it.

**kind** `[EmailTemplateTranslationEntryKind!](/docs/api-reference/v3/reference/marketing/email-template-translation-entry-kind)` *required*

Whether `text` is plain text or HTML.

**text** `String!` *required*

The string in the email's source language.

**retranslating** `Boolean!` *required*

Whether the saved translations are being redone after the source changed. A redo re-translates every string of each saved language, replacing hand-edited ones.

**sourceLocale** `[EmailTemplateLocale](/docs/api-reference/v3/reference/marketing/email-template-locale)`

The language the template is written in. Null when none has been set, which sends the source copy as written.

**translations** `[\[EmailTemplateTranslation!\]!](/docs/api-reference/v3/reference/marketing/email-template-translation)` *required*

The saved translations, one per language.

**fields**

**locale** `[EmailTemplateLocale!](/docs/api-reference/v3/reference/marketing/email-template-locale)` *required*

The language of this copy.

**texts** `[\[EmailTemplateTranslationText!\]!](/docs/api-reference/v3/reference/marketing/email-template-translation-text)` *required*

The translated strings, by source `key`. A source string with no entry here is sent in the source language.

**name** `String!` *required*

The merchant-facing name of the template.

**preview** `[EmailTemplatePreview](/docs/api-reference/v3/reference/marketing/email-template-preview)`

Render this template, to see what recipients get. Use a width of about 375 for a phone.

**Requires:** [`marketing_templates_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-marketing_templates_read)

**fields**

**Arguments**

**eventId** `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.

**width** `Int`

Viewport width of the screenshot, 320-1200 pixels.

**Fields**

**height** `Int`

The screenshot's full height in pixels.

**html** `String!` *required*

The rendered email HTML, as a recipient's client would receive it.

**imageUrl** `String`

A link to a full-length PNG screenshot at the requested width. It expires after an hour.

**width** `Int`

The screenshot's width in pixels.

**previewText** `String`

The preview text shown after the subject in an inbox. Null when the merchant left it unset.

**sections** `[\[EmailTemplateSection!\]!](/docs/api-reference/v3/reference/marketing/email-template-section)` *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.

**sectionsJson** `[\[JSON!\]!](/docs/api-reference/v3/reference/common/json)` *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.

**subject** `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.

**trigger** `[MarketingTrigger!](/docs/api-reference/v3/reference/marketing/marketing-trigger)` *required*

The trigger context this template is valid for. Immutable after create. UNKNOWN when the stored trigger is not modeled in this API version.

**updatedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *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.

## Example

```graphql theme={null}
mutation {
  emailTemplateLocalizationSave(deleteLocales: DA, id: "...", sourceLocale: DA, translations: { ... }) {
    contentBackgroundColor
    createdAt
    emailBackgroundColor
    id
    legacyId
    linkColor
    name
    previewText
    # ...
  }
}
```


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