Pagination
A response with multiple items uses cursor-based pagination to provide efficient and scalable data retrieval. This documentation explains how to use cursor-based pagination to fetch data from the API.
What is cursor-based pagination?
Cursor-based pagination involves returning a set of data with a unique identifier, known as a “cursor”. The cursor represents a specific point in the dataset, and subsequent requests can be made by providing the cursor as a query parameter. This approach enables clients to efficiently retrieve large datasets without having to fetch all records at once.
Fetching data with cursor-based pagination
To fetch data using cursor-based pagination, follow these steps:
- Start by requesting the first page of data without the cursor set. If you don’t
provide a
limit
, the API will return 50 records. - The response will contain an array of records and a
next_cursor
field, which represents the next set of data. - If no more records exist (i.e.,
next_cursor
isnull
), stop fetching data. - To fetch the next page of data, provide the
cursor
value from the previous response as a query parameter.
Paginated request fields
Paginated response fields
Retrieving the first cursor
Here’s an example request and response format for an API endpoint when we start listing data:
Retrieving the next pages
Note that the cursor value is escaped when serializing over the HTTP parameter
resulting in the =
sign being replaced with %3D
Until, eventually, the next_cursor
field is null
Changing filters while paginating will return results, but data consistency is not guaranteed.