Skip to main content
Foil uses cursor-based pagination on every list endpoint. Cursors are opaque - don’t parse them, construct them, or rely on their format. They’re stable across process restarts and safe to persist in your own database if you want to resume a long iteration.

Response envelope

Every list response has the same shape:
Individual resources aren’t returned inside an extra envelope - they unwrap to the resource object itself - but list responses always use the shape above.

Request parameters

Every list endpoint accepts these two query parameters: Individual endpoints may expose additional filter parameters (e.g. verdict, search, sort) on top of these. See the per-resource filter sections below.

Iterating

The canonical pattern: call the endpoint, process data, and loop while has_more is true, passing next_cursor forward.

Auto-pagination in the SDKs

The server SDKs ship with an auto-pagination helper that abstracts the cursor loop. Use it when you want to iterate the entire result set without managing state.
Auto-pagination makes one API call per page and yields items as it goes - safe to use on result sets that wouldn’t fit in memory, and it respects the same rate limits as manual iteration.

Filters and sorting

Filter parameters layer on top of the standard pagination params. They narrow the result set but don’t change the envelope shape.

Sessions

Fingerprints

API keys

Combining filters and pagination is supported: pass the filters once, and carry the cursor forward as normal. The server applies filters before paginating, so limit controls page size of the filtered result set.

Caveats

  • Don’t construct cursors. They’re opaque tokens - the server may change their encoding. If you need to page from a specific timestamp or ID, use a filter parameter instead.
  • Cursor lifetimes. Cursors remain valid as long as the underlying result set does - a cursor minted today is valid until the records it points into expire. Stored sessions and visitor fingerprints are not currently expired on a fixed window.
  • Result stability under concurrent writes. New records created during a long iteration may or may not appear in later pages - cursors provide “snapshot-like” stability without strong isolation guarantees. For auditing across a fixed window, pass a time filter when one is available for that resource.
  • Ordering. Each list endpoint documents its default sort. Don’t assume an order that isn’t explicitly documented.

What’s next

Authentication

Key types and scopes.

Errors

Envelope shape, status codes, retry semantics.

Sessions

The most common list endpoint.

Fingerprints

Visitor fingerprint lookup.