> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lms.bsa.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> How list endpoints paginate, sort, and report total counts.

List endpoints accept the same set of pagination query parameters.

## Query parameters

<ParamField query="page" type="integer" default="1">
  Which page to fetch. 1-indexed.
</ParamField>

<ParamField query="rows" type="integer" default="10">
  Page size. Maximum 100.
</ParamField>

<ParamField query="orderBy" type="string">
  Column to sort by. Valid column names depend on the resource — see
  the relevant endpoint page.
</ParamField>

<ParamField query="sortOrder" type="string">
  Sort direction. One of `ASC` or `DESC`.
</ParamField>

## Response shape

Every paginated list returns the same envelope:

```json theme={null}
{
  "items": [ /* page of resources */ ],
  "total": 1284,
  "page": 1,
  "rowsPerPage": 10
}
```

* `items` — the page of records.
* `total` — total count matching the filter (not just this page).
* `page`, `rowsPerPage` — echoed from the request.

## Example

Fetch the second page of customers, 25 per page:

```bash theme={null}
curl -sf "$BASE/v1/customers?page=2&rows=25" \
  -H "Authorization: Bearer $TOKEN"
```

## Validation errors

| Condition                    | Field  | Error                                         |
| ---------------------------- | ------ | --------------------------------------------- |
| `rows > 100`                 | `page` | `rows value too large, must be less than 100` |
| `page < 1`                   | `page` | `page value too small, must be larger than 0` |
| Non-numeric `page` or `rows` | `page` | `page conversion: ...`                        |
