Edit template design
Changes single blocks of a template built from blocks, in place of sending its whole design: add a block, change its fields, its style, its phone style or its dark mode colours, move it, take it out or copy it, or change the style, the dark mode colours, the preview, the fonts or the CSS of the whole message. The operations run in order, and when one is refused nothing is saved. The HTML and the plain text are made from the design again.
templates_editArguments
idstringRequiredThe id of the item. Up to 64 characters.
operationsobject[]RequiredWhat to change, in order: 1 to 50 operations. Each one works on the design the one before it left, and the design has to hold after each. When one is refused, nothing is saved.
operations[].opstringRequiredWhat to do:
insertadds a block,updatechanges one,moveputs one somewhere else,removetakes one out with everything inside it,duplicatecopies one right after itself with new ids, andpagechanges the style, the dark mode colours, the preview, the fonts or the CSS of the whole message.One of
insertupdatemoveremoveduplicatepageoperations[].idstringFor
update,move,removeandduplicate: the id of the block.operations[].blockobjectFor
insert: the block to add, shaped like a block of thebodyof a design, withchildrenwhen it holds other blocks. Without anidit gets one.operations[].block.kindstringRequiredWhat the block is.
Section,Row,ColumnandContainerhold other blocks.Text,Heading,Button,Link,Markdown,CodeBlockandCodeInlinehold text.Imgis an image,Hra line andHtmlcustom code: HTML of your own that goes into the message as it is.One of
SectionRowColumnContainerTextHeadingButtonLinkImgHrMarkdownCodeBlockCodeInlineHtmloperations[].block.idstringA name for the block that no other block of the design has: lowercase letters, digits and hyphens. Leave it out and the block gets one.
operations[].block.styleRecord<string, string | number>CSS for the block, by property name, such as
{ "fontSize": "16px", "color": "#111111" }. Only properties that work in mail are taken.operations[].block.alignstringWhere the block sits across its line:
left,centerorright.One of
leftcenterrightoperations[].block.classNamestringClass names for the block, one or several with one space between them, such as
hero wide, 200 characters at most. Thecssof the design reaches the block by them. A name cannot start withr-.operations[].block.onlystringThe one kind of screen the block shows on:
desktophides it on a phone, andphoneshows it on a phone and nowhere else. Without it, the block shows everywhere.One of
desktopphoneoperations[].block.phoneRecord<string, string | number>CSS that takes the place of the style of the block on a phone, a screen up to 600 pixels wide, by property name, such as
{ "fontSize": "14px", "padding": "12px" }. It takes: fontSize, lineHeight, textAlign, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, margin, marginTop, marginRight, marginBottom, marginLeft, width, maxWidth, height.operations[].block.darkRecord<string, string | number>Colours that take the place of the ones of the block for a reader in dark mode, by property name, such as
{ "color": "#f4f4f5" }. It takes: color, backgroundColor, borderColor.operations[].block.textstringThe words of a block that holds text, up to 20000 characters.
{{NAME}}marks a variable. AMarkdownblock takes Markdown here, aCodeBlocktakes the code and anHtmlblock takes its HTML, up to 60000 characters.operations[].block.childrenunknown[]The blocks inside a
Section, aRow, aColumnor aContainer, each shaped like a block ofbody. ARowtakesColumnblocks only, and aColumnsits in aRowonly. Up to 500 items.operations[].block.hrefstringWhere a
Buttonor aLinkleads: a full address, or one variable as the whole value, such as{{URL}}. Up to 2,048 characters.operations[].block.targetstringWhere the link opens:
_blankfor a new tab or_self. Without it,_blank.One of
_blank_selfoperations[].block.srcstringThe address of the picture of an
Img: a full address, or one variable as the whole value. Up to 2,048 characters.operations[].block.altstringWhat the picture of an
Imgshows, in words, for someone who cannot see it. Up to 512 characters.operations[].block.widthstring | numberThe width of an
Imgor aColumn: a number of pixels, or a length such as50%. Up to 32 characters.operations[].block.heightstring | numberThe height of an
Img: a number of pixels, or a length. Up to 32 characters.operations[].block.valignstringWhere the content of a
Columnsits:top,middleorbottom.One of
topmiddlebottomoperations[].block.asstringThe level of a
Heading, fromh1toh6. Without it,h1.One of
h1h2h3h4h5h6operations[].block.languagestringThe language of a
CodeBlock, such astypescriptorbash. One it does not know is shown as plain text. Up to 64 characters.operations[].block.themestringThe colours of a
CodeBlock:oneDark,oneLight,dracula,nord,vscDarkPlus,vs,ghcolorsormaterialLight. Without it,oneDark. Up to 64 characters.operations[].block.lineNumbersbooleanWhether a
CodeBlocknumbers its lines.operations[].block.stackbooleantrueputs the columns of aRowunder each other on a phone. Only aRowtakes it.operations[].parentstring | nullFor
insertandmove: the id of the block that takes it, which is aSection, aRow, aColumnor aContainer. Leave it out, or givenull, for the top level of the message.operations[].indexintegerFor
insertandmove: where the block ends up among the blocks of its parent, counted from 0. Leave it out for the end.operations[].setobjectFor
update: the fields of the block to change, by name. A field set tonullis taken off the block.operations[].set.alignstring | nullWhere the block sits across its line:
left,centerorright.One of
leftcenterrightoperations[].set.classNamestring | nullClass names for the block, one or several with one space between them, such as
hero wide, 200 characters at most. Thecssof the design reaches the block by them. A name cannot start withr-.operations[].set.onlystring | nullThe one kind of screen the block shows on:
desktophides it on a phone, andphoneshows it on a phone and nowhere else. Without it, the block shows everywhere.One of
desktopphoneoperations[].set.textstring | nullThe words of a block that holds text, up to 20000 characters.
{{NAME}}marks a variable. AMarkdownblock takes Markdown here, aCodeBlocktakes the code and anHtmlblock takes its HTML, up to 60000 characters.operations[].set.hrefstring | nullWhere a
Buttonor aLinkleads: a full address, or one variable as the whole value, such as{{URL}}. Up to 2,048 characters.operations[].set.targetstring | nullWhere the link opens:
_blankfor a new tab or_self. Without it,_blank.One of
_blank_selfoperations[].set.srcstring | nullThe address of the picture of an
Img: a full address, or one variable as the whole value. Up to 2,048 characters.operations[].set.altstring | nullWhat the picture of an
Imgshows, in words, for someone who cannot see it. Up to 512 characters.operations[].set.widthstring | number | nullThe width of an
Imgor aColumn: a number of pixels, or a length such as50%.operations[].set.heightstring | number | nullThe height of an
Img: a number of pixels, or a length.operations[].set.valignstring | nullWhere the content of a
Columnsits:top,middleorbottom.One of
topmiddlebottomoperations[].set.asstring | nullThe level of a
Heading, fromh1toh6. Without it,h1.One of
h1h2h3h4h5h6operations[].set.languagestring | nullThe language of a
CodeBlock, such astypescriptorbash. One it does not know is shown as plain text. Up to 64 characters.operations[].set.themestring | nullThe colours of a
CodeBlock:oneDark,oneLight,dracula,nord,vscDarkPlus,vs,ghcolorsormaterialLight. Without it,oneDark. Up to 64 characters.operations[].set.lineNumbersboolean | nullWhether a
CodeBlocknumbers its lines.operations[].set.stackboolean | nulltrueputs the columns of aRowunder each other on a phone. Only aRowtakes it.operations[].styleRecord<string, string | number | null>For
updateandpage: CSS to merge into the style of the block or of the whole message, by property name. A property set tonullis taken out.operations[].previewstring | nullFor
page: the line a mail app shows beside the subject before the message is opened.nulltakes it out. Up to 256 characters.operations[].fontsobject[] | nullFor
page: the fonts of the message as the whole list, each shaped like a font of a design.nulltakes them all out. Up to 4 items.operations[].fonts[].familystringRequiredThe name of the font, such as
Inter. A block or the page uses the font by naming it infontFamily.operations[].fonts[].fallbackstringRequiredThe fonts to use where this one does not load, the one you want most first, such as
Helvetica, Arial, sans-serif. Pick fonts every device has.operations[].fonts[].urlstringRequiredThe full
httpsaddress of the font file, on your own domain or a CDN. It cannot be a variable. Up to 2,048 characters.operations[].fonts[].formatstringRequiredThe format of the file:
woff2,woff,truetypeoropentype.One of
woff2wofftruetypeopentypeoperations[].fonts[].weightnumber | stringThe weight this file holds: a number from 100 to 900 in hundreds, or
normalorbold. Without it, 400.operations[].fonts[].stylestringThe style this file holds:
normaloritalic. Without it,normal.One of
normalitalicoperations[].phoneRecord<string, string | number | null>For
update: CSS to merge into the phone style of the block, by property name. A property set tonullis taken out.operations[].darkRecord<string, string | number | null>For
updateandpage: colours to merge into the dark mode colours of the block or of the whole message, by property name. A property set tonullis taken out.operations[].cssstring | nullFor
page: the CSS of the whole message, as the whole text.nulltakes it out. Up to 20,000 characters.
Returns
The answer comes back under structuredContent, with the same JSON as text in content. A call the API refuses comes back with isError set, and the code and the message under structuredContent.error. MCP shows how to connect a client.
object"template"Always
template.idstringThe id of the template.
namestringThe name of the template.
aliasstringA short name of your own to send with in place of the id, such as
welcome.statusstringdraftuntil it is published,publishedafter that.One of
draftpublishedsubjectstringThe subject line, as last saved.
htmlstringThe HTML, as last saved.
textstring | nullThe plain text version, as last saved, or
nullwhen it has none.fromstringThe sender an email built from it gets when the send names none. Empty for none.
replyTostringThe address replies go to when the send names none. Empty to leave it to the default of the workspace.
defaultsRecord<string, string>A value for a variable, by name, used when a send gives none for it.
designobject | nullThe blocks the template is built from, or
nullfor a template written as HTML. When it is set,htmlandtextare made from it.design.previewstringOptionalThe line a mail app shows beside the subject before the message is opened.
{{NAME}}marks a variable.design.styleRecord<string, string | number>OptionalCSS for the whole message, by property name. A background colour fills the page, a
maxWidthcentres the content, andfontFamily,fontSizeandlineHeightare what text gets unless a block sets its own.design.darkRecord<string, string | number>OptionalColours for the whole message for a reader in dark mode, by property name:
backgroundColorfills the page, andcolorandborderColorgo to the content. It takes: color, backgroundColor, borderColor.design.fontsobject[]OptionalFonts the message loads from an address of your own, 4 at most. A block or the page uses one by naming its
familyinfontFamily, and gets itsfallbackadded for the mail apps that load no web fonts.design.fonts[].familystringThe name of the font, such as
Inter. A block or the page uses the font by naming it infontFamily.design.fonts[].fallbackstringThe fonts to use where this one does not load, the one you want most first, such as
Helvetica, Arial, sans-serif. Pick fonts every device has.design.fonts[].urlstringThe full
httpsaddress of the font file, on your own domain or a CDN. It cannot be a variable.design.fonts[].formatstringThe format of the file:
woff2,woff,truetypeoropentype.One of
woff2wofftruetypeopentypedesign.fonts[].weightnumber | stringOptionalThe weight this file holds: a number from 100 to 900 in hundreds, or
normalorbold. Without it, 400.design.fonts[].stylestringOptionalThe style this file holds:
normaloritalic. Without it,normal.One of
normalitalicdesign.cssstringOptionalCSS of your own for the whole message, up to 20000 characters. It goes into the head after the rules the design makes, and reaches a block by its
className. A rule that has to beat the style a block carries needs!important.</style,@import,expression(,javascript:,behavior:,-moz-bindingare refused.design.bodyobject[]The blocks of the message, from top to bottom.
design.body[].kindstringWhat the block is.
Section,Row,ColumnandContainerhold other blocks.Text,Heading,Button,Link,Markdown,CodeBlockandCodeInlinehold text.Imgis an image,Hra line andHtmlcustom code: HTML of your own that goes into the message as it is.One of
SectionRowColumnContainerTextHeadingButtonLinkImgHrMarkdownCodeBlockCodeInlineHtmldesign.body[].idstringThe id of the block. No other block of the design has it.
design.body[].styleRecord<string, string | number>OptionalCSS for the block, by property name, such as
{ "fontSize": "16px", "color": "#111111" }. Only properties that work in mail are taken.design.body[].alignstringOptionalWhere the block sits across its line:
left,centerorright.One of
leftcenterrightdesign.body[].classNamestringOptionalClass names for the block, one or several with one space between them, such as
hero wide, 200 characters at most. Thecssof the design reaches the block by them. A name cannot start withr-.design.body[].onlystringOptionalThe one kind of screen the block shows on:
desktophides it on a phone, andphoneshows it on a phone and nowhere else. Without it, the block shows everywhere.One of
desktopphonedesign.body[].phoneRecord<string, string | number>OptionalCSS that takes the place of the style of the block on a phone, a screen up to 600 pixels wide, by property name, such as
{ "fontSize": "14px", "padding": "12px" }. It takes: fontSize, lineHeight, textAlign, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, margin, marginTop, marginRight, marginBottom, marginLeft, width, maxWidth, height.design.body[].darkRecord<string, string | number>OptionalColours that take the place of the ones of the block for a reader in dark mode, by property name, such as
{ "color": "#f4f4f5" }. It takes: color, backgroundColor, borderColor.design.body[].textstringOptionalThe words of a block that holds text, up to 20000 characters.
{{NAME}}marks a variable. AMarkdownblock takes Markdown here, aCodeBlocktakes the code and anHtmlblock takes its HTML, up to 60000 characters.design.body[].childrenunknown[]OptionalThe blocks inside a
Section, aRow, aColumnor aContainer, each shaped like a block ofbody. ARowtakesColumnblocks only, and aColumnsits in aRowonly.design.body[].hrefstringOptionalWhere a
Buttonor aLinkleads: a full address, or one variable as the whole value, such as{{URL}}.design.body[].targetstringOptionalWhere the link opens:
_blankfor a new tab or_self. Without it,_blank.One of
_blank_selfdesign.body[].srcstringOptionalThe address of the picture of an
Img: a full address, or one variable as the whole value.design.body[].altstringOptionalWhat the picture of an
Imgshows, in words, for someone who cannot see it.design.body[].widthstring | numberOptionalThe width of an
Imgor aColumn: a number of pixels, or a length such as50%.design.body[].heightstring | numberOptionalThe height of an
Img: a number of pixels, or a length.design.body[].valignstringOptionalWhere the content of a
Columnsits:top,middleorbottom.One of
topmiddlebottomdesign.body[].asstringOptionalThe level of a
Heading, fromh1toh6. Without it,h1.One of
h1h2h3h4h5h6design.body[].languagestringOptionalThe language of a
CodeBlock, such astypescriptorbash. One it does not know is shown as plain text.design.body[].themestringOptionalThe colours of a
CodeBlock:oneDark,oneLight,dracula,nord,vscDarkPlus,vs,ghcolorsormaterialLight. Without it,oneDark.design.body[].lineNumbersbooleanOptionalWhether a
CodeBlocknumbers its lines.design.body[].stackbooleanOptionaltrueputs the columns of aRowunder each other on a phone. Only aRowtakes it.layoutstringHow its preview is drawn in the dashboard.
One of
startcentersplitvariablesstring[]The names of the
{{NAME}}variables in the subject, the HTML and the plain text.versionintegerHow many times it was published. 0 for a template that never was.
publishedAtstring | nullWhen it was last published, or
null.changedbooleanWhether it was saved after it was last published. Emails use the published version until you publish again.
updatedAtstringWhen it was last saved.
createdAtstringWhen the template was made.