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

# Pagination

> Page through SpaPortal API list responses.

List endpoints return a limited set of records, using cursor pagination.

Send these query parameters:

| Parameter | Default | Maximum | Description                                          |
| --------- | ------: | ------: | ---------------------------------------------------- |
| `limit`   |    `25` |   `100` | Number of records to return.                         |
| `cursor`  |       - |       - | Opaque cursor from the previous page's `nextCursor`. |

Responses include pagination metadata:

```json theme={null}
{
  "data": [],
  "pagination": {
    "limit": 25,
    "nextCursor": "eyJyZXNvdXJjZSI6ImhvdGVscyIsInNvcnQiOiJjcmVhdGVkQXQ6ZGVzYyIsImxhc3RJZCI6IjY2ZjE2MTkxZjczOTcwNWZhYTAyMDc2OCJ9",
    "hasMore": true,
    "total": 42
  }
}
```

* `limit` echoes the page size that was applied.
* `nextCursor` is an opaque token. Pass it back as `cursor` to fetch the next page. Do not parse or build it yourself. It is `null` when there are no more records.
* `hasMore` is `true` when another page is available.
* `total` is the number of matching records across all pages.

To page through results, repeat the request with `cursor` set to the previous response's `nextCursor` until `hasMore` is `false`.

## Invalid cursors

A cursor is valid only for the list and `sort` it came from. The API responds
with `400 invalid_request` when the cursor:

* cannot be decoded;
* was issued by a different list endpoint;
* was issued for a different `sort` value than the current request.

Keep the same `sort` (and other filters) while paging.
