Create a reusable email block
/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);# Requires email_management:write permission in the target workspace.
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>'
)
block = client.email.blocks.create(
name="Legal footer",
source_language="en",
fragment={"serializer_version": 2, "fragment_html": section},
)
print(block.id, block.revision)// Requires email_management:write permission in the target workspace.
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>`
client, err := bird.NewClient(option.WithAPIKey(os.Getenv("BIRD_API_KEY")))
if err != nil {
log.Fatal(err)
}
block, err := client.Email.Blocks.Create(context.Background(), bird.EmailBlocksCreateParams{
Name: "Legal footer",
SourceLanguage: "en",
Fragment: &bird.EmailBlockFragment{SerializerVersion: 2, FragmentHtml: section},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(block.Id, block.Revision)// Requires email_management:write permission in the target workspace.
$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>';
$params = (new \MessageBird\Wire\Model\EmailBlockCreate())
->setName('Legal footer')
->setSourceLanguage('en')
->setFragment((new \MessageBird\Wire\Model\EmailBlockFragment())
->setSerializerVersion(2)
->setFragmentHtml($section));
$block = $bird->email->blocks->create($params);
echo $block->getId(), ' ', $block->getRevision();bird email blocks create 'Legal disclosure' --body-file - <<'JSON'
{
"name": "Legal disclosure",
"source_language": "en",
"fragment": {
"serializer_version": 2,
"fragment_html": "<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;\">Your disclosure text.</p></td></tr></tbody></table>"
}
}
JSONcurl -X POST "https://us1.platform.bird.com/v1/email/blocks" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Legal disclosure",
"source_language": "en",
"fragment": {
"serializer_version": 2,
"fragment_html": "<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;\">Your disclosure text.</p></td></tr></tbody></table>"
}
}'{
"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.
Treść żądania
nameName for people choosing the block, such as when linking it into a template.
descriptionOptional notes for people maintaining the block.
source_languageA language tag in BCP-47 form, for example en or pt-BR.
fragmentInitial 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.
Treść odpowiedzi
idnameName for people choosing the block, such as when linking it into a template.
descriptionOptional notes for people maintaining the block. Omitted when empty.
source_languageA language tag in BCP-47 form, for example en or pt-BR.
revisionMetadata revision to send when editing or duplicating this block.
created_byWho created the block. A duplicate is created by whoever duplicated it.
Pokaż atrybuty podrzędne
created_by.idActor identifier.
created_by.typeNew actor types may be added. Treat unrecognized values as future types, not errors.
user: a member's own session.api_key: a workspace API key.oauth_token: a token issued to a caller on a member's behalf.system: an action we perform without a customer actor.sso: an organization's SSO connection.service_account: a workspace's connected Integration acting with no member behind it.automation: an automation execution in your workspace.
Possible values (may grow over time): user, api_key, oauth_token, system, sso, service_account, automation
created_by.display_nameThe label the actor is shown under: typically a member's name or email address, or the API key's name. Null when it could not be resolved.
archived_atPresent when the block is archived. Retained published content remains readable.
created_atupdated_atPowiązane zasoby
Przejdź do dokumentacji, przewodników i przykładów dotyczących tego tematu.