How to Use Pagination When Making Okta API Calls in Postman
Last Updated:
Overview
When requesting a list of results from an Okta Application Programming Interface (API) endpoint without specifying a limit parameter, Okta defaults to a maximum of 200 results. Okta requires pagination to return a larger number of results than a single API request limit allows. Retrieve additional results by locating the next link in the response headers and generating a new API call with the provided URL.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Application Programming Interface (API) Calls
- Postman
- Pagination
Solution
How is pagination used when making Okta API calls in Postman?
The following example uses the List Users endpoint from the Users API. Generate a List Users API call in Postman, locate the next link in the response headers, and use it to create a subsequent request to retrieve the next page of results.
- In Postman, generate a List Users API call using the following format:
{{url}}/api/v1/users?limit=200 Choose Send.- In the Response, navigate to Headers.
- On the Headers tab, locate the two link headers and identify the header that contains
rel="next". - In that header, locate the URL format similar to the following example:
<https://<orgname.okta.com>/api/v1/users?after=*****************&limit=200>; rel="next"
- Copy the URL portion from the link header identified in the previous step.
- Create a new List Users API call by right-clicking List Users in the left side menu and choosing Open in new tab.
- Paste the copied portion from the link header after the
?in the API request. - Choose Send to return the results on the next page in the response body for this API call.
Once the response omits Link Headers with rel="next", Okta has returned all available results. Implement this process in scripting to return results automatically. For more information, see the related references below.
NOTE: Certain endpoint parameters omit support for pagination. For example, using the q parameter for Find Users sets the default limit to 10 and prevents pagination. Refer to the respective Okta Developer API references for the specific endpoint requirements.
