Pagination

Handle paginated results in the TypeScript SDK

Handle paginated API responses.

Manual Pagination

let cursor: string | undefined = undefined;
let hasMore = true;

while (hasMore) {
  const response = await client.events.list({ cursor });
  
  for (const event of response.data) {
    // Process event
  }
  
  cursor = response.nextCursor;
  hasMore = response.hasMore;
}

Using Pagination Helpers

// The SDK provides helpers for pagination
const allEvents = await client.events.listAll();

Next Steps

On this page