You can use the Get Campaign Details API to fetch the list of campaigns with all the current fields and the current status. You can pass multiple filters in this API to fetch a particular campaign.
info |
Information
|
API Endpoint
POST https://api-0X.moengage.com/core-services/v1/campaigns/search
Each customer is hosted on a different data center; you can find your data center number (value of X) by checking the data center and API endpoint mapping page.
Authentication
The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:
{"Authorization":"Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}
You can obtain the username and password details from the MoEngage Dashboard.
- Navigate to Settings -> Account -> APIs.
- Copy the following details:
- Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
- Password: In the API keys section, click the copy icon in the Campaign report/Business events/Custom templates tile to copy the API key.
- Use these details to authenticate the API requests.
Request Headers
Key | Required | Sample Values | Description |
---|---|---|---|
Content-Type |
Required |
{"Content-Type": "application/json"} |
Set the Content-Type header to application/json. |
Authorization |
Required |
{"Authorization": "Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U=="} |
This authentication parameter, used for access control, must be passed in the request. To generate the authentication header, refer to Authentication. |
MOE-APPKEY | Required |
{“MOE-APPKEY”: “Workspace ID”} |
This is the workspace ID (earlier APP ID) of your MoEngage workspace. The MOE-APPKEY has to be passed in the request. You can find your MoEngage Workspace ID in the MoEngage Dashboard:
Settings -> Account -> APIs -> Workspace ID (earlier app id) For more information, refer to Authentication. |
Request Body
Key | Required | Values | Description |
---|---|---|---|
campaign_fields | Optional | JSON Object | This object contains the campaign fields. For more information, refer to Campaign Fields Details. |
limit | Required | Number |
This field denotes the number of campaigns to be displayed on a page. Note: The maximum limit is 15. |
page | Required | Number | This field denotes the number of pages to display the campaigns based on the limit. For example, if there are 200 campaigns and you set the limit to 10, there will be 20 pages. |
request_id | Required | String | This field denotes the request ID for which the campaign is fetched. |
Campaign Fields Details
The campaign_fields JSON object contains the following information:
Key | Required | Values | Description |
---|---|---|---|
channels | Optional | Array | This field denotes the type of channel. For example, EMAIL |
created_by | Optional | Array |
This field denotes the Email ID of the user who created the campaign. Note: Supported value is email ID only. |
created_date | Optional | JSON Object |
This field denotes the campaign created date. This object contains the following fields:
|
delivery_type | Optional | Array | This field denotes the delivery type of the campaign. Supported values are:
|
id | Optional | String | This field denotes the ID of the campaign. |
name | Optional | String | This field denotes the name of the campaign. |
status | Optional | Array | This field denotes the status of the campaign. For example, Active. |
tags | Optional | Array | This field denotes the tags added in the campaign. |
Response
Key | Data Type | Description |
---|---|---|
message | JSON Object |
This field contains a brief description of the request status in the case of success. For more information, refer to Response Codes. |
error | JSON Object |
This field contains the reason for the request's failure. Structure: "error": { "code": "<error_code>", "message": "<error_message>", "target": "<target>", "details": [ { "target": "<target>", "message": "<error_message>" } ], "request_id": "<request_id>" } } The error object contains the following fields:
|
Response Codes
Status Code | Request State | Description |
---|---|---|
200 |
Success |
This response is returned when the request is processed successfully. For more information, refer to 200 - Success Response. |
400 |
Bad Request |
This response is returned when the required parameters are missing from the request, or when the provided parameters are invalid, or when a template already exists with the same version, name, or id. |
401 |
Authentication Failure |
This response is returned when the authorization parameters are missing in the HTTP Auth Header. |
500 |
Internal Server Error |
This response is returned when the system runs into an unexpected error. |
200 - Success Response
Key | Values | Description |
---|---|---|
campaign_id | String | This field indicates the campaign ID. |
status | String | This field indicates the status of the campaign. For example, Active, Scheduled, Paused, Sent, and Stopped. |
basic_details | JSON Object | This object contains the basic details of the campaign. For more information, refer to Basic Details. |
campaign_content | JSON Object | This object contains the campaign content. For more information, refer to Campaign Content. |
connector | JSON Object |
This object contains the connector details. For more information, refer to Connector Details. |
campaign_delivery_type | String |
This field indicates the campaign delivery type. For example, ONE_TIME. |
channel | String | This field indicates the channel. For example, EMAIL. |
control_group_details | JSON Object | This object contains the control group details. For more information, refer to Control Group Details. |
conversion_goal_details | JSON Object | This object contains the conversion goal details. For more information, refer to Conversion Goal Details. |
created_by | String |
This field indicates the Email of the user who created the campaign. |
updated_by | String | This field indicates the Email of the user who updated the campaign. |
created_at | String | This field indicates the time when the campaign was created. |
updated_at | String | This field indicates the time when the campaign was updated. |
sent_time | String | This field indicates the time when the campaign was sent. |
delivery_controls | JSON Object | This object contains the delivery controls details. For more information, refer to Delivery Controls. |
scheduling_details | JSON Object | This object contains the scheduling details. For more information, refer to Scheduling Details. |
segmentation_details | JSON Object |
This object contains the segmentation details. For more information, refer to Segmentation Details. |
trigger_condition | JSON Object | This object contains the trigger condition details. For more information, refer to Trigger Conditions. |
Sample cURL Request
The following are sample codes to:
- Get campaigns by the channel
- Get campaigns by the delivery type
- Get campaigns by the created date
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns/search' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"campaign_fields": {
"channels": [
"EMAIL"
]
},
"limit": 5,
"page": 1,
"request_id": "12345"
}'
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns/search' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"campaign_fields": {
"delivery_type": [
"PERIODIC"
]
},
"limit": 15,
"page": 1,
"request_id": "12345"
}'
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns/search' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"campaign_fields": {
"delivery_type": [
"PERIODIC"
],
"created_date": {
"from_date": "16-06-2024",
"to_date": "21-06-2024"
}
},
"limit": 15,
"page": 1,
"request_id": "12345"
}'
Sample Response
[
{
"channel": "EMAIL",
"created_by": "john.doe@example.com",
"campaign_delivery_type": "PERIODIC",
"basic_details": {
"name": "happy flow campaigns api",
"content_type": "PROMOTIONAL",
"team": "campaign_core",
"tags": [
"activation"
],
"subscription_category": "music",
"user_attribute_identifier": "MOE_EMAIL_ID"
},
"segmentation_details": {
"is_all_user_campaign": false,
"included_filters": {
"filter_operator": "and",
"filters": [
{
"data_type": "string",
"category": "Tracked Standard Attribute",
"name": "u_em",
"filter_type": "user_attributes",
"case_sensitive": false,
"operator": "exists",
"negate": false
}
]
},
"excluded_filters": {}
},
"control_group_details": {
"is_global_control_group_enabled": false,
"is_campaign_control_group_enabled": true,
"campaign_control_group_percentage": 2.0
},
"utm_params": {},
"connector": {
"connector_type": "SENDGRID",
"connector_name": "default"
},
"campaign_content": {
"locales": [
"default",
"karnataka",
"SampleTest"
],
"variation_details": {
"_id": "66865b85334643c3eb73ba73"
},
"content": {
"karnataka": {
"email": {
"subject": "abca locale karntaka",
"preview_text": "abc",
"sender_name": "abc",
"from_address": "john.doe@example.com",
"reply_to_address": "john.doe@example.com",
"html_content": "<!DOCTYPEhtml><html><head><metahttp-equiv=\"Content-Type\"content=\"text/html; charset=UTF-8\"><title></title><style>bodytable{border-collapse:collapse;}bodytabletd,bodytableth{border:1pxsolidrgb(221,221,221);}</style></head><bodyaria-disabled=\"false\"><p><spanclass=\"fr-marker\"data-id=\"0\"data-type=\"true\"style=\"display: none; line-height: 0;\"></span>hey</p><p>Userattribute- {{UserAttribute['First Seen']}} {{UserAttribute['product_id']}}</p><p>Eventattribute-no</p><p>Contentblock- {{ContentBlock['test']}}{{ContentBlock['22Duplicate_Wilber_Plain_text_06_07_2023_83596']}}</p><p>Auxdatamapping-{%set Core_devTest_fileData=UserAttribute['uid']|getAuxData('Core_devTest_file')%} {{Core_devTest_fileData.random_data}}</p><p>Contentapi- {%set var=ContentApi.migration_content_api({({"params":{"q":"London,uk","appid":"e81e3dcdf2845b441d22458d2cc02bb6"},"static_params":{},"dynamic_params":{},"request_body":{}})})%} {{var}} </p><p>productset-{%if ProductSet.test_migration_product_sets%}{%for product in ProductSet.test_migration_product_sets%}{%endfor%}{%else%}MOE_NOT_SEND{%endif%}<spanclass=\"fr-marker\"data-id=\"0\"data-type=\"false\"style=\"display: none; line-height: 0;\"></span></p></body></html>",
"attachments": []
}
},
"SampleTest": {
"email": {
"subject": "abca locale sample",
"preview_text": "abc",
"sender_name": "abc",
"from_address": "john.doe@example.com",
"reply_to_address": "john.doe@example.com",
"html_content": "<!DOCTYPEhtml><html><head><metahttp-equiv=\"Content-Type\"content=\"text/html; charset=UTF-8\"><title></title><style>bodytable{border-collapse:collapse;}bodytabletd,bodytableth{border:1pxsolidrgb(221,221,221);}</style></head><bodyaria-disabled=\"false\"><p><spanclass=\"fr-marker\"data-id=\"0\"data-type=\"true\"style=\"display: none; line-height: 0;\"></span>hey</p><p>Userattribute- {{UserAttribute['First Seen']}} {{UserAttribute['product_id']}}</p><p>Eventattribute-no</p><p>Contentblock- {{ContentBlock['test']}}{{ContentBlock['22Duplicate_Wilber_Plain_text_06_07_2023_83596']}}</p><p>Auxdatamapping-{%set Core_devTest_fileData=UserAttribute['uid']|getAuxData('Core_devTest_file')%} {{Core_devTest_fileData.random_data}}</p><p>Contentapi- {%set var=ContentApi.migration_content_api({({"params":{"q":"London,uk","appid":"e81e3dcdf2845b441d22458d2cc02bb6"},"static_params":{},"dynamic_params":{},"request_body":{}})})%} {{var}} </p><p>productset-{%if ProductSet.test_migration_product_sets%}{%for product in ProductSet.test_migration_product_sets%}{%endfor%}{%else%}MOE_NOT_SEND{%endif%}<spanclass=\"fr-marker\"data-id=\"0\"data-type=\"false\"style=\"display: none; line-height: 0;\"></span></p></body></html>",
"attachments": []
}
},
"email": {
"subject": "abca locale default",
"preview_text": "abc",
"sender_name": "abc",
"from_address": "john.doe@example.com",
"reply_to_address": "john.doe@example.com",
"html_content": "<!DOCTYPEhtml><html><head><metahttp-equiv=\"Content-Type\"content=\"text/html; charset=UTF-8\"><title></title><style>bodytable{border-collapse:collapse;}bodytabletd,bodytableth{border:1pxsolidrgb(221,221,221);}</style></head><bodyaria-disabled=\"false\"><p><spanclass=\"fr-marker\"data-id=\"0\"data-type=\"true\"style=\"display: none; line-height: 0;\"></span>hey</p><p>Userattribute- {{UserAttribute['First Seen']}} {{UserAttribute['product_id']}}</p><p>Eventattribute-no</p><p>Contentblock- {{ContentBlock['test']}}{{ContentBlock['22Duplicate_Wilber_Plain_text_06_07_2023_83596']}}</p><p>Auxdatamapping-{%set Core_devTest_fileData=UserAttribute['uid']|getAuxData('Core_devTest_file')%} {{Core_devTest_fileData.random_data}}</p><p>Contentapi- {%set var=ContentApi.migration_content_api({({"params":{"q":"London,uk","appid":"e81e3dcdf2845b441d22458d2cc02bb6"},"static_params":{},"dynamic_params":{},"request_body":{}})})%} {{var}} </p><p>productset-{%if ProductSet.test_migration_product_sets%}{%for product in ProductSet.test_migration_product_sets%}{%endfor%}{%else%}MOE_NOT_SEND{%endif%}<spanclass=\"fr-marker\"data-id=\"0\"data-type=\"false\"style=\"display: none; line-height: 0;\"></span></p></body></html>",
"attachments": []
}
}
},
"conversion_goal_details": {
"attribution_window_in_hours": 39,
"goals": [
{
"goal_name": "Goal 1",
"goal_event_name": "NOTIFICATION_RECEIVED_MOE",
"goal_event_attribute": {
"name": "moe_campaign_channel",
"condition": "is",
"value": "2",
"is_case_sensitive": true,
"data_type": "STRING",
"negate": false,
"_id": "66865b85334643c3eb73ba7b"
},
"is_primary_goal": true,
"revenue_attribute": "moe_device_densitydpi",
"revenue_currency": "ALL",
"_id": "66865b85334643c3eb73ba82"
},
{
"goal_name": "Goal 2",
"goal_event_name": "testevent",
"goal_event_attribute": {
"name": "sdkVersion",
"condition": "is",
"value": "2.2",
"is_case_sensitive": true,
"data_type": "STRING",
"negate": false,
"_id": "66865b85334643c3eb73ba7e"
},
"is_primary_goal": false,
"_id": "66865b85334643c3eb73ba83"
},
{
"goal_name": "Goal 3",
"goal_event_name": "USER ENTERED FLOW",
"goal_event_attribute": {
"name": "user_entry_identifier",
"condition": "is",
"value": "2",
"is_case_sensitive": true,
"data_type": "STRING",
"negate": false,
"_id": "66865b85334643c3eb73ba81"
},
"is_primary_goal": false,
"_id": "66865b85334643c3eb73ba84"
}
]
},
"scheduling_details": {
"delivery_type": "AT_FIXED_TIME",
"start_time": "2024-07-04T20:32:00",
"expiry_time": "2034-06-07T20:32:00",
"user_timezone_details": {
"send_in_user_timezone": false,
"send_if_user_timezone_has_passed": true
},
"periodic_details": {
"sending_frequency": "MONTHLY",
"repeat_frequency": 1,
"repeat_on_days_of_week_for_month": [
{
"week_granularity": "FIRST",
"repeat_on_days_of_week": [
"TUESDAY",
"FRIDAY"
]
},
{
"week_granularity": "THIRD",
"repeat_on_days_of_week": [
"TUESDAY",
"MONDAY"
]
},
{
"week_granularity": "SECOND",
"repeat_on_days_of_week": [
"TUESDAY",
"THURSDAY"
]
},
{
"week_granularity": "FOURTH",
"repeat_on_days_of_week": [
"TUESDAY",
"WEDNESDAY"
]
},
{
"week_granularity": "LAST",
"repeat_on_days_of_week": [
"SATURDAY",
"FRIDAY"
]
}
],
"no_of_occurences": 3
}
},
"delivery_controls": {
"bypass_dnd": false,
"ignore_frequency_capping": true,
"count_for_frequency_capping": true,
"minimum_delay_between_two_notification_in_hour": 2,
"campaign_throttle_rpm": 3000
},
"campaign_id": "{Campaign_ID}",
"status": "Active",
"created_at": "2024-07-04 08:00:54.847000",
"sent_time": "2024-07-04 20:32:00"
}
]
{
"error": {
"code": "400 Bad Request",
"message": "request_id key is mandatory field",
"target": "request_id",
"details": [
{
"target": "request_id",
"message": "request_id key is mandatory field"
}
],
"request_id": "11"
}
}
{
"error": {
"code": "401 Authentication error",
"message": "Authentication required",
"details": [
{
"code": "InvalidValue",
"target": "APP_SECRET_KEY",
"message": [
{
"code": "InvalidValue",
"target": "APP_SECRET_KEY",
"message": "Invalid APP_SECRET_KEY is provided."
}
]
}
],
"request_id": ""
}
}
{
"error": {
"code": "500 Internal Server Error",
"message": "Something went wrong. Please contact Moengage team",
"target": "string",
"details": [
{
"message": "Expecting value: line 1 column 1 (char 0)",
"target": ""
}
]
}
}
Postman Collections
We have made it easy for you to test the APIs. Click here to view it in Postman.