# Pagination

Every list operation uses keyset cursors. A cursor points at a position in a fixed order, so a page does not skip or repeat rows when readers are added while you read.

## Request

| Query parameter | Meaning |
| --- | --- |
| `limit` | Page size from 1 to 200. The default is 50. |
| `cursor` | The `next_cursor` of the previous page. Leave it out for the first page. |

Filters are typed and explicit: `status`, `list_id`, `tag`, `created_after`, `updated_after` and so on, listed on each operation's page. There is no free-form query language.

## Response

```json
{
  "data": [ { "id": "lst_0123456789abcdefghjkmnpq", "name": "Main list" } ],
  "next_cursor": "eyJ2IjoxfQ.example",
  "has_more": true
}
```

`has_more` is `false` and `next_cursor` is `null` on the last page. Always follow `next_cursor`; do not build your own.

```bash
curl 'https://api.seemly.com/v1/lists?limit=2' \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

## Rules for cursors

- A cursor is opaque. Its text can change between releases, so store it only for the loop you are in.
- A cursor is signed and tied to your workspace and to the filters of the request that produced it. Using it with different filters, from another workspace, or after it was changed returns `validation_failed` with the field `query.cursor`. Start again from the first page.
- The same cursor returns the same page.

## Order

Each collection has one documented order. Most lists are newest first. `list_events` is newest first by default; pass `order=asc`, or `after=<event id>`, to read oldest first for a sync. Sorting by other fields is not offered.

## Syncing changes

To keep another system in step, read `list_subscribers` with `updated_after` set to the time of your last run, or poll `list_events` with `after` set to the last event you saw. Both are cheaper than reading everything again.

## Smaller responses

On any read, `fields=id,name` returns only those top-level fields (for a list, of every item in `data`). An unknown field name is a `validation_failed`, so a typo never returns an empty page quietly.

```bash
curl 'https://api.seemly.com/v1/lists?fields=id,name' \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```
