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

# Pagination

> Page through list results with cursors, resume after a lost response, and start over when the query changes.

List operations return one page at a time with a `nextCursor`. Check the HTTP status before reading
a response: an error isn't an empty result.

## Page through results

Request the first page with your filters:

```bash theme={null}
curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/filings?state=TX&toi=04.0&limit=2" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

The response contains `filings` and `nextCursor`. While `nextCursor` isn't null, send it as `cursor`
with everything else unchanged:

```bash theme={null}
curl --request GET \
  --url "https://api.canary.effectiveai.app/api/v2/insurance/filings?state=TX&toi=04.0&limit=2&cursor={nextCursor}" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY"
```

For a `POST` search, resend the same JSON body with `cursor` added.

Stop when `nextCursor` is null. A page can be empty and still have a cursor; keep going. Results
reflect live data, so records can change between pages.

## Resume after a lost response

Keep the cursor you sent until you've stored that page. If a response is lost, resend the same
cursor; only move on to the new `nextCursor` after saving the results. Retries can return a different
cursor string, so don't compare cursors. Deduplicate results by `id`.

## Change the query

A cursor only works with the query it was issued for: the same filters, sort, `limit` and other
inputs. Changing the state from TX to CA but sending the Texas cursor returns `400 invalid_cursor`.
Start the new query without a cursor and keep its results separate.

Some cursors expire. Each operation's API reference says what its cursor is tied to and whether it
expires. If a cursor is rejected as `invalid_cursor`, restart the same query without one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.