We’re building an automated cleanup job using the Genesys Cloud Python SDK to remove inactive users. The goal is to keep our OpenTelemetry trace correlation intact for historical data. If we just delete the user, the userId in older interactions becomes a dangling reference, which breaks our span propagation logic when we replay traces in Jaeger.
I’ve been looking at the delete_users_user method in the SDK. It seems pretty destructive. Is there a soft-delete option or a specific API call that archives the user instead? I want the user to be gone from the active directory but still queryable for historical analytics.
Here’s the current code snippet I’m testing:
from genesyscloud import Configuration, ApiClient, UsersApi
config = Configuration()
config.host = 'https://api.mypurecloud.com'
config.access_token = get_access_token()
api_client = ApiClient(config)
users_api = UsersApi(api_client)
try:
# Attempting to delete user ID 1234567890
users_api.delete_users_user(user_id='1234567890')
print('User deleted successfully')
except Exception as e:
print(f'Error deleting user: {e}')
When I run this, it succeeds with a 200 OK. But when I query the interaction history later, the user details are missing. I need the interaction records to still point to a valid user object, even if that user is marked as inactive or archived.
I checked the PATCH /api/v2/users/{userId} endpoint. It allows updating isActive to false. That seems safer. But does that actually remove the user from licensing counts? If I just deactivate them, they still count against our seat limits. I need to free up the license but keep the historical data linked.
Is there a two-step process I’m missing? Like deactivate first, wait for a grace period, then delete? Or is there a different endpoint for archiving? I don’t want to break our trace IDs.