<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
List All Deactivated Users Using API
Lifecycle Management
Okta Classic Engine
Okta Identity Engine
Overview

This article discusses how the Okta API can list users who have been Deactivated by leveraging the Filters option for API calls.


NOTE: Some curl code examples on this page include SSWS API token authentication. However, Okta recommends using scoped OAuth 2.0 and OIDC access tokens to authenticate with Okta management APIs. OAuth 2.0 and OIDC access tokens provide fine-grain control over the bearer's actions on specific endpoints. See Okta API authentication methods for more information. Postman is a third-party tool, and Okta is not responsible for any changes to the application. Support cannot troubleshoot issues with the application itself.

Applies To
  • Universal Directory
  • Okta API
  • Postman
Solution

To obtain a list of deactivated Okta users using the API, a GET request can be made to the Okta Users API with the filter query parameter set to only return deactivated users using either and API client such as Postman or a cURL call.
 

Using cURL:

Here is an example of a cURL command that can be used to retrieve a list of suspended users:
 

curl -X GET \ 'https://{OktaDomainName}/api/v1/users?filter=status eq "DEPROVISIONED"' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: SSWS {theAPIkey}'

 

  • In the above command, {OktaDomainName} should be replaced with the Okta domain, and {theAPIkey} should be replaced with the Okta API token.

The filter parameter retrieves a filtered list of users, specifically those with a deactivated status.

The response will contain a JSON-formatted list of deactivated users, which can be converted into CSV.


Using Postman

  1. Prerequisites for Postman:

  1. To achieve this, the following procedure is in place:

    1. Set up the Postman app as described in the Test the Okta REST APIs using Postman article.

    2. Import the Okta Users Collection found on the Okta Users API collection on the Okta developer page.

    3. Prepare any of the List Users with a filter  API call.

    4. On the Params page, change the filter parameter to status eq "DEPROVISIONED". If the results surpass 25 users, uncheck the limit parameter and press Send.

      Postman  

    5. Save the Response to a file and convert it to CSV.

 

Loading
List All Deactivated Users Using API