Skip to main content
List methods in the Cloudflare API return paginated results. The SDK provides convenient auto-pagination and manual pagination methods.

Auto-pagination with async iterators

Use for await...of syntax to automatically fetch all pages:
The SDK handles pagination transparently, fetching additional pages as you iterate.

Manual pagination

For more control, fetch pages manually:

Pagination types

The SDK supports multiple pagination styles used across Cloudflare’s API:
Page-based pagination with items wrapped in a result object:
Query parameters:

Working with paginated results

Check for more pages

Access result metadata

Iterate through pages

Pagination parameters

Control pagination behavior with query parameters:
number
Page number to fetch (1-indexed, page-based pagination only)
number
Number of items per page
number
Number of items to return (cursor-limit pagination only)
string
Cursor token for fetching the next page (cursor-based pagination only)

Advanced patterns

Process items in batches

Limit total results

Filter while paginating

Parallel processing

Single page responses

Some endpoints return non-paginated results using SinglePage:
These responses work with the same iterator pattern but never have additional pages:

Performance considerations

1

Choose appropriate page sizes

Balance between request count and memory usage:
2

Use cursor pagination for large datasets

Cursor-based pagination provides stable results even as data changes:
3

Process items as they arrive

Avoid loading all results into memory:
4

Implement pagination limits

Protect against runaway pagination: