Understanding Cursor-Based Pagination
Cursor based pagination utilizes a special token (called anoffset) that functions as a bookmark, instructing the API precisely where to resume fetching data from. This approach is efficient for large datasets because it eliminates the necessity for the API to count total results.
Implementation Steps
- Initial request: Omit
offsetparameter - Continue: For each subsequent request, supply the exact
offsetvalue received in the previous response’smetadata.offsetfield. Do not alter, generate, or reuse old offsets. - Complete: Terminate when
metadata.offsetis absent or null
Modifying query parameters: Changing any query parameters (such as filters or sorting) invalidates current offsets, restart pagination from the beginning if you change them.
Too many requests: Excessive paginated requests within a short period may result in rate limiting.
Parameters
Specifies the number of objects to return, ranging between 1 and 100. Default varies by endpoint.
An opaque string that defines your position in the list.
Critical: Utilize the exact
offset value from the previous response’s metadata.offset field. Do not modify, decode, or generate your own offset values.Response Format
All paginated endpoints return responses in this format:Array of response elements containing the actual data objects
Metadata object containing pagination information