You can use this API to get specific content blocks from the available content blocks in your MoEngage account.
API Endpoint
POST https://api-0X.moengage.com/v1/external/campaigns/content-blocks/get-by-ids
The 'X' in the API Endpoint URL refers to the MoEngage Data Center (DC). MoEngage hosts each customer in a different DC. You can find your DC number (value of X) and replace the value of 'X' in the URL by referring to the DC and API endpoint mapping here.
Request Headers
Key | Value | Description |
---|---|---|
MOE-APPKEY
|
The App key for your MoEngage account. |
You can find your MoEngage APP key in the following navigation on the Dashboard: Revamped UI: Settings -> Account -> APIs -> App ID Old UI: Settings -> API -> General Settings -> DATA API |
Content-Type | application/json | -- |
Request Parameters
Key | Value | Description |
---|---|---|
ids
|
[block_id_1, block_id_2] | Comma-separated list of the content block ids |
is_raw_content_required | Boolean - True/False |
Boolean Flag used to control whether we need to show raw content or not. True: Returns Non-Personalized content which was given during creation. False: Does not return Personalized content |
Response
Status Code | Request State | Description | Response Body |
---|---|---|---|
HTTP 202 |
Success |
Content block data |
{ "data": [{}]} |
HTTP 400 |
Bad Request |
|
{ "title": "Invalid Field Value", "description": "app_key - Some of the field values are invalid: app_key : None", "code": "nGpUNpDQ" } |
HTTP 5xx |
Failure |
Server issue |
{ "title": "Internal Server Error", ... } |
Sample cURL request
curl --location --request POST 'https://api-0X.moengage.com/v1/external/campaigns/content-blocks/get-by-ids' \
--header 'content-type: application/json' \
--header 'MOE-APPKEY: {{APP-KEY}} \
--data-raw '{
"ids": [
"634fdf4db9c206ba55b8223b"
],
"is_raw_content_required": true
}'
Sample Request Body
{
"ids": [
"634fdf4db9c206ba55b8223b"
],
"is_raw_content_required": true
}
Sample Response Body
{
"data": [
{
"id": "634fdf4db9c206ba55b8223ab",
"name": "Contentblocktest2",
"label": "Contentblocktest2",
"description": "",
"content_type": "TEXT",
"content": "aa",
"raw_content": "aa",
"status": "ACTIVE",
"created_by": "user@email.com",
"created_at": "2022-10-19T11:28:13.925000",
"updated_by": "test",
"updated_at": "2022-10-21T08:38:51.419000",
"tag_ids": [
"0"
],
"team_ids": [
"test"
],
"images_used": []
}
]
}
Attribute mapping
Key | Data Type | Description |
---|---|---|
id |
string |
Content block id that was passed in the request |
name |
string |
Name of the content block |
description |
string |
Description of the content block |
label |
string |
Label of the content block |
content_type |
string |
Type of the content block - HTML/Text |
content |
string |
Content of the content block |
raw_content |
string |
Raw content of the content block. This is returned when is_raw_content_required=true is passed in the request. |
created_by |
string |
Email id of the user who created the content block |
status |
string |
Shows the status of the content block |
created_at |
string |
Date Time of the content block creation |
updated_by |
string |
Email id of the user who updates the content block |
updated_at |
string |
Date Time of the content block update |
tag_ids |
array of strings |
Tags associated with the content block |
team_ids |
array of strings |
Name of the teams for which the content block is enabled. This is only applicable to the accounts where Teams is enabled. For more information, refer to Teams. |
images_useds |
array of strings |
Images used in content block |