Import Okta Data to Google Sheets

In this guide, we’ll walk through how to pull Okta’s API data directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key, and then set up a request.

STEP 1: GET YOUR OKTA API KEY

  1. While logged in to your Okta dashboard, navigate to Security > API from the top navigation bar.
    okta-img1
  2. From the API menu, click Tokens, and then click Create Token.
    okta-img2
  3. Give your token a name and click Create Token
    okta-img3
  4. You will now be presented with your token. Congrats, you now have access to the Okta API! Copy this value and keep it handy as you’ll need it in a moment.
    okta-img4

STEP 2: CREATE YOUR OKTA API REQUEST URL

We’ll first follow the documentation to get a list of users in your organization.

  • API root: https://YOUR_DOMAIN.okta.com/api/v1
  • Endpoint: /users

Putting it all together, we get the full API Request URL:

https://YOUR_DOMAIN.okta.com/api/v1/users

STEP 3: PULL OKTA API DATA INTO SHEETS

We can now enter our values into API Connector and start importing Okta data into Google Sheets.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created
    okta-img5
  3. Under Headers, enter three sets of key-value pairs like this:
    Content-Typeapplication/json
    Acceptapplication/json
    AuthorizationSWSS YOUR_TOKEN

    Replace YOUR_TOKEN with the token you got above in part 1. You must include the text ‘SWSS’ before it.
    okta-img6

  4. Create a new tab. You can call it whatever you like, but here we’ll call it ‘Users’. While still in that tab, click ‘Set’ to use that tab as your data destination.
  5. Name your request. Again we’ll call it ‘Users’
  6. Click Run and a moment later you’ll see a list of your Okta users populate your Google Sheets.
    okta-img7

STEP 4: HANDLE PAGINATION

Note that the Okta API limits the number of records returned in each request. By default, only the first page of records will be returned, and each page contains a limited number of records. To access more than 100 records, use the “limit” and “after” parameters as described in the documentation.
okta-img8
The URLs should look like this:

page 1: https://YOUR_DOMAIN.okta.com/api/v1/users?limit=200
page 2: https://YOUR_DOMAIN.okta.com/api/v1/users?limit=200&after=abcd

The ‘after’ value gets populated by the value returned into the ‘id’ field. In API Connector, you can either set these up as separate requests or run through them automatically with pagination handling (paid feature). Okta places the full paginated links into a header response field called ‘Link’, so the paginated request would look like this:
okta-img9

Leave a Comment