Listing Suspended Okta Users via API
Last Updated:
Overview
The Okta Users API supports filtering users by status using the filter query parameter, enabling retrieval of a list of users with a SUSPENDED status via a cURL command or Postman. Configuring the filter parameter to status eq "SUSPENDED" and sending the request resolves the issue of identifying suspended users programmatically.
NOTE: Some cURL code examples include SSWS API token authentication. However, Okta recommends using scoped OAuth 2.0 and OpenID Connect (OIDC) access tokens to authenticate with Okta management APIs. OAuth 2.0 and OIDC access tokens provide fine-grained control over the bearer's actions on specific endpoints. See Okta API authentication methods.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Universal Directory
- Okta API
- Postman
Solution
Retrieving Suspended Users Using a cURL Command
Use the following cURL command to send a GET request to the Okta Users API with the filter query parameter set to return only 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 {APIkey}'
- Replace
{OktaDomainName}with the Okta domain and{APIkey}with the Okta API token. - The
filterparameter retrieves a filtered list of users with aSUSPENDEDstatus. - The response returns a JSON-formatted list of suspended users, which can be converted to CSV.
How are suspended users retrieved using Postman?
Complete the following prerequisites, then follow the steps to retrieve suspended users in Postman as detailed in either the video demonstration or the written instructions.
Prerequisites:
- Postman configured for the org environment as described in the Test the Okta REST APIs using Postman article.
- An Okta org.
- The Okta Users API collection imported into Postman.
Configure the List Users with a filter request and retrieve the suspended users list:
- Set up the Postman app as described in the Test the Okta REST APIs using Postman article.
- Import the Okta Users collection found on the Okta Users API collection Okta developer page.
- Prepare the List Users with a filter API call.
- On the Params page, change the filter parameter to
status eq "SUSPENDED". If the results exceed 25 users, uncheck the limit parameter and select Send. - Save the response to a file and convert it to CSV.
