Skip to main content
TemplatesVersion: v3New

Update an email template

PATCH/emails/locations/{locationId}/templates/{templateId}

Update email template

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your access token.

Scope:emails/templates.write
Auth methods:OAuthPrivate Integration
Token type:Sub-Account Token

Request​

Headers

Versionstringrequired

API Version

Available optionsv3
Example:v3

Path Parameters

locationIdstringrequired

Location ID

Example:ve9EPM428h8vShlRW1KT
templateIdstringrequired

Template ID

Example:zYy3YOUuHxgomU1uYJty

Body

namestring

Template name

Example:Newsletter Template
editorContentobject

Editor content to update. Required only when updating template content, and must be provided together with editorType. An HTML or plain-text string for html/text, or design-editor JSON for builder (fetch the current JSON with Get Email Template includeContent=true, edit it, send it back). Design-editor (builder) JSON. elements is the layout tree: mj-section > mj-column > leaf elements. Every node has a unique id and a tagName. attrs is a flat map keyed by node id (one entry for every node in the tree, sections and columns included): { tagName, content, attributes: [{ name, default, unit? }] }. content holds the text/HTML of leaf elements such as mj-text and mj-button. Each attribute is { name, default, unit? }: default is the value, and sizes are a number plus unit (px or %), e.g. { name: "font-size", default: 16, unit: "px" }. Padding is split into padding-top, padding-right, padding-bottom and padding-left with enable-padding set to true; the padding shorthand and inline style are not read by the editor. Send the full attribute set below for every element, changing only the values you need. When an element is selected in the editor, every listed attribute missing from the JSON is written in with the default shown here, so a partial list changes the design (background, padding, font) on first click. Text and image backgrounds use container-background-color; section and button backgrounds use background-color. Element attributes and the editor defaults: mj-section: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#ffffff, background-url="", background-size=auto, background-repeat=repeat, full-width=false, text-align=center, border-radius=0px, border-width=0px, border-color="". mj-column: enable-padding=true, padding-top=0px, padding-right=0px, padding-bottom=0px, padding-left=0px, is-unstacked=false. mj-text: enable-padding=true, padding-top=12px, padding-right=24px, padding-bottom=12px, padding-left=24px, font-family=arial, helvetica, sans-serif, font-size=14px, line-height=1.5, container-background-color="". mj-image: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, src=https://..., alt="", href="", width=null, height=null, align=center, border-radius=0px, container-background-color="". mj-button: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#00a4bd, color=#ffffff, font-family=Ubuntu, Helvetica, Arial, sans-serif, font-size=14px, align=center, border-radius=6px, border-width=0px, border-color=#00a4bd, redirectAction=url, url="". mj-divider: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, border-width=2px, border-color=#99acc2, border-style=solid, width=100%, align=center. mj-spacer: height=20px, container-background-color="". Buttons are mj-button elements (text in content, colors and link in attributes). mj-text content is edited as rich text and keeps only paragraphs, headings <h1>-<h6>, text-align, <span style> font/size/color, <strong>, <em>, <u>, <s>, links <a href>, lists and <br>; other markup (a link styled as a button with background or padding, tables, <div>, block styles) renders in the email but the editor drops it on edit, so the canvas shows something different from what is sent. Images: mj-image needs src set to a public https URL of the image (upload a file first with the Medias API and use its URL); without src the editor shows a placeholder. Set alt for accessibility and href to make the image a link. Leave width and height as null for the natural size (capped to the column) or set a number with unit: "px"; never omit them or send "". templateSettings holds template-wide theme settings as lists of { name, default, unit? } grouped by body (width, background-color, body-color, border, background image), button, divider, text (fonts, line-height, link styles) and header (customCss). To keep the current theme, send back the templateSettings that Get returned. Text fonts: inside mj-text content set font-family, font-size and color on a <span style="..."> around the text (e.g. <h1><span style="font-family: georgia, palatino, serif; font-size: 32px">Title</span></h1>); the editor toolbar reads fonts only from these spans, so styles on <h1>/<p> themselves show as the default font and size. Use one of these exact font-family values: arial, helvetica, sans-serif, helvetica, arial, sans-serif, verdana, geneva, sans-serif, georgia, palatino, serif, 'times new roman', times, serif, 'trebuchet ms', geneva, sans-serif, 'arial black', sans-serif, 'andale mono', monospace, Ubuntu, Helvetica, Arial, sans-serif. Google fonts: use 'Font Name', <fallback from the list above> (quotes only when the name has a space) and list every Google font used in templateSettings.text as { name: "custom-fonts", default: "Font One;Font Two" }; fonts not listed there are not loaded and fall back. Brand-board fonts: use 'Brand Font Name', <fallback> and list their brand font ids in { name: "brand-custom-fonts", default: "id1;id2" }. Keep both entries when sending back templateSettings. Supported leaf tags: mj-text, mj-image, mj-logo, mj-button, mj-divider, mj-spacer, mj-social, mj-video, mj-raw, mj-footer, mj-accordion, mj-carousel, mj-countdown-timer, mj-form, mj-product, mj-shopping-cart, mj-review-link, mj-rss-header, mj-rss-item, mj-preview-url. For tags not listed above, copy an existing element of that tag from a Get response. Buttons link through redirectAction (url, mail, telephone, sms, skype, other, file) plus the attribute it names, e.g. { name: "redirectAction", default: "url" } with { name: "url", default: "https://..." }; href alone renders no link. Nodes without an attrs entry are skipped when rendering. Merge fields are Handlebars: {{contact.first_name}}, a fallback is {{default contact.first_name "there"}}, a condition is {{#if contact.city}}...{{/if}}. Liquid filters such as {{contact.first_name | default: "there"}} are not supported and block the send.

