<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

Bulk Delete Mistakenly Imported Okta Users

Okta Classic Engine
Okta Identity Engine
Lifecycle Management
Automations

Overview

An incorrect import process populates the Okta directory with unwanted user accounts from incorrect Organizational Units (OUs). Resolve this issue by using the Rockstar browser extension or the Okta API to download a report of all imported users from a specific date, and then bulk-delete them using an API client.

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • User Management
  • Directories
  • Application Programming Interface (API)

Cause

An administrator accidentally imports users from incorrect Organizational Units (OUs) into Okta.

Solution

How does the Rockstar browser extension identify and export mistakenly imported users?

Install the Rockstar browser extension, navigate to the Okta directory, and execute a search query to export a Comma-Separated Values (CSV) file containing the mistakenly imported users.

  1. Install the Rockstar Browser Extension.
  2. Navigate to Directory > People and click Export Users in the Rockstar pop-up menu.
    Export Users 
  3. Enter the following query in the Query, Filter, or Search field to search for users created on a specific date:
    search=created ge "2026-07-07T00:00:00.000Z" and created lt "2026-07-08T00:00:00.000Z"

    NOTE: Adjust the dates in the query to reflect when the unwanted users were created or imported into Okta. The ge parameter includes every user created on or after the beginning of the specified date. The lt parameter excludes any user created once the following date begins, capturing the entire 24-hour block. The Z parameter ensures the query uses Coordinated Universal Time (UTC).


Query Search 

  1. Click Export to download the CSV report containing all users created on the specified date and time.

 

Deactivate and Delete the Exported Users Using an API Client

Configure an API client (for example, Postman) to send POST and DELETE requests to the Okta API, and run a collection using the exported CSV file to bulk deactivate and delete the users. Ensure the selected tool fits the organization's guidelines.

  1. Open an API client and create a new request in the Okta workspace.
  2. Set the method to POST and the URL to:
    {{url}}/api/v1/users/{{Username}}/lifecycle/deactivate
  3. Ensure the API client environment contains the properly configured Okta API token and URL.
  4. Set the following Headers: Accept: application/json, Content-Type: application/json, and Authorization: SSWS {{api_token}}.
    Headers 
  5. Save this request into a new folder or collection named Okta Cleanup or Bulk Delete Users, and title the request Deactivate bulk users.
  6. Create another request, set the method to DELETE, and set the URL to:
    {{url}}/api/v1/users/{{Username}}
  7. Ensure the request uses the same headers and save the request to the same collection as the previous step, titling it Delete Bulk Users.
    Headers2 
  8. Select the Okta Cleanup or Bulk Delete Users folder on the left side menu of the API client.
  9. Click the Run button.
    Delete Bulk Users
  10. Click Select File on the right side of the new runner window and select the previously exported CSV file.
    Select File 
  11. Click Run Bulk Delete Users to deactivate and delete the users listed in the CSV file. The API client displays the following results:
    Run Bulk Delete Users 
  12. Verify the removal of the users in the Admin Console or check the System Log using the following query:
    eventType eq "user.lifecycle.delete.completed"
Loading
Okta Support - Bulk Delete Mistakenly Imported Okta Users