Guides

Pagination

Every list method accepts the same set of query parameters and returns the same pagination envelope, regardless of which resource you are listing.

Query parameters

ParameterDefaultNotes
page11-based page number
limit20Items per page; maximum is 100
searchFree-text search against the resource
sortField name to sort by; prefix with - for descending (e.g. -created_at)

PaginationMeta

Every page response includes a meta block (or null when the server omits it) with these fields:

FieldTypeDescription
total_countnumberTotal items across all pages
page_countnumberTotal number of pages
current_pagenumberThe page number returned in this response
limitnumberThe limit in effect for this page
has_next_pagebooleantrue when there is a subsequent page
has_previous_pagebooleantrue when there is a preceding page

SDK auto-pagination

Neither SDK requires you to implement a manual loop. Both provide three patterns.

A PagePromise is both a promise and an async iterable. Await it for a single page, iterate it with for await for every item, or call .pages() for each page object.

// One page
const page = await bimpe.agents.list({ limit: 50 });
page.data;        // readonly Agent[]
page.meta;        // PaginationMeta | null
page.requestId;   // string | null
page.hasNextPage; // boolean
const next = await page.getNextPage(); // Page<Agent> | null

// Every item, fetching pages on demand
for await (const agent of bimpe.agents.list({ limit: 50 })) {
  console.log(agent.id);
}

// Page by page
for await (const page of bimpe.agents.list().pages()) {
  console.log(page.meta?.current_page);
}

list returns a Page (sync) or AsyncPage (async). Iterating either walks every item across pages automatically. Call .pages() when you need the page objects themselves.

# One page
page = client.agents.list(limit=50)
page.data            # list[Agent] for this page
page.meta.total_count if page.meta else 0
page.request_id      # str | None
page.has_next_page   # bool
next_page = page.get_next_page()  # Page[Agent] | None

# Every item, fetching pages on demand
for agent in client.agents.list(limit=50):
    print(agent.id)

# Page by page
for page in client.agents.list().pages():
    print(page.meta.current_page if page.meta else None)

On the async client swap for with async for and get_next_page() with await page.get_next_page().

async for agent in client.agents.list(limit=50):
    print(agent.id)

On this page