Mass deletion of accounts


#1

Is it possible to remove (delete) accounts in mass… I have a task to remove 100’s of accounts and while i know i would have to inactivate them then delete them it is not in anyway a good use of anyone’s time to sit and do them one at a time. Does anyone have an example of how to do this?


#2

You can use the REST APIs for that.
Here’s how you will do that:

For each user:

  1. Search a user to get his id: -> GET: {{url}}/api/v1/users?filter=profile.email eq "mail@gmail.com"
  2. From the JSON response, record the “id”.
  3. Deactivate the user -> POST: {{url}}/api/v1/users/{{id}}/lifecycle/deactivate
  4. Delete the user -> DELETE: {{url}}/api/v1/users/{{id}}

For a REST API sample, you can use Postman.

  1. Download and install Postman (its a Google Chrome App).
  2. Follow the instructions to configure Postman and get an API Key in Okta: https://developer.okta.com/docs/api/getting_started/api_test_client.html
  3. Go to https://developer.okta.com/docs/api/resources/users.html and click Run in Postman
  4. Experiment with the search and lifecycle APIs.