Webhook Pagination Builder: Cursor, Offset & Page Loop Generator

The FREE API Pagination Loop Blueprint Generator

1. API Configuration

Check your target API documentation.
The JSON key holding the records (e.g., “items”, “results”, “data”).
The JSON key holding the next page cursor.

2. Generated Node.js Loop

Field verdict: pagination is where otherwise solid webhook automations quietly become expensive. The hard part is not fetching page two. The hard part is knowing when to stop, how to retry, and how to avoid burning API credits while a workflow runs in circles.

If you are building this for production, treat pagination as control-flow code, not a copy-pasted webhook setting. Cursor pagination should be your default when the API offers it. Offset pagination is acceptable for stable datasets. Page-number pagination is the most fragile and needs stricter loop limits.

Quick Answer: Which Pagination Pattern Should You Use?

API patternBest use caseFailure riskMy recommendation
CursorModern APIs, changing datasets, webhooks that resume laterLow if you store the cursorUse this first. It is the least messy option.
Offset + limitTables that do not change much during syncMedium; records can shift mid-loopUse only with a hard max offset and dedupe step.
Page numberOlder APIs and admin exportsHigh; easy to loop foreverAccept it, but add a max-page kill switch.
Production rule: every pagination loop needs four limits: max pages, max runtime, retry count, and a duplicate-record guard. Without those, you have a billing accident waiting to happen.

What Most Pagination Examples Leave Out

  • Idempotency: store processed IDs so retries do not create duplicate records.
  • Backoff: treat HTTP 429 and 5xx responses as normal operating conditions, not edge cases.
  • Checkpointing: save the last cursor or page so a failed job can resume instead of starting over.
  • Observability: log page count, item count, and stop reason. If you cannot explain why a loop stopped, it is not production-ready.

FAQ: Webhook Pagination Loops

What is the safest webhook pagination method?

Cursor pagination is usually safest because the API tells you the next position instead of forcing you to guess with page numbers or offsets.

Why do pagination loops fail in Zapier, Make, or n8n?

They usually fail because the workflow has no explicit stop condition, no retry budget, or no dedupe layer. The platform is rarely the root problem; the loop design is.

Should I paginate inside a webhook trigger?

Only for small datasets. For large syncs, let the webhook enqueue work and run pagination in a separate background workflow.

Reference: review the HTTP 429 behavior before designing retry logic.

Stop losing API data. Generate bulletproof Do/While loop scripts for Cursor, Offset, and Page-based API pagination to use in n8n, Make.com, or custom Node.js webhooks.


If you are building B2B automations, standard webhooks will only get you so far. When you query a CRM like HubSpot or a database like Notion, the API will only return a subset of your data (usually 50 to 100 records) to save server bandwidth.

To get the rest of your data, you must build a Pagination Loop. Use the generator above to select your API’s pagination type and instantly generate the bulletproof Do/While JavaScript logic needed to extract every single record without crashing your workflow.

The 3 Types of API Pagination (Which one are you using?)

Before you paste this code into your n8n Code Node or Make.com custom app, you must check your target API’s documentation to see how they structure their data.

1. Cursor-Based Pagination (The Modern Standard)

Used by Slack, Stripe, Notion, and most modern APIs. When you make a request, the API returns your records alongside a next_cursor (a random string of characters). To get the next page, you make the exact same request, but append ?cursor=[YOUR_STRING] to the URL.

  • Why it’s best: It prevents data duplication if new records are added to the database while your loop is running.

2. Offset & Limit Pagination (The Legacy Standard)

Used by HubSpot, WordPress, and many SQL-backed APIs. You tell the API how many records to skip (offset) and how many to return (limit). If you want records 100 through 200, your URL parameters will be ?limit=100&offset=100.

  • The danger: If a record is deleted while your loop is running, the offset shifts, and your automation will accidentally skip a record.

3. Page Number Pagination

The simplest, but least scalable format. You simply append ?page=1, then ?page=2. The loop terminates when the API returns an empty array.

Why Zapier’s Default Webhook Node Fails at Pagination

If you are using Zapier’s “Webhooks by Zapier” integration to GET data from an API, you have likely noticed a massive flaw: It cannot paginate.

Zapier will fire your request, grab the first 50 records, and stop. Zapier does not have a native “Loop until condition is met” feature. To bypass this, RevOps engineers must either:

  1. Write a custom “Code by Zapier” step (using the JavaScript generated above).
  2. Migrate the workflow to Make.com or n8n, which natively support iterative API polling.

Preventing Infinite Loops (And API Credit Drains)

When writing Do/While loops in automation platforms, a single typo can result in an infinite loop. If your logic never triggers the hasMore = false condition, your script will poll the API thousands of times a minute.

This results in two disasters:

  1. Massive Bills: You will burn through your monthly task allotment (and budget) in minutes.
  2. IP Bans: The target API will instantly permanently ban your server’s IP address for a DDoS attack.

Note: The code generated by our tool above includes explicit exit conditions based on array lengths and null cursors to guarantee the loop breaks properly.

Handling Rate Limits Inside a Pagination Loop

If you are extracting 10,000 records, you will likely hit an HTTP 429 Too Many Requests error halfway through your loop.

To prevent this, you must introduce a delay between your requests. In the Node.js snippet generated above, we include this critical line of code at the end of the loop:

await new Promise(r => setTimeout(r, 200));

This forces the script to pause for 200 milliseconds before asking for the next page, keeping your workflow safely under the standard 5-requests-per-second API limits enforced by most SaaS companies.


Struggling to sync massive datasets between your tools? Don’t let pagination errors ruin your data integrity. Download our library of pre-built, fail-proof data extraction blueprints for Make.com and n8n.