Cursor-Based Pagination
Cursor-based pagination uses opaque cursors instead of page numbers, offering several advantages:- Consistent results: No skipped or duplicated items when data changes
- Efficient: Doesn’t require counting total items
- Bidirectional: Navigate forward and backward through results
Request Parameters
Query Parameters
Example Request
Response Format
Paginated Response Structure
Response Fields
Pagination Examples
Forward Pagination
Fetch the first page:endCursor:
Backward Pagination
Fetch the previous page usingstartCursor:
With Search
Combine pagination with search:With Sorting
Combine pagination with custom sorting:Implementation Guide
JavaScript/TypeScript
React Hook Example
Infinite Scroll Example
Sortable Fields
Different endpoints support different sortable fields:Consumers
Experiences
Audiences
Best Practices
1. Use Appropriate Page Sizes
- Interactive UIs: 20-50 items for quick loading
- Background sync: 100 items for efficiency
- Never exceed: Maximum of 100 items per request
2. Handle Empty Results
3. Preserve Cursor on Refresh
When implementing “pull to refresh”, preserve the current position:4. Combine with Filters Carefully
When combining pagination with filters, cursors may become invalid if filter criteria change:Cursor Format
Cursors are Base64-encoded JSON objects. While the format is not guaranteed to remain stable, they typically contain:Limitations
- Maximum page size: 100 items
- Cursors expire after 24 hours of inactivity
- Cursor format may change between API versions
- Some filtered views may not support all sort options