REST Client

paginate

View as MarkdownOpen in Claude

Most resources with a list() method also have paginate(), which returns an iterator over every item across all pages. Eight don’t: client.addresses, client.recordings, client.short_codes, client.registry.brands, client.fabric.resources, client.fabric.cxml_applications, client.video.room_recordings, and client.logs.conferences expose list() only. list() returns one raw page, the server’s first response. paginate() reads each page’s data array, follows the links.next URL until it is absent, continues through an empty page that still has a next link, and stops if the server repeats a next link.

paginate(*, request_options: RequestOptions | None = None, **params) -> PaginatedIterator

Parameters

request_options
RequestOptions | NoneDefaults to None

Timeout and retry overrides applied to every page fetch. See RequestOptions.

**params
Any

Query parameters forwarded to the list endpoint, the same ones list() accepts. Passed on the first request; later pages follow the server’s link.

Returns

PaginatedIterator — a plain Python iterator that yields one item at a time and fetches the next page on demand.

Examples

Walk every phone number

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
for number in client.phone_numbers.paginate():
print(number["number"])

Nested resources

for address in client.fabric.addresses.paginate():
print(address["display_name"])