# Pagination

Lists return `{ "object": "list", "data": [], "has_more": false, "next_cursor": null }`. Pass `next_cursor` as
`cursor` to get the next page; `limit` is 1–100 (default 50). Cursors are opaque and only
valid for the same query and filters.

### The list object

- `object` (string, required):
- `data` (array of anys, required):
- `has_more` (boolean, required):
- `next_cursor` (nullable string, required): Pass as cursor to get the next page; null on the last page.

The event feed is the exception: it pages with `after` and `next_after` instead of a cursor, see
[Event feed](/api/event-feed).

```js Read all pages (Node.js)
let cursor;
do {
  const url = new URL("https://api.cream-ai.de/api/v1/films");
  url.searchParams.set("limit", "100");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.MINT_API_KEY}` },
  });
  const page = await res.json();
  for (const film of page.data) console.log(film.id, film.status);
  cursor = page.has_more ? page.next_cursor : null;
} while (cursor);
```

```py Read all pages (Python)
params = {"limit": 100}
while True:
    page = requests.get(f"{BASE}/films", headers=HEADERS, params=params).json()
    for film in page["data"]:
        print(film["id"], film["status"])
    if not page["has_more"]:
        break
    params["cursor"] = page["next_cursor"]
```
