# Pagination (/guides/pagination)

## How it works [#how]

<Steps>
<Step>
**Ask for a page**

Pass `limit` (1 to 100, default 50).
</Step>

<Step>
**Read `next_cursor`**

A string means there is more; `null` means this was the last page.
</Step>

<Step>
**Ask for the next page**

Send the cursor as `cursor` with **the same other parameters**. A cursor from another query is refused with `400 invalid_cursor`.
</Step>
</Steps>

```js
# Node 18+: read every item row for November
let cursor = null, rows = [];
do {
  const url = new URL("https://openapi.tmbill.com/v1/sales/items");
  url.search = new URLSearchParams({ store_id: "1234", from: "2026-11-01", to: "2026-11-30", limit: "100", ...(cursor && { cursor }) });
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.TMBILL_KEY}` } });
  if (!res.ok) throw new Error((await res.json()).error.code);
  const body = await res.json();
  rows.push(...body.data);
  cursor = body.next_cursor;
} while (cursor);
```