Skip to main content
When you query list endpoints like GET /v1/accounts or GET /v1/contacts, Knock2 returns results in pages rather than all at once. Understanding how to move through those pages — and how to know when you’ve reached the end — lets you build reliable data exports, sync pipelines, and bulk processing jobs without missing records or hitting memory limits.

Cursor-Based Pagination

Knock2 list endpoints use cursor-based pagination rather than traditional page numbers. Instead of requesting “page 3”, you request “the next batch after this cursor”. Each response hands you a cursor that points to the position immediately after the last record returned — pass it back in your next request to continue from exactly that point. This approach has two important advantages over page numbers:
  • Stable results: newly created records don’t shift earlier pages, so you won’t see duplicates or skip records mid-iteration.
  • Efficient at scale: cursor lookups use indexed fields internally, so performance stays consistent even when iterating millions of records.

Request Parameters

Include these query parameters on any list endpoint to control pagination:

Response Envelope

Every list response wraps records in a consistent envelope: A typical paginated response looks like this:
When has_more is false, you have reached the last page. The next_cursor will be null and there is no need to make another request.

Walk Through All Pages

Use a loop that continues until has_more is false. Here are complete examples in Node.js and Python:
Both examples fetch pages of 100 records (the maximum) and accumulate them into a single list. Adjust the limit value downward if you want to process records in smaller batches.
Cursors are opaque strings — do not attempt to parse, decode, or construct them manually. Their internal format may change between API versions without notice. Always treat next_cursor as an atomic value you store and pass back verbatim.

Rate Limiting

Knock2 enforces a rate limit on all API endpoints. If you send requests too quickly while paginating a large dataset, you will receive a 429 Too Many Requests response.
Add a short delay between paginated requests — 100–250 ms is usually sufficient — to stay comfortably within the rate limit. If you do receive a 429, inspect the X-RateLimit-Reset response header (a Unix timestamp): wait until that time before retrying. There is no Retry-After header.
The following example adds a delay between pages in the Node.js loop:
Node.js