Comparing cursor pagination and offset pagination
The Zendesk Support, Talk, and Help Center APIs have several endpoints that return lists of items, such as tickets, users, or articles.
For performance reasons, the APIs do not return large record sets all at once. Instead, they break up the results into smaller subsets and return them in pages. The number of items per page varies by endpoint. For example, the tickets and users endpoints return 100 items per page while the articles endpoint returns 30 items per page.
Zendesk has two methods of paginating through resources:
- Offset pagination (previously referred to as just pagination). This method is supported by all resources. See Paginating through lists using offset pagination for detailed instructions.
- Cursor pagination. This method is supported by most resources, such as tickets and users, and will be progressively introduced to all resources. See Paginating through lists using cursor pagination for detailed instructions.
Zendesk recommends using cursor pagination instead of offset pagination where possible. Cursor pagination provides greatly improved performance when retrieving extremely large record sets. A limit applies when using offset pagination. See Offset pagination limit.
The request parameters and the format of the returned JSON object differ between cursor pagination and offset pagination. The following table summarizes the key differences:
|How do I...||Offset pagination||Cursor pagination|
|Specify which page of items to return||Specify the ||Specify the |
|Specify how many items to return per page||Specify the ||Specify the |
|Sort the items in a certain order||Specify the ||Specify the |
|Determine the URL of the next or previous page of items||Use the ||Use the |
|Determine when there are no more items in the result set||When the ||When the |
|Determine the total number of items||Use the ||See the API documentation for the specific resource|
Each resource has different limits on how many items can be returned per page and how results can be sorted or filtered. See the API documentation for the specific resource.
Incremental export endpoints can also be used to get large data sets of certain resources, such as tickets and users. For details, see Incremental Exports.
Another option for getting large data sets is to use the reporting feature in Zendesk Support to export data to a CSV or XML file. For details, see Exporting data to a CSV or XML file.
See also Pagination in the Introduction of the Zendesk REST API documentation.