# Pagination

> Cursor pagination for lists. limit and cursor in, data, has_more and next_cursor out.

Source: https://docs.tryyoursize.com/guides/pagination/

List endpoints (`GET /v1/products`, `GET /v1/fit_groups`, `GET /v1/audit_events`…) return one page at a time, newest first.

| Parameter | |
|---|---|
| `limit` | Page size: default **20**, at most **100**. |
| `cursor` | The `next_cursor` of the previous page. Omit it for the first page. |

```json
{
  "data": [ { "id": "…", "external_id": "CREW-TSHIRT" } ],
  "has_more": true,
  "next_cursor": "eyJ…"
}
```

Request the next page while `has_more` is `true`. Cursors are opaque: do not build or parse them.

## With the SDKs

```ts
// Node: auto-pagination
for await (const p of tys.products.list({ limit: 50 })) {
  console.log(p.external_id);
}
```

```python
# Python
for p in tys.products.list(limit=50).auto_paging_iter():
    print(p["external_id"])
```
