> ## Documentation Index
> Fetch the complete documentation index at: https://help.bodharouteplanner.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> How to paginate through large result sets.

# Pagination

List endpoints use **cursor-based pagination** with a `before` parameter.

## Parameters

| Parameter | Type | Default | Max | Description |
| - | - | - | - | - |
| `limit` | integer | 25 | 100 | Number of records to return |
| `before` | ISO 8601 timestamp | — | — | Return records created before this timestamp |

## Response format

```json theme={null}
{
  "data": [ ... ],
  "hasMore": true
}
```

When `hasMore` is `true`, use the `createdAt` of the last item in `data` as the
`before` value for the next page.

## Example: paginating through orders

```javascript theme={null}
let before = undefined;
let allOrders = [];

do {
  const params = { limit: 100 };
  if (before) params.before = before;

  const res = await fetch(
    `https://api.bodha.run/api/v1/orders?${new URLSearchParams(params)}`,
    { headers: { 'X-API-Key': 'bk_live_...' } }
  );
  const { data, hasMore } = await res.json();

  allOrders.push(...data);

  if (hasMore && data.length > 0) {
    before = data[data.length - 1].createdAt;
  } else {
    break;
  }
} while (true);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.