Skip to main content

Overview

Search endpoints return paginated results. The SDK provides PaginatedResult<T> which implements AsyncIterable, letting you iterate through all items across all pages without manual page management.

Basic usage

The iterator automatically fetches the next page when the current page is exhausted. Each page it fetches is one API request and counts against your monthly quota, so keyless Free-tier usage (100 requests a month, counted per IP) can spend its whole allowance on one large iteration.

Collecting results

Use toArray() to collect all items into an array:

Page cap

Auto-pagination stops after maxAutoPages pages (default 100). If pages remain at that point, iteration and toArray() throw PaginationLimitError rather than return a partial result. At the API’s default perPage of 10, that cap is 1,000 items. Set the cap with the second argument to search():
PaginationLimitError carries pagesFetched, maxAutoPages, itemsFetched, and total. A toArray({ limit }) that is reached within the cap does not throw.

Accessing page metadata

The initial response includes pagination metadata:

Controlling page size

A perPage above your tier’s maximum is lowered to that maximum, not rejected. Read results.meta.perPage to see the size you actually got.

Example: export all Brooklyn rentals

Rate limit awareness

Auto-pagination respects your tier’s rate limits. If you hit a rate limit during pagination, the SDK automatically retries with backoff. Each page is one request against your monthly quota, and running out of quota throws QuotaExceededError, which is not retried. For large exports, use a larger perPage value to reduce the number of requests.