Why does this setting prevent me from deleting a user via the API without losing their historical interaction data? I am building an n8n workflow to automate user offboarding. The requirement is to remove the user’s access but retain all past conversations and analytics data associated with their user ID.
I am using the standard DELETE endpoint: DELETE /api/v2/users/{userId}. According to the documentation, this should deactivate the user, but I am receiving an HTTP 403 Forbidden error when the user has active permissions or is part of a routing group.
Here is the configuration for the HTTP node in my n8n workflow:
{
"node": "http_request",
"method": "DELETE",
"url": "https://api.mypurecloud.com/api/v2/users/{{ $json.userId }}",
"headers": {
"Authorization": "Bearer {{ $json.token }}",
"Accept": "application/json"
}
}
I have tried removing the user from all routing groups and queues prior to deletion, but the error persists. Is there a specific sequence of API calls required to safely delete a user while preserving their historical data integrity, or am I missing a header parameter? I need to ensure the workflow handles this gracefully without manual intervention.