Sign inGet Started

Create a reusable email block

POST
/v1/email/blocks
// Requires email_management:write permission in the target workspace.
const section =
  '<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tbody><tr>' +
  '<td lang="en" style="font-family: Arial, sans-serif; font-size: 14px; font-style: normal; font-weight: normal; ' +
  "line-height: 20px; letter-spacing: normal; text-align: left; text-transform: none; color: #333333; margin: 0; padding: 16px;\">" +
  '<p style="margin: 0;">Offer valid until {{ expiry_date }}.</p></td></tr></tbody></table>';
const block = await bird.email.blocks.create({
  name: "Legal footer",
  source_language: "en",
  fragment: { serializer_version: 2, fragment_html: section },
});
console.log(block.id, block.revision);
Reactie201
{
  "id": "ebl_01krdgeqcxet5s7t44vh8rt9mg",
  "name": "Legal disclosure",
  "source_language": "pt-BR",
  "revision": 1,
  "created_by": {
    "id": "usr_01krdgeqcxet5s7t44vh8rt9mg",
    "type": "user"
  },
  "created_at": "2026-05-20T09:14:52Z",
  "updated_at": "2026-05-25T16:42:01Z"
}

Creates an unpublished block with a draft in its source language. Send the section as HTML in fragment, with serializer_version set to 2: one presentation table whose single content cell sets lang to the source language and its own typography, under the rules fragment_html lists. Unfinished content can be saved; validating or publishing the block checks it.

The block is not live until you publish it. Each language keeps the authoring mode of its first section, so a section written as HTML stays HTML.

Verzoekpayload

name
string
verplicht

Name for people choosing the block, such as when linking it into a template.

description
string

Optional notes for people maintaining the block.

source_language
string
verplicht

A language tag in BCP-47 form, for example en or pt-BR.

fragment
object

Initial source-language content, as an HTML section. Its serializer_version sets the language's authoring mode. Leaving it out returns a 422 validation_error, except in the Bird dashboard, which starts an empty visual draft.

Onderliggende parameters tonen
fragment.serializer_version
integer
verplicht

How this section is written. 2 is HTML written directly, and is the value to send from the API, SDKs, CLI and MCP. 1 is reserved for the Bird dashboard's visual editor; other callers get a 422 for it.

fragment.fragment_html
string
verplicht

Section HTML. Unfinished markup can be saved as a draft; validation checks readiness separately. A version 2 section is one presentation table with one tbody, tr and td, and all layout stays inside that cell. The cell sets lang to the block language and its own typography: font-family, a font-size in pixels, font-style, font-weight, line-height, letter-spacing, text-align (not start or end), text-transform, color, margin and padding. Root-relative units such as rem are refused; use px, em or percentages. Liquid stays balanced inside the cell, cannot use assign, capture, increment or decrement, and puts no control tag inside an attribute or style value. {{ bird.unsubscribe_url }} appears only as bare text or as the entire href of an <a>, and never inside an if !mso conditional comment, which Outlook skips. No document wrapper, <style>, script, form, class or id attribute. A table nested in the cell needs its own <tbody>. Inside a complete Outlook conditional comment, prefixed Office and VML elements such as v:fill may self-close, and a balanced if !mso conditional comment that shows its content outside Outlook is accepted when it holds no other conditional comment.

Response Payload

id
string
verplicht
name
string
verplicht

Name for people choosing the block, such as when linking it into a template.

description
string

Optional notes for people maintaining the block. Omitted when empty.

source_language
string
verplicht

A language tag in BCP-47 form, for example en or pt-BR.

revision
integer
verplicht

Metadata revision to send when editing or duplicating this block.

created_by
object
verplicht

Who created the block. A duplicate is created by whoever duplicated it.

Onderliggende attributen tonen
archived_at
string

Present when the block is archived. Retained published content remains readable.

created_at
string
verplicht
updated_at
string
verplicht

Ga verder met de documentatie, handleidingen en voorbeelden voor dit onderwerp.