Operate

Pagination

Read numbered pages from one unchanged list without skips or duplicates.

List responses contain items, count, as_of, and next. as_of is a time marker that keeps the list unchanged while you read later pages. Use the SDK iterator by default; it advances the generated page and snapshot parameters for you:

from recuut import Recuutwith Recuut() as client:    for resource in client.resources.list(max=100, page_size=25):        print(resource.id, resource.name)

Request pages yourself only when page boundaries matter:

from recuut import Recuutfrom recuut.merchant_api import ListOrder, TransactionFilter, TransactionStatuspayer_id = "pyr_00000000000070008000000000000000"status = TransactionStatus.FAILEDorder = ListOrder.OLDESTpage_size = 50transaction_filter = TransactionFilter(status=status, payer_id=payer_id)with Recuut() as client:    transactions = client.transactions.list(        filter=transaction_filter,        order=order,        page=1,        page_size=page_size,    )    for transaction in transactions.items:        print(transaction.id, transaction.status)    page_number = 2    while transactions.next is not None:        transactions = client.transactions.list(            as_of=transactions.as_of,            filter=transaction_filter,            order=order,            page=page_number,            page_size=page_size,        )        for transaction in transactions.items:            print(transaction.id, transaction.status)        page_number += 1

The manual example uses the same status, payer_id, order, and page_size on every page. Changing or dropping a filter starts a different list, even if you reuse as_of.

Pagination has four controls:

  • page is one-based and defaults to 1.
  • page_size accepts 1 through 100 and defaults to 50.
  • order is either "newest" or "oldest".
  • as_of is the time marker for one unchanged list. Omit it on the first request. Reuse the returned value for each later page that you request yourself.

Pass max to the SDK list method to cap the total items yielded. max does not change the server page size; page_size still controls each HTTP request.

New records do not move existing records between pages while you use the same as_of value. Keep the same filters, order, and API key throughout one page sequence. Start again at page 1 without as_of when you want a fresh list.

The next field is the URL for the following page. It is None after the final page. Custom HTTP integrations should make an authenticated GET to that exact server-provided URL with the same API key; do not rebuild or drop its query parameters. See any list operation in the API Reference.

Handle failures and payment headers →