Overview
The Auth0 Go SDK v2 supports two pagination styles:- Page-based pagination - Used by most list endpoints (clients, users, connections, etc.)
- Checkpoint pagination - Used by logs and organizations endpoints
Page type with built-in iterator support for seamless traversal.
Page-Based Pagination
Most Auth0 Management API endpoints use traditional page-based pagination withpage and per_page parameters.
Using the Iterator (Recommended)
The iterator pattern provides the simplest way to process all results:Manual Pagination
For more control, manually iterate through pages:Checkpoint Pagination
Checkpoint pagination is used for time-series data like logs and organizations. Instead of page numbers, you use the ID of the last item as a checkpoint.Logs Example with Iterator
Manual Checkpoint Pagination
For advanced use cases like batching or rate limiting:Advanced Patterns
Parallel Processing with Workers
Process items in parallel using a worker pool:Rate-Limited Pagination
Control request rate when processing large datasets:Filtered Pagination
Combine pagination with filtering and searching:Batched Processing
Process items in batches for bulk operations:Progress Tracking
Track pagination progress for long-running operations:Resume from Checkpoint
Implement resumable pagination for long operations:Best Practices
Use Iterators
Prefer the iterator pattern for simplicity and automatic error handling. It reduces boilerplate and makes code more readable.
Optimize Page Size
Balance between fewer requests (larger pages) and memory usage. Typical range: 25-100 items per page.
Handle Errors Properly
Always check
iterator.Err() after iteration completes. For manual pagination, distinguish between ErrNoPages and actual errors.Implement Rate Limiting
Use rate limiting when processing large datasets to avoid hitting API rate limits.
Performance Tips
Use Appropriate Page Sizes
Larger pages = fewer requests but more memory:
- Small datasets: 25-50 items
- Large datasets: 50-100 items
- Never exceed API limits (typically 100)
Implement Parallel Processing
Process items concurrently using worker pools for CPU-intensive operations.
Error Handling
Always handle pagination errors appropriately:Related Topics
- List Operations - API reference for list endpoints
- Error Handling - Handle pagination errors
- Request Options - Configure requests