# Pagination and filters

> How list endpoints page with limit and cursor, and how date and list filters are written.

Every list endpoint answers in the same shape and pages the same way.

## The list shape

```json
{ "data": [ … ], "hasMore": true, "nextCursor": "cmwwzj98u0009qr03fgz798pw" }
```

- `data` holds the records for this page.
- `hasMore` says whether another page follows.
- `nextCursor` is the value to send for the next page, or `null` on the last page.

## Read every page

1. Call the list with the `limit` you want: 1 to 200, default 50.
2. While `hasMore` is true, call again with `cursor` set to the `nextCursor` you received, unchanged.

```bash
curl "https://app.staffedly.com/api/v1/providers?limit=200&cursor=cmwwzj98u0009qr03fgz798pw" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY"
```

Keep the same filters on every page. A `limit` outside 1 to 200, or a cursor that is not one you were given, answers `422 validation`.

## Date filters

`from` and `to` take a day (`YYYY-MM-DD`, read as the start of that day in UTC) or a full ISO-8601 time. `to` is not included in the range. What the dates apply to is stated on each operation, for example the shift's start time for assignments.

## Filters with several values

Where an operation says several values may be given, separate them with commas: `status=active,on_leave`. A value that is not allowed answers `422 validation` and the message lists the allowed values.

## Times in responses

All times are ISO-8601 in UTC. Whole-day records such as time off give the first and last day at midday UTC, so the date is the same in every time zone.
