Pagination
How lists are paged: pages by offset for inboxes, threads and messages, pages by cursor for events and deliveries, polling the event log forward, every list that pages, and the iterators of each SDK.
On this page
Two kinds of page
A list that can grow answers one page at a time. limit is the page size on every one of them: 50 by default and 100 at most. What differs is how the next page is asked for.
- Pages by offset
limitandoffset. The answer carriesdata, thelimitandoffsetthat were applied, and for most lists atotal. The next page isoffset + data.length. Right for a list a person scrolls or jumps around in.- Pages by cursor
limitandcursor. The answer carriesdataandnextCursor, which is null on the last page. The next page is the same request withcursorset to it. Right for a log that grows while it is read.
A list that is bounded by a limit of the API, such as an inbox's rules or an account's endpoints, answers whole in one data array and takes neither parameter.
Pages by offset
curl -s "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads?limit=50&offset=50" \
-H "authorization: Bearer $DOORMAN_API_KEY"- Use the
limitthe answer carries, not the one you sent: it is the one that was applied. - The last page is the first one with fewer items than its
limit. An empty page is a last page too. - Filters narrow the list before it is paged, and
totalcounts what the filters left. - A list read while it changes can shift under the offset: an item that arrives ahead of the offset pushes one already seen onto the next page, and a removal skips one. Where that matters, read the change from the event log instead of listing again.
Pages by cursor
curl -s "https://api.doorman.fyi/v1/events?limit=50" \
-H "authorization: Bearer $DOORMAN_API_KEY"
curl -s "https://api.doorman.fyi/v1/events?limit=50&cursor=1041" \
-H "authorization: Bearer $DOORMAN_API_KEY"- Pass
nextCursorback as it was given. It is a place in the list and nothing to compute with. - A list paged by cursor answers the newest first, and a page holds what is older than its cursor. Something that arrives while you page is newer than every page still to come, so nothing is repeated and nothing is skipped.
- On the event log a cursor that is not a number answers
400 validation_error.
Polling forward
The event log reads in the other direction too. GET /v1/events?after=<seq> answers what happened after a position, oldest first, as an EventPoll: data and latestSeq, the position to ask from next. This is not paging back through history. It is how a program that wakes on a schedule learns what is new, and it is described in Polling forward: after.
Every list that pages
Iterators in the SDKs
Both clients have a method beside each list that walks every page for you. It asks for a page only when the loop reaches it, so leaving the loop early costs nothing more.
// Every unread thread of an inbox, however many pages that is.
for await (const thread of client.inboxes.threads.iterate("inb_01jc4q7w9k2m5n8p3r6t1v4x7z", { isRead: false })) {
console.log(thread.id, thread.subject);
}
// One page at a time, when you want the page itself.
const page = await client.inboxes.threads.list("inb_01jc4q7w9k2m5n8p3r6t1v4x7z", { limit: 25, offset: 50 });# Every unread thread of an inbox, however many pages that is.
for thread in client.inboxes.threads.iterate("inb_01jc4q7w9k2m5n8p3r6t1v4x7z", is_read=False):
print(thread["id"], thread["subject"])
# One page at a time, when you want the page itself.
page = client.inboxes.threads.list("inb_01jc4q7w9k2m5n8p3r6t1v4x7z", limit=25, offset=50)- An iterator takes the list's own filters, and starts from the
offsetorcursoryou give it. - The TypeScript iterators are async generators. An offset walk ends at the first page shorter than its limit, and a cursor walk when
nextCursoris null. - The Python iterators check each page as well: one whose offset or limit is not the one asked for, or whose cursor does not advance, raises
ApiErrorwith the codeunexpected_responseinstead of looping. - Neither retries a page that fails. The error is the one the list itself would have raised, and the items already yielded stay handled.
On the command line a list command takes --limit with --offset or --cursor and prints one page. An MCP tool takes the same inputs, and on the surface for a model an answer that was shortened says how to ask for the next items.

