Blocks
Manage reusable HTML content blocks that can be embedded in emails using the {{ block.name }} template syntax.
/api/v1/blocksGet all blocks for the authenticated client. Cursor-paginated (per_page default 25, max 100; cursor for next/previous page).
Response Fields
idintegerThe block ID.
uuidstringThe block UUID.
namestringThe block name (lowercase with underscores).
html_contentstringThe HTML content of the block.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.
metaobjectCursor pagination metadata (path, per_page, next_cursor, prev_cursor).
Request
curl -X GET \
"https://byomailer.com/api/v1/blocks" \
-H "Authorization: Bearer {your-api-token}" \
-H "Accept: application/json"Response
{
"data": [
{
"id": 1,
"uuid": "block-uuid-1",
"name": "footer_links",
"html_content": "<div><a href=\"https://example.com\">Home</a></div>",
"created_at": "2024-01-15T10:30:00.000000Z",
"updated_at": "2024-01-15T10:30:00.000000Z"
},
{
"id": 2,
"uuid": "block-uuid-2",
"name": "welcome_header",
"html_content": "<h1>Welcome!</h1>",
"created_at": "2024-01-14T09:00:00.000000Z",
"updated_at": "2024-01-14T09:00:00.000000Z"
}
],
"meta": {
"path": "https://byomailer.com/api/v1/blocks",
"per_page": 25,
"next_cursor": null,
"prev_cursor": null
}
}/api/v1/blocks/{blockId}Get a single block by ID.
Path Parameters
blockIdintegerThe ID of the block to retrieve.
Response Fields
idintegerThe block ID.
uuidstringThe block UUID.
namestringThe block name.
html_contentstringThe HTML content of the block.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.
Request
curl -X GET \
"https://byomailer.com/api/v1/blocks/{blockId}" \
-H "Authorization: Bearer {your-api-token}" \
-H "Accept: application/json"Response
{
"data": {
"id": 1,
"uuid": "block-uuid-1",
"name": "footer_links",
"html_content": "<div><a href=\"https://example.com\">Home</a></div>",
"created_at": "2024-01-15T10:30:00.000000Z",
"updated_at": "2024-01-15T10:30:00.000000Z"
}
}/api/v1/blocksCreate a new reusable HTML content block. The html_content is validated for safe HTML — script tags, iframes, event handlers, and other unsafe elements are rejected.
Body Parameters
namestringThe block name. Must be lowercase letters, numbers, and underscores only. Unique per account.
html_contentstringThe HTML content of the block. Must be valid, safe HTML.
Response Fields
idintegerThe block ID.
uuidstringThe block UUID.
namestringThe block name.
html_contentstringThe HTML content of the block.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.
Request
curl -X POST \
"https://byomailer.com/api/v1/blocks" \
-H "Authorization: Bearer {your-api-token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "footer_links",
"html_content": "<div><a href=\"https://example.com\">Home</a></div>"
}'Response
{
"data": {
"id": 3,
"uuid": "block-uuid-3",
"name": "footer_links",
"html_content": "<div><a href=\"https://example.com\">Home</a></div>",
"created_at": "2024-01-16T11:00:00.000000Z",
"updated_at": "2024-01-16T11:00:00.000000Z"
}
}/api/v1/blocks/{blockId}Update an existing block. The html_content is validated for safe HTML.
Path Parameters
blockIdintegerThe ID of the block to update.
Body Parameters
namestringThe new block name. Must be lowercase letters, numbers, and underscores only. Unique per account.
html_contentstringThe new HTML content. Must be valid, safe HTML.
Response Fields
idintegerThe block ID.
uuidstringThe block UUID.
namestringThe updated block name.
html_contentstringThe updated HTML content.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.
Request
curl -X PATCH \
"https://byomailer.com/api/v1/blocks/{blockId}" \
-H "Authorization: Bearer {your-api-token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "updated_footer",
"html_content": "<div><a href=\"https://example.com\">Updated Home</a></div>"
}'Response
{
"data": {
"id": 3,
"uuid": "block-uuid-3",
"name": "updated_footer",
"html_content": "<div><a href=\"https://example.com\">Updated Home</a></div>",
"created_at": "2024-01-16T11:00:00.000000Z",
"updated_at": "2024-01-16T12:00:00.000000Z"
}
}/api/v1/blocks/{blockId}Delete a block.
Path Parameters
blockIdintegerThe ID of the block to delete.
Request
curl -X DELETE \
"https://byomailer.com/api/v1/blocks/{blockId}" \
-H "Authorization: Bearer {your-api-token}" \
-H "Accept: application/json"Response
No content