Question: Is there a way to get a deleted user back when it was deleted by accident?
Reply: Yes, under very specific circumstances and timing matters.
The data after deleting a user
Deleting a user (regularely via API) will put them into the status of being "soft-deleted" first. This ensures the instant removal from segments and dispatches, so the users are gone for any practical purposes and can't be found anymore. But that doesn't mean the data is fully gone yet from every bit of the system.
To remove the data of a user forever requires a more ressource intensive process that doesn't run with every deletion, but every few days instead. Until this process was executed, it is possible to get a user and all its events back. But once the process ran, the data is gone forever.
How to resurrect a user
In order to resurrect one or more user, you need to use the API with the User-Batch Endpoint ("Bulk user management") and you need to know the original XNG ID (and External Id) of this user.
{
"updated": [
{
"id": "abcdef",
"xngId": "8bfea427-163a-4d3d-a317-730f3e318708",
"email": "abcdef@example.com"
},{
"id": "ghijk",
"xngId": "cc662412-bbf2-4b4a-8b9b-4fe0087345f5",
"email": "ghijk@example.com"
}
],
"deleted": []
}
This should resurrect the user, so they are available in the app again. In some cases it can take a few hours until everything is visible again though.
Context about the ids
Some ids have different names in different places, depending on the context. In this example "id" and"xngId" for the API are visible as "externalId" and "xngGlobalUserId" in the user profiles.