Example:<html><body>Hello World</body></html>
editorTypestring

Type of editor content. Required only when updating template content, and must be provided together with editorContent. html = code editor (raw HTML string), text = plain-text email (string), builder = design (drag-and-drop) editor (JSON, see BuilderEditorContentPublicV2Dto). Merge fields are Handlebars: {{contact.first_name}}, a fallback is {{default contact.first_name "there"}}, a condition is {{#if contact.city}}...{{/if}}. Liquid filters such as {{contact.first_name | default: "there"}} are not supported and block the send.

Available optionshtmlbuildertext
Example:html
allowEditorTypeChangeboolean

Content writes must keep the email’s editor: sending html/text for a design-editor (builder) email, or builder for an HTML/text email, is refused with 409 (code 6017) so the design is not replaced by accident. Set true only to convert the email to the other editor on purpose. Switching between html and text is always allowed. Design JSON over an email last saved in Design Editor 2.0 is always refused (409, code 6018); edit it in the app, or convert it with html and allowEditorTypeChange: true.

Default:false
Example:false
previewTextstring

Preview text

Example:Email preview text
subjectLinestring

Email subject line

Example:Welcome to our newsletter
fromNamestring

Sender name

Example:John Doe
fromEmailstring

Sender email address

archivedboolean

Whether template is archived

Example:false
parentFolderIdstring

Parent folder ID. Pass null to move template to the root level.

Example:67f15c2ae99226d5bcccb8f0
userIdstring

ID of the user performing this action

Example:507f1f77bcf86cd799439011

Response

Success

idstringrequired

Template ID

Example:507f1f77bcf86cd799439011
namestringrequired

Template name

Example:My Email Template
archivedbooleanrequired

Whether template is archived

Example:false
fromNamestringrequired

Sender name

Example:John Doe
fromEmailstringrequired

Sender email address

subjectLinestringrequired

Email subject line

Example:Welcome to our newsletter
previewTextstringrequired

Preview text

Example:Check out our latest updates
previewUrlstringrequired

Preview URL

Example:https://example.com/preview/template123
editorTypestring

Editor type. html = code editor (raw HTML string), text = plain-text email (string), builder = design (drag-and-drop) editor (JSON, see BuilderEditorContentPublicV2Dto). Merge fields are Handlebars: {{contact.first_name}}, a fallback is {{default contact.first_name "there"}}, a condition is {{#if contact.city}}...{{/if}}. Liquid filters such as {{contact.first_name | default: "there"}} are not supported and block the send.

Available optionshtmlbuildertext
Example:html
isPlainTextboolean

Whether template is plain text

Example:false
parentFolderIdstring

Parent folder ID

Example:67f15c2ae99226d5bcccb8f0
updatedAtstring

Last updated timestamp

Example:2025-07-24T11:55:43.598Z
createdAtstring

Created timestamp

Example:2025-07-24T11:55:43.598Z
traceIdstring

Trace ID of request

Example:019e4ef5-a65e-4198-8cf9-8e93dca9bda4