Email format
The email designer saves emails as a JSON document: the BLOCKS format. Use it through the API to write emails with sections, columns, images and buttons. Text stays Markdown, inside text blocks.
| Where | How |
|---|---|
| Templates, campaigns, flow steps, checks | contentFormat: "BLOCKS" and the document as a string in content |
POST /v1/emails | The document as an object in blocks |
MARKDOWN works everywhere too: Markdown content renders like a document with one section holding one text block. Write Markdown for a mostly-text email, blocks for a laid-out one.
The document
A document is a list of sections. A section has 1 to 4 columns, a column holds blocks.
{
"version": 1,
"style": { "backgroundColor": "#f4f4f2" },
"sections": [
{
"backgroundColor": "#0f172a",
"padding": [40, 28, 40, 28],
"columns": [
{ "width": 100, "blocks": [
{ "type": "heading", "text": "What's new, {{ contact.first_name | default: \"there\" }}", "level": 1, "align": "center" },
{ "type": "button", "label": "Read the changelog", "url": "https://acme.com/changelog" }
] }
]
},
{
"verticalAlign": "middle",
"columns": [
{ "width": 50, "blocks": [ { "type": "image", "src": "https://img.kulamail.com/8b1d4e.png", "alt": "Dashboard", "radius": 8 } ] },
{ "width": 50, "blocks": [ { "type": "text", "markdown": "### Faster dashboard\n\nPages load twice as fast." } ] }
]
}
]
}
| Field | |
|---|---|
version | Required, 1 |
sections | Required, the sections in reading order. 60 at most |
style | Optional, overrides part of the space theme for this email |
The document is 512 KB and 500 blocks at most. Colors are #rrggbb. align is left, center or right. A padding is [top, right, bottom, left], whole numbers from 0 to 80 (px).
Style
Each field is optional and takes the email design of the space when absent.
| Field | Value |
|---|---|
backgroundColor | Around the content |
contentBackgroundColor | Behind the content |
textColor, headingColor, linkColor | Colors |
fontFamily, headingFontFamily | A font id |
width | 520 to 720 (px) |
contentStyle | card or plain |
Sections
| Field | Value |
|---|---|
columns | Required. 1 to 4 columns, widths adding up to 100 |
backgroundColor | Default: the content background |
backgroundImage | An https:// URL or a variable, covering the section. backgroundColor shows where the image doesn't |
padding | Default [16, 28, 16, 28] in the card style, [16, 16, 16, 16] in the plain style |
radius | 0 to 32 (px). Default 0 |
borderColor, borderWidth | 0 to 4 (px). A color alone gives a 1 px border |
gap | Space between columns, 0 to 48 (px). Default 16 |
verticalAlign | top (default), middle or bottom, for the columns |
stackOnMobile | Default true: columns stack on phones. false keeps them side by side |
hideOn | mobile or desktop. Outlook on Windows shows sections hidden on desktop |
Columns
| Field | Value |
|---|---|
width | Required. 10 to 100, percent of the section |
blocks | Required, may be empty |
backgroundColor | Default: none |
padding | Default [0, 0, 0, 0] |
radius | 0 to 32 (px) |
Blocks
Fields not marked required are optional. Every block also takes:
| Field | Value |
|---|---|
padding | Default: per block, below. Spacing between blocks comes from their padding |
backgroundColor | Behind the block |
hideOn | mobile or desktop |
On a dark section, column or block background, text, headings and links turn white or dark when the theme colors wouldn't read, unless the block sets its own color.
heading
Default padding [0, 0, 12, 0].
| Field | Value |
|---|---|
text | Required. Inline Markdown: bold, italic, links, variables |
level | 1 to 3. Default 2 |
align | Default left |
color | Default: the heading color of the theme |
fontSize | 16 to 56 (px). Default: the size of the level |
text
Default padding [0, 0, 16, 0].
| Field | Value |
|---|---|
markdown | Required. Headings, paragraphs, lists, quotes, tables, links, and the ::: blocks |
align | Default left |
color | Default: the text color of the theme |
fontSize | 12 to 24 (px) |
lineHeight | 1.2 to 2 |
image
Default padding [0, 0, 16, 0].
| Field | Value |
|---|---|
src | Required. An https:// URL or a variable. Upload with the Images API to host it |
alt | Alternative text, shown when images are blocked. Without it, a check warns |
href | Link on the image: https://, mailto: or a variable |
width | 10 to 100, percent of the column. Default 100 |
align | Default center |
radius | 0 to 32 (px). Default 0 |
button
Default padding [8, 0, 16, 0].
| Field | Value |
|---|---|
label | Required |
url | Required. https://, mailto: or a variable |
variant | filled (default) or outline |
align | Default center |
fullWidth | true to fill the column |
color, textColor | Default: the button colors of the theme |
radius | 0 to 40 (px). Default: the button shape of the theme |
size | small, medium or large. Default: the theme |
divider
Default padding [16, 0, 16, 0].
| Field | Value |
|---|---|
color | Default: light grey |
thickness | 1 to 8 (px). Default 1 |
width | 10 to 100 (percent). Default 100 |
lineStyle | solid (default), dashed or dotted |
spacer
Default padding [0, 0, 0, 0].
| Field | Value |
|---|---|
height | Required. 4 to 160 (px) |
social
Default padding [8, 0, 16, 0].
| Field | Value |
|---|---|
links | Required. Up to 12 { "network", "url" }. url is https://, mailto: or a variable |
align | Default center |
iconStyle | color (default), dark or light |
iconSize | 16 to 40 (px). Default 24 |
Networks: facebook, instagram, x, linkedin, youtube, tiktok, github, discord, mastodon, bluesky, threads, pinterest, reddit, twitch, whatsapp, telegram, website, email.
menu
A row of text links, for a header or a footer. Default padding [0, 0, 16, 0].
| Field | Value |
|---|---|
links | Required. 1 to 8 { "label", "url" } |
align | Default center |
color | Default: the text color of the theme |
fontSize | 12 to 20 (px). Default 14 |
separator | none (default), dot or pipe |
video
Default padding [0, 0, 16, 0].
| Field | Value |
|---|---|
url | Required. A YouTube or Vimeo URL |
alt | Text of the link under the thumbnail and in the plain-text version |
The email shows the video thumbnail, linking to the video.
Variables
{{ ... }} variables work in every text and URL field: text, markdown, label, src, href, url, backgroundImage. Links of buttons, images, menus, social icons and videos are tracked on marketing emails and checked before sending, like links in the text.
Plain-text version
Kula derives it from the blocks, unless you send your own text:
| Block | In the plain text |
|---|---|
heading, text | Their text |
button | Label: url |
image | Nothing, or alt: href when it has a link |
menu | Label: url, one per line |
social | Network: url, one per line |
divider | A line of dashes |
video | alt: url |
Sections and columns give their blocks in order.
Fonts
arial, helvetica, georgia, verdana, trebuchet, times, and the Google fonts inter, roboto, open-sans, lato, montserrat, poppins, merriweather, lora, playfair-display, source-serif. Apple Mail and iOS show Google fonts; Gmail and Outlook show a system font instead.
Errors
A document that doesn't follow the format answers 400 invalid_blocks. The message gives the path of the problem:
{
"error": "invalid_blocks",
"message": "sections[2].columns[1].blocks[0].url: must be an http(s) URL or a variable",
"status": 400
}