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

# Pagination

> Opaque cursors. Default 50, max 200.

List endpoints (e.g., `GET /people`, `GET /companies`, `POST /people/search`) return paginated responses:

```json theme={null}
{
  "data": [ /* up to `limit` items */ ],
  "next_cursor": "eyJpZCI6Ii4uLiIsImNyZWF0ZWRfYXQiOiIuLi4ifQ"
}
```

When `next_cursor` is `null`, you've reached the end.

## Requesting the next page

Pass `cursor` back in the query string:

```bash theme={null}
curl "$SALTY_API/people?limit=50&cursor=eyJpZCI6..." \
  -H "Authorization: Bearer $SALTY_API_KEY"
```

## Ordering

Default order is `created_at desc, id desc`. `POST /people/search` lets you override via `sort`:

```json theme={null}
{
  "sort": [{ "first_name": "asc" }],
  "limit": 100
}
```

## Limits

* Default `limit`: 50
* Max `limit`: 200
* Above 200 → silently clamped to 200

## Cursor format

The cursor is base64url-encoded JSON of `{ id, createdAt }` — treat it as opaque. Don't construct or parse it; just pass back what the server returned.

## Walk the whole set

```ts theme={null}
let cursor: string | null = null;
const all: Person[] = [];
do {
  const { data } = await salty.people.getPeople({
    query: { limit: 100, cursor: cursor ?? undefined },
  });
  all.push(...data.data);
  cursor = data.next_cursor;
} while (cursor);
```
