Skip to main content

What it is

Pagination lets you retrieve large collections in bounded responses. YCloud list endpoints use either page-number or cursor pagination.

Before you begin

Check the endpoint reference for its supported pagination parameters, filters, sort order, and response shape. Do not assume every list endpoint uses the same strategy.

How it works

Request one page, process its items, and continue until the response indicates that no next page exists. Keep the same filters and sort settings for the entire traversal.

Request and response

Page-number pagination

Most list endpoints support these query parameters:
A page response contains:
Offset-based endpoints commonly cap both page and limit at 100, limiting traversal to the first 10,000 items. Check each endpoint’s limits and use cursor pagination when it is supported and you need a larger result set.
Continue requesting the next page while length equals limit. Stop when length is less than limit.

Cursor pagination

Endpoints that return cursor.after support cursor pagination. Pass that value as pageAfter in the next request.
A cursor response contains items, limit, length, and, when more results exist, cursor.after. The cursor object is returned only by endpoints that support cursor pagination.
Pass the returned cursor unchanged to the next request. Treat it as opaque; do not modify it or store it as a long-term application identifier. Stop when length is 0 or the response no longer contains cursor.after.
Pagination and filter parameters vary by endpoint. Check the API reference before implementing a list operation.

Implementation checklist

  • Set an explicit limit instead of depending on the default.
  • Preserve filters between page requests.
  • Stop on the response condition, not on a guessed page count.
  • Handle an empty first page as a successful result.
  • Add a maximum page or item guard for background jobs.