<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
0D51Y00007UnsOESAZOkta Classic EngineUniversal DirectoryAnswered2026-04-01T09:00:20.000Z2020-01-09T15:01:22.000Z2020-01-30T16:20:13.000Z
  • t529b (t529b)

    Another option is Gabriel Sroka's rockstar widget for your browser's bookmark bar. I use this all the time to quickly export all sorts of data from Okta. Extremely simple to use.

    Description is here: https://gabrielsroka.github.io/rockstar/

     

    Selected as Best
  • bc221 (bc221)

    Not exactly, but you can use Okta List Users API with some programming to filter out result as you want. I am posting sample Python code which will write desire user attributes in csv file.

     

    This code takes care of pagination if you have more than 200 users to fetch. https://developer.okta.com/docs/reference/api/users/#list-all-users

     

    okta_server = os.environ.get('OKTA_URL') # Update Okta tenant https://<yourOrg>.okta.com in .env file

    api_token  = os.environ.get('OKTA_API_TOKEN') # Update your Okta API token in .env file

    headers   = {'Content-Type': "application/json", 'Accept': "application/json", 'Authorization': f"SSWS {api_token}"}

    getuser_filter = 'ACTIVE' # Select any [DEPROVISIONED (Deactivated) | PROVISIONED | SUSPENDED | STAGED | ACTIVE]

     

    def get_users():

      """Print Users list in CSV file, filter by STATUS"""

      url = f'{okta_server}/api/v1/users?limit=200&filter=status eq "{getuser_filter}"'

    url = f'{okta_server}/api/v1/users?limit=200' # Get all users without any filter

      okta_get_resp = requests.get(url, headers=headers)

      csv_file = os.getcwd() + '\Get_Okta_Users.csv'

     

      if okta_get_resp.status_code > 200:

        print('\nUnable to get response from Okta - get_users(). status_code = ', okta_get_resp)

        raise Exception(okta_get_resp)

      else:

        employee_data = open(csv_file, 'w')

        csvwriter = csv.writer(employee_data, lineterminator='\n')

        print('\nWriting output to ' + csv_file)

        # Write Header in CSV

        csvwriter.writerow(['Okta_ID', 'Status', 'FirstName', 'LastName', 'Email', 'OktaLogin']),

     

        while True:

          for emp in okta_get_resp.json():

            # Write each employee data in a separate row

            csvwriter.writerow([emp.get('id'), emp.get('status'), emp.get('profile').get('firstName'), emp.get('profile').get('lastName'), emp.get('profile').get('email'), emp.get('profile').get('login')])

     

          # Terminate if next url not found in 'Link' (response header)

     

          nextLink = okta_get_resp.links.get('next')

     

          if nextLink is None:

            employee_data.close()

            break

     

          # status_code = 429 meaning Rate-Limit exceed. this might not delete user. Waiting until okta reset rate limit.

          elif okta_get_resp.status_code == 429:

            sleep = int(okta_get_resp.headers.get(

              'X-Rate-Limit-Reset')) - int(time.time())

            print(

              f'Waiting to reset X-Rate-Limit-Reset, Sleeping for {sleep} seconds')

            time.sleep(5) if sleep < 5 else time.sleep(sleep)

     

          # Get the nextLink URL and make a request

          else:

            okta_get_resp = requests.get(nextLink['url'], headers=headers)

    get_users()

     

     

    Expand Post
  • linoy (linoy)

    From where do I run this script?

  • t529b (t529b)

    Another option is Gabriel Sroka's rockstar widget for your browser's bookmark bar. I use this all the time to quickly export all sorts of data from Okta. Extremely simple to use.

    Description is here: https://gabrielsroka.github.io/rockstar/

     

    Selected as Best
  • Hi Suman, did you find either Mike's or Vipul's response helpful? If so, please mark it as the Best Answer - thanks.

     

    And thanks for providing guidance here, Mike and Vipul!

Loading
How to pull list of all user id only from Okta
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply