How come this setting causes issues when attempting to delete a user via the API while preserving their historical interaction data?
We are managing user provisioning through a Terraform pipeline (CX as Code). When a user is removed from our source of truth, Terraform triggers a DELETE request to /api/v2/users/{userId}. The goal is to cleanly remove the active user record so it does not appear in active routing or directory lookups, but we strictly need to retain all historical conversation logs, email threads, and chat transcripts associated with that agent for audit and compliance purposes.
Currently, the API call succeeds with a 204 No Content status. However, during our subsequent data validation checks, we observe that while the user record is gone, the ownerId field on historical interactions becomes null or points to a generic system bucket. This breaks our internal reporting dashboards which rely on joining interaction data with user metadata (like name and department) for long-term trend analysis. We have reviewed the documentation regarding keepHistory or similar flags, but the standard user deletion endpoint does not expose such parameters in the request body.
Here is the simplified Terraform resource block and the resulting API behavior:
resource "genesyscloud_user" "agent" {
name = "Test Agent"
email = "[email protected]"
# ... other attributes
}
When this resource is destroyed, Terraform calls:
DELETE https://api.mypurecloud.com/api/v2/users/{userId}
Is there a specific sequence of API calls required? For instance, should we first transfer ownership of active interactions using /api/v2/users/{userId}/interactions/transfer before deleting? Or is there a hidden parameter in the user profile update that marks the user for ‘soft delete’ while keeping their ID stable for historical joins? We want to avoid writing a custom lambda function to re-assign history just to maintain referential integrity.
Thank you for the help.