<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 Okta Suspended Users via API
Lifecycle Management
Okta Classic Engine
Okta Identity Engine
Overview

This article addresses the following question:

  • Is it possible to use the Okta API to list users who are a certain status in Okta, suck as Locked Out, Deactivated, etc., by leveraging the Filters option for API calls? 

NOTE: Some of the 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.

Applies To
  • Universal Directory
  • Okta API
  • Postman
Solution

Follow the video or steps below.

 

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

  1. 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 "SUSPENDED"' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: SSWS {yourAPIkey}'
  • In the above command, {yourOktaDomain} should be replaced with the Okta domain, and {yourAPIkey} should be replaced with the Okta API token.
  • The filter parameter is used to retrieve a filtered list of users, specifically those with a SUSPENDED status.
  • The response will contain a JSON-formatted list of suspended users, which can be converted into CSV.
     
  1. 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 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 "SUSPENDED", and if the results surpass 25 users, uncheck the limit parameter and press Send.

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

Postmant response


Related References

Loading
List Okta Suspended Users via API