<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How to Bulk Delete Okta Users Using an API Client
Administration
Okta Classic Engine
Okta Identity Engine
Overview

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.

Applies To
  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • API
  • User Administration
  • Postman
Solution

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.



  1. 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

  2. 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.
  3. Create the following DELETE call in the API client:
     

    DELETE {{url}}/api/v1/users/{{username}}

  4. Configure the headers for the API call with the following values:
      • Content-Type: application/json
      • Accept: application/json


    Delete API Call 

  5. Create a new collection in the API client and add the required call.

  6. Open the collection runner and select the collection, environment, and iterations. Add a delay between calls to avoid hitting the API Rate Limit
    Run Bulk Delete  

  7. Upload the CSV file and execute the call.
    CSV file 

Related References

Loading
How to Bulk Delete Okta Users Using an API Client