Overview

Data API helps in sending events and user details from your servers to the MoEngage servers. Data API is a collection of the following APIs:

info

Information

For workspaces in MoEngage with the User Identity Resolution feature enabled, the following Data APIs can be used to create or update users using a specific identifier, such as a mobile number or email ID, as configured in Settings > Data > Identity Resolution:

For more information, refer to User Identity Resolution.

 

In MoEngage, data ingestion uses ID by default to create or update a user. For workspaces in MoEngage with Identity Resolution enabled, Data APIs (Track User, Create Event, Bulk Import) can be used to create or update users using a specific identifier, such as a mobile number or email ID, as activated in the Identity Resolution dashboard.

You can:

  • Create users through Server-to-Server Data APIs even when they do not have an ID (but have other identifiers).
  • Create a user or track events of a user when identifiers other than ID (for example, email ID or phone number) are known.

Request Headers

Header Sample Value Description
Authorization {"Authorization": "Basic Base64_ENCODED_WORKSPACEID_APIKEY="} Basic authentication is used for access control.
Content-Type {"Content-Type": "application/json"} Set the Content-Type header to application/JSON for using the Data API.
MOE-APPKEY

{"MOE-APPKEY": "Workspace ID"}

Set the MOE-APPKEY header available at Settings > Account > APIs > API Keys > Data.

Authentication

You can obtain the username and password details from the MoEngage Dashboard.

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_WORKSPACEID_APIKEY=="}

The username and password details can be obtained from the MoEngage Dashboard. If you're using the API for the first time, follow these steps:

  1. Navigate to Settings -> Account -> APIs.
  2. 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.
  3. Use these details to authenticate the API requests.
warning

Warning

Once you generate and save the Data API Key, please DO NOT generate a new key unless there is a security breach. Once you generate a different Data API key and save it, your existing data tracking will need to be updated as the authentication will start failing.

APIs.png

Authentication is performed using a client like Postman as follows:

Screenshot 2025-11-24 at 3.27.23 PM.png

Request Body

The request body contains the mandatory field called customer_id. customer_id is the unique identifier set and passed on from the MoEngage SDK as USER_ATTRIBUTE_UNIQUE_ID and is visible on the dashboard as ID.

customer_id is used to

  • Identify or create a user in MoEngage
  • Associate the events to the corresponding unique user profiles in MoEngage.

On receiving a Data API request in MoEngage, the customer_id is used to verify if the user exists in MoEngage. If the user does not exist, a new user is created with the attributes or events.

info

Note

  • The maximum limit for the request body is 128 KB.
  • Any string of more than one characters is allowed for customer_id except the following values - ['unknown', 'guest', 'null', '0', '1', 'true', 'false', 'user_attribute_unique_id', '(empty)', 'na', 'n/a', '', 'dummy_seller_code', 'user_id', 'id', 'customer_id', 'uid', 'userid', 'none', '-2', '-1', '2']

For example, a user created using the following request is visible in the dashboard user profile as displayed.

Sample Request Body 

Below is a sample request body for the Create User API

JSON
{
"type" : "customer",
"customer_id": "USERID1234",
"attributes": {
    "first_name":"John",
    "name":"John Smith",
    "plan_expiry_date":"2020-05-31T00:00:00Z",
    "super_user":true,
    "user_persona":"browsers",
    "platforms" : [{"platform":"ANDROID", "active":"true"}]
    }
}

 

info

Note

You can not use "moe_" as a prefix while naming events, event attributes, or user attributes. It is a system prefix and using it might result in periodic blacklisting without prior communication.

Supported Datetime Formats

You can pass the datetime in the following formats in the request body:

Datetime Format Example
“datetime_format”:YYYY-MM-DD[T]HH:mm:ss[Z]

2019-03-12T17:36:05Z

“datetime_format”: "YYYY-MM-DD"

2022-01-22

 

info

Information

