# Pagination

> How Besday API list endpoints paginate with limit and an opaque next_cursor, with a loop that fetches every page.

Source: https://besday.com/docs/api/pagination · Updated 2026-12-03 · OpenAPI: https://besday.com/api/v1/openapi.json

List endpoints return a list object. Pass `limit` (1–100, default 20) and, for the next page, the `next_cursor` you received as `cursor`.

```json
{
  "object": "list",
  "data": [
    "…"
  ],
  "has_more": true,
  "next_cursor": "bzoyMA"
}
```

## Fetch every page

Python:

```python
import os, requests

def all_orders():
    cursor = None
    while True:
        params = {"limit": 100, **({"cursor": cursor} if cursor else {})}
        page = requests.get("https://besday.com/api/v1/orders", params=params,
            headers={"Authorization": f"Bearer {os.environ['BESDAY_API_KEY']}"}, timeout=30).json()
        yield from page["data"]
        if not page["has_more"]:
            return
        cursor = page["next_cursor"]
```

> Cursors are opaque: pass them back exactly as received. Lists are ordered newest first (orders) or as on the marketplace (creators).
