We’re running a cleanup script to decommission old agents. The goal is to remove the user account but keep the historical interaction data intact for compliance.
I’m using the standard DELETE endpoint:
DELETE /api/v2/users/{userId}
The request returns a 204 No Content. Success, right? Well, sort of. When I query the interaction history later, the participantId field in the JSON payload is still there, but it points to a user that no longer exists in the directory. The name field is blank. It’s basically a broken link.
I’ve tried setting the user to inactive first with a PATCH request:
{
"active": false
}
Waited 24 hours to let the system cess any background jobs. Then I sent the DELETE. Same result. The interaction records survive, which is good, but they’re disconnected from the user entity.
Is there a flag or a header I’m missing? I read somewhere about forceDelete but that seems to wipe everything, which we can’t do. We need the call recordings and chat transcripts to remain queryable by the agent’s name or ID.
Also, checked the SDK (Python genesyscloud). The delete_user method doesn’t have an obvious parameter for “preserve history”. It just takes the user ID and maybe a force flag.
api_instance.delete_user(user_id, force=False)
If I set force=True, does it actually delete the interactions? The docs are vague. “Permanently deletes the user” sounds scary when we have 2 years of chat logs tied to that ID.
Anyone found a way to cleanly sever the user account without turning the interaction history into a mess of null references? Or do we have to write a separate job to update the participantName in the interaction records before deleting the user? That seems like a hack.