Guides
Pagination
Read a long list a page at a time with a cursor.
Which lists are paginated#
In the developer API only one list can be long: GET /v1/events, the delivery events of your email, newest first. It is read a page at a time. The other lists are short and bounded by what they describe, such as the DNS records of a domain. They come back whole as { "data": [ … ] }, with no pagination member and no limit or cursor to give. When pagination is absent, there is nothing more to fetch.
Read a page#
A list answer holds the rows and a pagination object:
| Name | Where | Meaning |
|---|---|---|
limit | query parameter | How many rows to return, from 1 to 100. The default is 25. |
cursor | query parameter | Where to continue: the next_cursor of the previous page. Leave it out for the first page. |
pagination.has_more | in the answer | true if there is another page. |
pagination.next_cursor | in the answer | Pass it as cursor to get the next page. Present only when has_more is true. |
curl "https://api.cirrusmail.example/v1/events?email_id=$EMAIL_ID&limit=50" \
-H "Authorization: Bearer $CIRRUS_API_KEY"{
"data": [
{
"id": "0194c2d4-8a3e-7c11-b6a2-5d9f0e4a7b21",
"email_id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
"type": "delivered",
"recipient": "ann@example.org",
"stream": "transactional",
"test_mode": false,
"occurred_at": "2026-01-15T09:30:04Z"
}
],
"pagination": {
"has_more": true,
"next_cursor": "eyJvIjoiNTAifQ"
}
}curl "https://api.cirrusmail.example/v1/events?email_id=$EMAIL_ID&limit=50&cursor=eyJvIjoiNTAifQ" \
-H "Authorization: Bearer $CIRRUS_API_KEY"Repeat until has_more is false. Keep every other parameter (such as email_id) the same from page to page.
- A cursor is opaque. Do not decode it, build one or keep it for long: it only says where to continue.
- A cursor from an earlier request stays correct while new events arrive, which is why Cirrus uses cursors and not page numbers. New events appear at the start of the list, so they never shift the page you are reading.
- An invalid
limitorcursoris422 validation_failed, with the parameter named indetails.
In the libraries#
Each library has a call for one page and an iterator that fetches pages as you read, so you never handle cursors yourself. An API error ends the iteration by raising it.
// Every event of one email, fetched page by page as you read.
for await (const event of cirrus.events.iterate({ emailId: receipt.id })) {
console.log(event.type, event.occurred_at);
}
// Or one page at a time.
const page = await cirrus.events.list({ limit: 50 });
console.log(page.data.length, page.hasMore, page.nextCursor);