Skip to main content

Pagination

Both TypeScript and Python SDKs handle pagination automatically. The SDKs return paginated responses that you can iterate through to access all data.

Basic Pagination

Processing All Data

Here’s how to collect all data from paginated responses:

Pagination Best Practices

  1. Use async iteration (TypeScript): The for await...of syntax is the recommended way to handle pagination
  2. Use while loops (Python): The while res is not None pattern is the standard approach
  3. Process incrementally: For large datasets, consider processing each page as it comes rather than collecting all data in memory
  4. Handle errors: Wrap pagination in try-catch blocks for robust error handling (see Error Handling)
  5. Respect rate limits: The SDK handles rate limiting automatically, but be mindful of API usage