Pagination returns a larger number of results than a single API request limit allows by "paging" through the results. This article provides an overview of pagination supported on many Okta API list endpoints.
- API calls
- Postman
- Pagination
If a value for the limit parameter is not specified when requesting a list of results (for example, in the List Users API), the maximum (200) is used as a default. Pagination is required to return more results than this limit.
For this example, List Users is used from the Users API:
- In Postman, generate a List Users API call:
{{url}}/api/v1/users?limit=200. - Click Send.
- In the Response, navigate to Headers.
- On the Headers tab, see two link headers. The header that is relevant is the one that contains
rel="next".- In that header, see the following:
- <https://orgname.okta.com/api/v1/users?after=*****************&limit=200>; rel="next."
- In that header, see the following:
- Copy the portion highlighted in bold above from the link header mentioned in Step 4.
- Create a new List Users API call (right-click in the left side menu on List Users > Open in new tab).
- Paste the portion copied from the link header after the "?" in the API request.
- This will return the results on the next page in the response body for this API call.
- Once there are no more Link Headers with
rel="next"in the response, there are no more results.
Use this process in scripting to return results automatically. For more information, see the related references below.
NOTE: Certain endpoint parameters may not support pagination. For example, if Admins are using the q parameter for Find Users, the default limit is 10, and this parameter does not support pagination. Please refer to the respective Okta Developer API references for the endpoint Admins are working with.
