# Pagination

> How list endpoints page through results, and how to read every record without missing any.

Source: https://docs.usejump.co.uk/getting-started/pagination

List endpoints return one page at a time, using `limit` and `offset`.

| Parameter | Default | Range     |
| --------- | ------- | --------- |
| `limit`   | 20      | 1 to 100  |
| `offset`  | 0       | 0 or more |

Most list endpoints bring an out-of-range `limit` back into range rather than rejecting it. A few reject it with `422`; each endpoint's parameters say which.

Each page's `meta` tells you where the next one starts:

```json
{
  "data": [ … ],
  "meta": {
    "limit": 100,
    "next_offset": 100,
    "has_more": true,
    "request_id": "6f1c2a9e-3b7d-4c55-9a0e-2d8f1b4c7e10"
  }
}
```

## Reading every record

Keep requesting with `offset = meta.next_offset` until `has_more` is `false`.

```javascript
async function listAll(path) {
  const all = [];
  let offset = 0;
  while (true) {
    const res = await fetch(`${BASE_URL}${path}?limit=100&offset=${offset}`, {
      headers: { Authorization: `Bearer ${process.env.JUMP_API_KEY}` },
    });
    const { data, meta } = await res.json();
    all.push(...data);
    if (!meta.has_more) return all;
    offset = meta.next_offset;
  }
}
```

`has_more` is `true` whenever a page comes back full. If the total is an exact multiple of your `limit`, the last request returns an empty page with `has_more: false`. That is expected, not an error.

## Records that change while you page

Pages are read live, not from a snapshot. If records are created or archived while you page through a list, a record can shift between pages, so you may see it twice or miss it. For a complete sync, filter on a time window (such as `created_at_gte`) and de-duplicate by `id`. Use [webhooks](https://docs.usejump.co.uk/webhooks) to hear about changes as they happen.
