Create content block

You can use this API to create a content block in MoEngage. 

API Endpoint

API Endpoint
POST https://api-0X.moengage.com/v1/external/campaigns/content-blocks

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 Body

Keys Type Value Description

name

Mandatory

String

Name of the content block  

label

Mandatory

String

Label to uniquely identify your content block

status

Optional

String

Shows the status of the content block

raw_content

Mandatory

String

Raw content of the content block

content_type

Mandatory

String

Type of the content block - HTML/Text 

description

Optional

String

Description of the content block 

created_by

Mandatory

String

Email id of the user who created the content block 

tag_ids

Optional

Array of ids

Tags associated with the content block

team_ids

Optional

Array of ids

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.

content_block_used

Optional

Array of ids

In case, you are using nested content blocks, provide the names of the other content blocks used in this content block

If you are not using nested content blocks, you can pass this as an empty array

content_block_used : []

images_used

Optional

Array of ids

Images used in content block

Response

Status Code Request State Description Body

HTTP 202

Success

   

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
curl --location --request POST 'https://api-0X.moengage.com/v1/external/campaigns/content-blocks' \
--header 'MOE-APPKEY: {{APP-KEY}} \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "test",
  "description": "test",
  "content_type": "HTML",
  "raw_content": "test",
  "images_used": [],
  "status": "ACTIVE",
  "created_by": "test",
  "label": "test"
}'

Sample request 

JSON
{
   "name": "test",
   "description": "test",
   "content_type": "HTML",
   "raw_content": "test",
   "images_used": [],
   "status": "ACTIVE",
   "created_by": "test",
   "label": "test"
}

Attribute Mapping 

Key Type Data Type Description
name 
Mandatory String Name of the content block  
label Mandatory String Label to uniquely identify your content block
raw_content Mandatory String Content of the content block 
content_type Mandatory String Type of the content block - HTML/ Plain Text 
description Optional String Description of the content block 
created_by Mandatory String Email id of the user who is creating the content block 
tag_ids Optional Array of strings Tags associated with the content block
team_ids Optional  Array of strings Teams for which the content block should be available. Passing team id is mandatory if you are using multiple teams. For more information, refer to Teams 
content_block_used Mandatory Array of string 

In case, you are using nested content blocks, provide the names of the other content blocks used in this content block

If you are not using nested content blocks, you can pass this as an empty array

content_block_used : []

 

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?