# Paging and sync

`GET /v1/results` returns results oldest change first, a page at a time. The same request keeps your copy
in sync: each time a result changes, it shows up again on a later page.

## The first request

Choose where to start and what to include:

| Parameter | What it does |
|---|---|
| `updatedAfter` | Only results changed after this instant. Leave it out to start from the beginning. |
| `limit` | Results per page, 1 to 100. 50 by default. |
| `status` | Only these statuses, comma-separated, such as `COMPLETED,SUBMITTED`. |
| `roleId` | Only results for this role. The `role.id` of any result gives you a role's id. |
| `email` | Only the results of the candidate with exactly this email address. |

```bash
curl "https://pub.hiringbranch.com/v1/results?updatedAfter=2026-10-01T00:00:00Z&status=COMPLETED&limit=100" \
  -H "Authorization: Bearer hbk_your_key"
```

## The next pages

Each page ends with `nextCursor`. Send it back as `cursor`, **alone**:

```bash
curl "https://pub.hiringbranch.com/v1/results?cursor=eyJ..." \
  -H "Authorization: Bearer hbk_your_key"
```

The cursor carries the filters and the limit of your first request, and where the page ended. Sending any
other parameter with it is refused with `400`, so a filter can't silently change halfway through. Treat the
cursor as an opaque value: its contents can change without notice.

When `nextCursor` is `null`, you've reached the newest change.

## Staying in sync

1. Store each result by its `id`, replacing the copy you had.
2. Remember the newest `updatedAt` you've stored, exactly as you received it.
3. Next time, start a new first request with `updatedAfter` set to that value.

Keep `updatedAt` at full precision. It has more digits than a second, and rounding it would make the next
sync send you the last result again.

Some things to know:

- **A change shows up after a minute.** The list waits until a change is a minute old, so it never skips
  one still being written. A by-id route that shows a change at once is coming soon.
- **`ranking` moves on its own.** A result's rank changes as other candidates in the role finish, without
  changing its `updatedAt`. If you store the rank, refresh it from time to time by re-reading the result
  from the list.
- **Deleted results aren't reported.** A result that is deleted simply stops appearing.
- **Test candidates never appear.**

## If a request fails

On `503`, wait for the number of seconds in `Retry-After`, then send the very same request again, cursor
included. Nothing is skipped or repeated. [Errors](/errors) lists every failure.
