You pull contacts from an API, and the result always has exactly 100 records, even though your system holds 2,000? That's not a bug, it's pagination: the API returns data in pages. In HTTP Request you don't need to build your own loop for it.
- Where to set it: in HTTP Request, open Options and add Pagination. The node sends the follow-up requests itself and collects the results from every page.
- Pagination Mode: “Response Contains Next URL” when the API returns a ready-made address for the next page, e.g.
{{ $response.body.next }}. “Update a Parameter in Each Request” when you change a parameter yourself, e.g. page ={{ $pageCount + 1 }}or cursor ={{ $response.body.next_cursor }}. - Pagination Complete When: you decide when to stop. Response Is Empty, Receive Specific Status Codes, or Other with your own condition, e.g.
{{ !$response.body.next_cursor }}. - Safety switches: Limit Pages Fetched with Max Pages stops the node after, say, 50 pages, and Interval Between Requests (ms) adds a pause between requests (remember API rate limits from episode 02?).
Watch out for:
- A wrong stop condition means an endless loop or hundreds of unnecessary requests. Set Max Pages, especially in your first tests.
- When the API returns an object with the list in a field like data, you get one item per page, not per record. Split the list with the Split Out node (episode 04 of Series 01).
- Some APIs count pages from 0, others from 1. Check the docs to see whether you need “+ 1”, or you'll fetch the first page twice or skip it.
Rule of thumb: before you build a loop by hand, check Pagination in HTTP Request, and always set Max Pages.
Upcoming meetups and workshops are listed in the Events section.