API Pagination & Filtering
API pagination patterns including offset, cursor, and keyset approaches with filtering, sorting, and consistent response structures.
- Difficulty
- intermediate
- Read time
- 1 min read
- Version
- v1.0.0
- Confidence
- established
- Last updated
Quick Reference
API Pagination: Use cursor-based for large/dynamic data (feeds, logs). Use offset for small datasets with page jumps. Cursor = encoded timestamp+id. Always return hasMore/nextCursor. Include total count only if cheap. Consistent response: { data: [], pagination: { cursor, hasMore } }.
Use When
- Building paginated API endpoints
- Implementing list/collection endpoints
- Handling large datasets
- Real-time or frequently updated data
Skip When
- Small, fixed-size collections
- Single-resource endpoints
API Pagination & Filtering
API pagination patterns including offset, cursor, and keyset approaches with filtering, sorting, and consistent response structures.