You can use this API to store any communication sent to customers for later access. For more information, refer to Message Archival.
API Endpoint
POST https://api-0X.moengage.com/v1/archival/view
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 Base64_ENCODED_APPKEY_APIKEY=="}
The username and password details can be obtained from the MoEngage Dashboard. We've revamped the settings UI in the Dashboard. If you're using the API for the first time, follow these steps:
- 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 Data 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 |
---|---|---|---|
user_id | Required | String | This field denotes the unique identifier of the user. |
delivery_type | Required | String |
This field denotes the delivery type of the channel. Supported values are:
|
campaign_type | Required | String |
This field denotes the campaign type. Supported values are: Push:
SMS:
Email:
Alerts/Inform:
|
campaign_channel | Required | String |
This field denotes the campaign channel. Supported values are:
|
sent_epoch_time | Required | Integer |
This field denotes the sent time of the campaign. <how to fetch> |
campaign_id | Required | String | This field denotes the campaign ID. |
event_name | Required | String |
This field denotes the name of the event. Supported event names are:
|
platform | Required | String |
This field denotes the target platform of the campaign. Supported values are:
|
event_id | Optional | String |
This field denotes the event ID. This field is required for event-triggered campaigns.
|
Response
Key | Data Type | Description |
---|---|---|
message | String | This field contains a brief description of the request status in the case of success. |
error | JSON Object |
This field contains the reason for the request's failure. Structure: { The error object contains the following fields:
|
Response Codes
Status Code | Request State | Description |
---|---|---|
200 |
Success |
The server successfully processed the request, but is not returning any content. |
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. |
429 |
Too Many Requests |
A number of headers are returned in case of a rate-limit breach. |
502 |
Server Error |
Something went wrong on MoEngage. |
Rate Limit
The rate limit is 1000 RPM.
Sample cURL Request
SMS
curl --location 'https://api-0X.moengage.com/v1/archival/view' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"user_id": "{{User_ID}}",
"delivery_type": "ONE_TIME",
"campaign_type": "SMS",
"campaign_channel": "SMS",
"sent_epoch_time": 1716972486,
"campaign_id": "{{Campaign_ID}}",
"event_name": "SMS Sent",
"platform": "SMS",
"event_id": "{{Event_ID}}"
}'
curl --location 'https://api-0X.moengage.com/v1/archival/view' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"user_id": "{{User_ID}}",
"delivery_type": "ONE_TIME",
"campaign_type": "Email Campaign",
"campaign_channel": "EMAIL",
"sent_epoch_time": 1717150294,
"campaign_id": "{{Campaign_ID}}",
"event_name": "Email Sent",
"platform": "EMAIL"
}'
Push
curl --location 'https://api-0X.moengage.com/v1/archival/view' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"user_id": "{{User_ID}}",
"delivery_type": "ONE_TIME",
"campaign_type": "General Push Campaign",
"campaign_channel": "PUSH",
"sent_epoch_time": 1716915262,
"campaign_id": "{{Campaign_ID}}",
"event_name": "Notification Received Android",
"platform": "ANDROID"
}'
curl --location 'https://api-0X.moengage.com/v1/archival/view' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"user_id": "{{User_ID}}",
"delivery_type": "ONE_TIME",
"campaign_type": "General Push Campaign",
"campaign_channel": "PUSH",
"sent_epoch_time": 1717060428,
"campaign_id": "{{Campaign_ID}}",
"event_name": "Notification Sent iOS",
"platform": "IOS"
}'
curl --location 'https://api-0X.moengage.com/v1/archival/view' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
"user_id": "{{User_ID}}",
"delivery_type": "ONE_TIME",
"campaign_type": "General Push Campaign",
"campaign_channel": "PUSH",
"sent_epoch_time": 1717056071,
"campaign_id": "{{Campaign_ID}}",
"event_name": "Notification Received Web",
"platform": "WEB"
}'
Sample Response
{
"status": true,
"data": {
"message_details": {
"message_type": "campaign",
"message_id": "66560c2d2880326031c474a6",
"channel": "push",
"platform": "android",
"delivery_type": "ONE_TIME",
"sent_time": "Tue, 28 May 2024 22:24:22 IST",
"message_to": "cZug38RqRd2-cF30bd2vda:APA91bGEG-OHMiWV3eHd_ohLs8V-yTgDJuQXNV32jO13or-R118OAC65MXdSx5ozYsIiL-RFan_iflQ62XVX7T2BiNqqQQfKd3FitlpbLR7nVBdkFF1yv_s8pqZux-HfThn-ojhpBIWd",
"moe_event_id": null,
"service": {
"type": "FCM"
},
"template_info": {
"type": "Native",
"version": null,
"id": "stylizedbasic"
}
},
"message_content": {
"title": "expiry in 1 hour",
"summary": "expiry in 1 hour",
"message": "expiry in 1 hour",
"related_urls": [
"https://image-staging-ap1.moengage.com/checkfcsgainmoengage/20240527083246095196HE4ELHScreenshotofUploadyourAppDiawiDevelopmentandInhouseAppsWirelessInstallationjpgcheckfcsgainmoengage.jpg"
]
},
"backup_content": {
"title": "Stylized Android Template",
"summary": null,
"message": "Sample Stylized Android Template",
"related_urls": []
},
"file_info": {
"version": "v2",
"file_name": "66560c2d2880326031c474a6_pramodseg_1716915262_push_android.json"
}
}
}
{
"status": false,
"error_message": "This event is unsupported to view message copy. The supported events are ['Email Sent', 'SMS Sent', 'Notification Sent iOS', 'Notification Received Android', 'Notification Received Web']"
}
{
"status": false,
"error": Invalid data key
}
{
"title": "Server Error",
"description": "An unexpected error was encountered while processing this request. Please contact MoEngage Team",
"code": "BiaFuAzn-aefa0b0e-2c88-4106-8d07-0f0c53513e48"
}
Postman Collections
We have made it easy for you to test the APIs. Click here to view it in Postman.