# Pagination

Lists come in pages. Most lists use an opaque cursor; a few catalogues use page numbers with totals.

## Cursor pages

Most lists use a cursor: ticket lists, the backlog, activity, comments, notifications, conversations and worklogs.

| Parameter | Meaning |
|---|---|
| `page[size]` | The number of rows. The default is 25 and the maximum is 100. Some lists have their own default, for example 50 for the backlog and 20 for activity. |
| `page[cursor]` | The cursor of the next page. Take it from `links.next`; do not build it. |

*A cursor page*

```json
{
  "data": [
    { "key": "ORB-124", "title": "Design the approval experience", "version": 12 },
    { "key": "ORB-125", "title": "Secure document links", "version": 3 }
  ],
  "meta": { "page": { "size": 25, "hasMore": true } },
  "links": { "next": "/api/v1/projects/ORB/tickets?page%5Bcursor%5D=eyJrIjpbIjBWIl0sImlkIjoi" }
}
```

Follow `links.next` while `meta.page.hasMore` is `true`.

*Read every page*

**JavaScript**

```js
const origin = "https://app.youniton.example";
let next = "/api/v1/projects/ORB/tickets?page%5Bsize%5D=100";
const rows = [];
while (next) {
  const res = await fetch(origin + next, { headers: { Authorization: `Bearer ${process.env.YOUNITON_TOKEN}` } });
  const page = await res.json();
  rows.push(...page.data);
  next = page.meta.page.hasMore ? page.links.next : null;
}
```

**Python**

```python
origin = "https://app.youniton.example"
next_url = "/api/v1/projects/ORB/tickets?page%5Bsize%5D=100"
rows = []
while next_url:
    page = requests.get(origin + next_url, headers=headers).json()
    rows.extend(page["data"])
    next_url = page["links"]["next"] if page["meta"]["page"]["hasMore"] else None
```

### Rules of a cursor

- A cursor is opaque and has no state on the server.
- A cursor is bound to the filters and the sort that made it. A cursor with other filters answers `400 query.cursor_invalid`.
- `page[size]` above 100 answers `400 query.invalid`.

## Numbered pages

A few catalogues, for example the project list, use page numbers: `page[number]` (from 1) and `page[size]` from a fixed set (10, 20, 25, 30, 50 or 100). The answer has `meta.page {number, size, total, totalPages}`. Totals can be up to 60 seconds old.

## Bounded lists

Some lists are not paged: board columns (the first 100 cards of each column, then a cursor per column), stages, roles, teams and search (at most 20 results).

## The help-desk change cursor

The help-desk request list has its own cursor, `changeCursor`, because a client's system polls it. [`GET /help-desk/requests`](https://docs.youniton.com/api/reference/help-desk.md#listIntakeRequests)

- Start a first sync with `updatedSince` (an instant, inclusive).
- Each answer has `meta.changeCursor`, also when the page is empty, and `meta.hasMore`.
- When `hasMore` is `true`, send `changeCursor` at once for the next page. When it is `false`, wait before the next poll.
- Rows come oldest change first, 50 per page. A change shows only after a settle window of 30 seconds, so a poll never skips a change that commits late.
- `changeCursor` together with `updatedSince`, or `page[cursor]` on this list, answers `400`. A cursor of an older connection version answers `400 query.cursor_invalid` with `reason: scope_changed`: sync again from `updatedSince`.

## Filters and sorting

| Feature | Form |
|---|---|
| filters | `filter[priority]=high,medium` · `filter[dueDate][gte]=2026-10-01` · `filter[assigneeId]=me` |
| custom fields | `filter[cf.region]=<option id>` · `sort=cf.launch` |
| free text | `q=approval` (1–120 characters) |
| sorting | `sort=dueDate,-updatedAt` — a `-` sorts down |
| includes | `include=comments,attachments` — one level deep |

An unknown filter, sort or include answers `400 query.invalid` with the name of the parameter. A comma list means "any of". Each operation in the reference lists its parameters.