MoEngage performs the following validation on datetime formats before ingesting data into its system:

  • Future and past date values are accepted and ingested.
  • Any date values with incorrect calendar values (e.g., 2019-15-12 where 15 is not a valid month) are ingested as strings.
  • Any datetime values incompatible with the formats mentioned above are converted to strings and then ingested.

Response

Response to the Data API is a JSON object. On a successful data API request, you will receive the following response:

JSON
{
"status":"success",
"message": "Your request has been accepted and will be processed soon."
"request_id": "kXwpDESb"
}

On a failed data API request, you will receive the following response:

JSON
{
  "status":"fail", 
  "error":{ 
    "type": "TypeError",
    "message":"expected string"
"request_id": "kXwpDESb } }

Response Codes

The following status codes and associated error messages are returned when the request results in a fatal error.

Error Code Type Message Description
400 Missing header value The Content-Type Header is required The header value for content type is missing
400 Empty request body A valid JSON document is required The request body is empty
400 Malformed JSON Could not decode the request body. The JSON was incorrect or not encoded as UTF-8. The request JSON is not formed correctly
400 Blacklisted Your account is blacklisted, Please contact MoEngage. Your App is blacklisted in MoEngage
400 InvalidParams Given app_id is invalid. The App ID is invalid.
400 ParamsRequired app_id is required in path/query params. App ID is missing in the path or query params.
400 Empty request body A valid JSON document is required The request body is empty.
400 Body type is not JSON A valid JSON document is required. String Payload.
400 MissingAttributeError {{key}} is expected to be {{datatype}} The specified attributes are invalid
401 Authentication Required Authentication Header Required Authentication header is missing from the request.
401 Authentication required No identity information found Authentication header is empty.
401 Authentication required Invalid identity information found Failure to decode app_key and app_secret.
401 Authentication required APP_KEY missing in the authentication header App_key is not present in the authentication header.
401 Authentication required APP_SECRET missing in the authentication header App_secret is not present in the authentication header.
401 Authentication required App Secret key mismatch. Please login to the dashboard to verify key App secret key is wrong.
401 Authentication required Invalid APP_ID used in Authentication Header You have used an invalid APP ID in the authentication header.
403 Account Suspended Account Suspended Your account is suspended.
403 Account Temporarily Suspended Account Temporarily Suspended Your account is suspended temporarily.
409 Authentication Mismatch App key mismatch in params and authentication App_key in parameters and authentication does not match.
409 Authentication required App Secret key is not set. Please login to the dashboard to set a key App Secret not set.
413 Payload too large The payload can not exceed 128KB Request payload size is too large.
415 Unsupported Media Type Unsupported Media Type Unsupported media type.
429 Rate Limit Exceeded Rate Limits for User / Event exceeded You have exceeded the rate limits (number of users or events per minute) defined for your MoEngage account.
5xx Server Error Any other exception This response is returned when the system runs into an unexpected error. We recommend that you retry every 2 seconds for a maximum of 5 times in such cases.

Rate Limit Headers

When you make a request to the Data APIs, MoEngage returns specific rate-limiting information within the Response Headers. These headers allow you to programmatically monitor your API usage and prevent hitting your workspace limits.
Rate limit headers.png

You can track your usage using the following three headers:

Header Key Description
x-ratelimit-limit The maximum number of users/events for your workspace within a specific time window. This includes a w=60 parameter, which indicates that the rate limit window resets every 60 seconds.
x-ratelimit-remaining The exact number of users/events you have left to use within the current minute window.
x-ratelimit-reset A countdown timer (in seconds) indicating how much time is left until the current rate limit window expires and your users/events count resets.

Example Scenario
Based on a typical API response, here is how to interpret these values in real-time:

  • x-ratelimit-limit: 31500; w=60
    This means your workspace is permitted to make 31,500 events every 60 seconds (w=60).
  • x-ratelimit-remaining: 31499
    This means you have successfully made a request with 1 event in the current window, leaving you with 31,499 events available before you are throttled.
  • x-ratelimit-reset: 29
    This means you have exactly 29 seconds left until the current time window ends. Once this hits 0, your x-ratelimit-remaining will automatically reset back to 31,500.

User Attributes

Key name Display name Fetch through Get User API  Update through Track User API  Create through Track User API
publisher_name Publisher Name yes no yes
campaign_name Campaign Name yes no yes
t_rev LTV yes no no
t_trans No of Conversions yes no no
moe_ip_city Last Known City yes no no
moe_ip_pin Last Known Pincode yes no no
moe_ip_subdivision Last Known State yes no no
moe_ip_country Last Known Country yes no no
moe_dtzo User Timezone Offset (Mins) yes no no
u_s_c No. of Sessions yes no no
u_l_a Last Seen yes no yes
cr_t First Seen yes no yes
u_mb Mobile Number (Standard) yes yes yes
uid ID yes yes yes
u_bd Birthday yes yes yes
u_em Email (Standard) yes yes yes
locale_language_display Local Language yes no no
locale_country_display Local Country yes no no
uninstall_time Uninstall time yes no no
installed Install Status yes no no
moe_cr_from User Creation Source yes no no
u_n Name yes yes yes
u_ln Last Name yes yes yes
u_gd Gender yes yes yes
u_fn First Name yes yes yes
geo Geolocation yes no no
moe_wa_subscription WhatsApp Subscription Status yes yes yes
moe_em_unsub_categories Email Unsubscribed Categories yes yes yes
moe_gaid Google Advertising ID (Android) yes no yes
advertising_identifier Advertising Identifier (iOS &Windows) yes no yes
web subscription url Web Push Subscription Page URL - - -
moe_sub_w Web Push Subscription Status yes yes yes
moe_w_ds Browser Details yes no no
moe_mweb Mobile User yes no yes
moe_i_ov OS Version iOS - - -
moe_it Creation Source no no no
moe_spam Spam yes yes yes
moe_unsubscribe Unsubscribe yes yes yes
moe_hard_bounce Hard Bounce yes yes yes
moe_rsp_android Reachability Push Android yes no no
moe_rsp_ios Reachability Push iOS yes no no
moe_rsp_web Reachability Push Web yes no no
moe_rsu Reachability Push yes no no
moe_sms_subscription SMS Subscription Status yes yes yes
moe_ds_bts_push_hour Best time to send Push yes no no
moe_ds_bts_email_hour Best time to Email yes no no
moe_ds_bts_sms_hour Best time to send SMS yes no no
moe_ds_mpc_best_channel Most Preferred Channel yes no no

Dashboard User Profile

On sending data through the data API, it will be populated in the user profile as shown below:

new user profile.png

Limits

The Data API is designed to handle high volumes of data across our customer base. We enforce API limits to ensure responsible use of the API.

The following table describes the recommended rate limits of the Data APIs:

API Name Rate Limit Description
Track User 10,000 users/min A single API request contains one or more user updates. Maintain a rate limit of 10,000 user updates per minute.
Create Event 30,000 events/min A single API request contains one or more events. Maintain a rate limit of 30,000 events per minute.
Track Device 10,000 devices/min A single API request contains one or more device updates. Maintain a rate limit of 10,000 device updates per minute.
Bulk Import 10,000 users/min 30,000 events/min A single bulk import API contains users, devices, and events together. Send a maximum of 10,000 users and 30,000 events per minute across all API requests.
info

Note

  • The values mentioned above are default limits. If your requirement exceeds these limits, you can get in touch with the MoEngage support team to increase the limits.
  • Make sure to adhere to the Fair Usage Policy (FUP) for high-frequency user data ingestion. This is mandatory to prevent disruption to data processing in your workspace. For more information, refer to the Fair Usage Policy (FUP).

 

Previous

Next

Was this article helpful?
7 out of 16 found this helpful

How can we improve this article?