Merge Users
This API merges two users in MoEngage based on their ID, which is a client-defined identifier for a user. You can use this API when multiple profiles have been created for a single user. For example, you can merge a user registered once with a mobile number and once with an email ID. You can also merge duplicate users created due to integration or tech issues.
Types of user merging in MoEngage
- Default or normal merge:
- MoEngage merges users with the same ID.
- Happens automatically, and no action is required from your side.
- Manual merge:
- MoEngage merges users having different IDs.
- Does not happen automatically; you must call the Merge User API with the list of users to be merged along with their IDs.
Rate limit
The rate limit is 1000 user updates per minute.Authorizations
Authentication is done via Basic Auth. This requires a base64-encoded string of your credentials in the format 'username:password'.
- Username: Use your MoEngage workspace ID (also known as the App ID). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
- Password: Use your API Key, which you can find within the Data tile.
Note: After you generate and save the Data API Key, DO NOT generate a new key unless there is a security breach. After you generate a different Data API key and save it, the authentication will start failing. You must update your existing data tracking.
For more information on authentication and getting your credentials, refer here.
Query Parameters
This is the Workspace ID of your MoEngage account that must be passed with the request. You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
Body
This field contains the list of UID pairs of the users who are to be merged.
Example:
{
"merge_data": [ // All the different pairs of users to merge
{
"merged_user": "<sample_uid>", // This user will merge into below user
"retained_user": "<sample_uid>" // Above user will merge into this user
},
{
"merged_user": "<sample_uid>", // This user will merge into below user
"retained_user": "<sample_uid>" // Above user will merge into this user
}
]
}- Every object in the Array contains a pair of UID strings - the ‘merged_user’ and the ‘retained_user’.
- UID is the unique identifier for a user maintained by you. MoEngage stores this identifier in the ID attribute in the user profile.
- If the merging of any user fails in the array, it will skip that object and continue with others.
Response
This response is returned when the request is processed successfully.
This field contains the status of the request and specifies whether the request was successful. Supported values are : "success", "failure"
"success"
This field contains “created” when there is no error in the payload, and the user merge is successful.
"created"