Bulk-deleting Okta users requires an API client such as Postman. Users must be in a deactivated state before deletion. The process involves generating a Comma-Separated Values (CSV) file of user logins and executing a bulk deletion API call.
- Okta Identity Engine (OIE)
- Okta Classic Engine
- API
- User Administration
- Postman
How can an administrator bulk-delete users in Okta using an API client?
NOTE: Postman is used as an example API client in this article. Use an API client that best fits the organization's guidelines.
Generate a Comma-Separated Values (CSV) file containing the user logins, configure the API client with the appropriate headers, and execute the bulk deletion request using a collection runner.
-
Verify that the users are in a deactivated state. If the users are in any state other than deactivated, execute a POST request to deactivate them:
POST {{url}}/api/v1/users/{{username}}/lifecycle/deactivate
- Create a CSV file containing the logins of the users targeted for deletion. Generate this CSV by running the Okta Password Health Report from the Admin Console by navigating to Reports > Reports > Okta Password Health Report and selecting the users.
- Create the following DELETE call in the API client:
DELETE {{url}}/api/v1/users/{{username}}
- Configure the headers for the API call with the following values:
-
- Content-Type: application/json
- Accept: application/json
-
-
Create a new collection in the API client and add the required call.
-
Open the collection runner and select the collection, environment, and iterations. Add a delay between calls to avoid hitting the API Rate Limit.
-
Upload the CSV file and execute the call.
