Create Content Block
post
/content_blocks/create
Use this endpoint to create a Content Block.
Prerequisites
To use this endpoint, you’ll need an API key with the content_blocks.create
permission.
Rate limit
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
Request body
1
2
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
1
2
3
4
5
6
7
{
"name": (required, string) Must be less than 100 characters,
"description": (optional, string) The description of the Content Block. Must be less than 250 character,
"content": (required, string) HTML or text content within Content Block,
"state": (optional, string) Choose `active` or `draft`. Defaults to `active` if not specified,
"tags": (optional, array of strings) Tags must already exist
}
Request parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
name |
Required | String | Name of the Content Block. Must be less than 100 characters. |
description |
Optional | String | Description of the Content Block. Must be less than 250 characters. |
content |
Required | String | HTML or text content within the Content Block. |
state |
Optional | String | Choose active or draft . Defaults to active if not specified. |
tags |
Optional | Array of strings | Tags must already exist. |
Example request
1
2
3
4
5
6
7
8
9
10
curl --location --request POST 'https://rest.iad-01.braze.com/content_blocks/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_REST_API_KEY' \
--data-raw '{
"name": "content_block",
"description": "This is my Content Block",
"content": "HTML content within block",
"state": "draft",
"tags": ["marketing"]
}'
Response
1
2
3
4
5
6
7
8
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
"content_block_id": (string) Your newly generated block id,
"liquid_tag": (string) The generated block tag from the Content Block name,
"created_at": (string) The time the Content Block was created in ISO 8601,
"message": "success"
}
Troubleshooting
The following table lists possible returned errors and their associated troubleshooting steps.
Error | Troubleshooting | |
---|---|---|
Content cannot be blank |
||
Content must be a string |
Make sure your content is encapsulated in quotes ("" ). |
|
Content must be smaller than 50kb |
The content in your Content Block must be less than 50kb total. | |
Content contains malformed liquid |
The Liquid provided is not valid or parsable. Try again with valid Liquid or reach out to support. | |
Content Block cannot be referenced within itself |
||
Content Block description cannot be blank |
||
Content Block description must be a string |
Make sure your Content Block description is encapsulated in quotes ("" ). |
|
Content Block description must be shorter than 250 characters |
||
Content Block name cannot be blank |
||
Content Block name must be shorter than 100 characters |
||
Content Block name can only contain alphanumeric characters |
Content Block names can include any of the following characters: the letters (capitalized or lowercase) A through Z , the numbers 0 through 9 , dashes - , and underscores _ . It cannot contain non-alphanumeric characters like emojis, ! , @ , ~ , & , and other “special” characters. |
|
Content Block with this name already exists |
Try a different name. | |
Content Block state must be either active or draft |
||
Tags must be an array |
Tags must be formatted as an array of strings, for example ["marketing", "promotional", "transactional"] . |
|
All tags must be strings |
Make sure your tags are encapsulated in quotes ("" ). |
|
Some tags could not be found |
To add a tag when creating a Content Block, the tag must already exist in Braze. |
New Stuff!