# Pagination

> Page through lists of the Sendtide API: limit, cursor and next_cursor, notes on filters, the deprecated parameters before, after and next, with examples and SDK iterators.

URL: https://sendtide.ch/en/docs/pagination/

Every list in the API pages the same way: with a cursor. That stays fast even with millions of emails, because Sendtide never counts how many pages were skipped.
## How it works

Every list endpoint takes limit and cursor and answers:

```
{
  "data": [ { "id": "msg_8kq2m4bt", "status": "delivered" } ],
  "next_cursor": "eyJ0IjoiMjAyNi0xMi0wMVQwODowMDowMFoifQ"
}
```
- Call the list without cursor.
- If next_cursor is not null, call the same endpoint with ?cursor=<next_cursor>.
- Repeat until next_cursor is null. That is the last page.

```
curl "https://api.sendtide.ch/v1/emails?q=status:bounced&limit=100" \
  -H "Authorization: Bearer $SENDTIDE_API_KEY"

curl "https://api.sendtide.ch/v1/emails?q=status:bounced&limit=100&cursor=eyJ0Ijoi…" \
  -H "Authorization: Bearer $SENDTIDE_API_KEY"
```
## Rules
- The cursor is opaque. Do not read it and do not build one yourself, pass it on unchanged.
- A cursor belongs to the endpoint and the filters it came from. Do not change q, since or until between pages, otherwise start again without a cursor.
- limit is the page size. The default and the maximum depend on the endpoint: emails 50 (up to 500), received mail 50 (up to 200), the audit log up to 200, the others 100 (up to 500 or 1,000).
- The order is fixed, emails and events newest first.
- GET /v1/emails also returns total and estimated. Above 10,000 results the number is estimated (estimated: true).
## With the SDKs

The SDKs have iterators that walk through all pages:

```
for await (const mail of sendtide.emails.searchAll({ q: "status:bounced" })) {
  console.log(mail.id);
}
```

```
for mail in client.emails.search_all("status:bounced"):
    print(mail["id"])
```

```
foreach ($sendtide->emails->searchAll(['q' => 'status:bounced']) as $mail) {
    echo $mail['id'], "\n";
}
```
## Deprecated parameters

The older parameters still work but are deprecated (sunset 2027-11-29):
| Old | New |
| --- | --- |
| before on logs and received mail | cursor |
| after on suppressions | cursor |
| Field next on email search and suppressions | next_cursor |

Answers that use them carry the headers Deprecation and Sunset, see [API versions](https://sendtide.ch/en/docs/api-versions/).
