Duong Hoang Nam

Search Articles

Find AI, technology, and programming guides

Press Esc to closeFull Search Page →
Automation

How to Handle API Pagination and Rate Limits in n8n (2026 Guide)

Learn n8n API pagination, offset vs cursor, batch processing, HTTP 429 handling, safe retries, and durable sync checkpoints.

By Duong Hoang Nam
How to Handle API Pagination and Rate Limits in n8n (2026 Guide)

Introduction

Most API tutorials work perfectly with ten sample records. Production integrations are different: customer lists, inventory feeds, CRM contacts, and analytics events may contain thousands of records spread across many API responses. A workflow that fetches only the first page can silently miss most of the dataset. One that requests every page as fast as possible may trigger HTTP 429 errors or overwhelm a service.

In this guide, you will design an n8n API ingestion workflow that paginates predictably, respects rate limits, validates results, and resumes from a checkpoint. Examples use a hypothetical API, not a live service. Consult the provider’s documentation for its exact parameter names and response structure.

1. What You Will Build

Our target workflow is:

Manual or Schedule Trigger
      ↓
HTTP Request: fetch paginated data
      ↓
Normalize and validate items
      ↓
Upsert records into durable storage
      ↓
Save checkpoint and monitor progress

For large jobs, the design additionally limits request volume, handles temporary failures, and separates downloaded pages from confirmed stored records. It is a reference architecture, not an exported workflow tested against your own API.

2. Why APIs Use Pagination

Instead of sending 50,000 records in one response, an API may return 100 at a time. A response could look like this:

{
  "data": [{"id":"item_101","name":"Example"}],
  "next_cursor":"cursor_abc",
  "has_more":true
}

This response schema is illustrative. Some APIs return an array at the root; others provide next, links.next, a page number, or an HTTP Link header. You must examine an actual response before configuring n8n pagination.

3. Offset, Page Number, and Cursor Pagination

Strategy Example request Common trade-off
Page number ?page=3&limit=100 Easy navigation, but may shift as data changes
Offset ?offset=200&limit=100 Simple, but large offsets can be inefficient
Cursor ?cursor=abc&limit=100 Often more stable for moving datasets; cursors may expire
Next URL Follow next returned by server Provider defines the next step; validate its host

Neither strategy guarantees no duplicates or missing records if the source changes while syncing. For important datasets, use documented stable ordering, an updated_since watermark where supported, and idempotent destination writes.

Comparison of offset and cursor API pagination with page examples

Figure 1: Offset-based requests identify a position; cursor-based requests continue from a server-issued token.

4. Configure an HTTP Request Node

Add Manual Trigger, then HTTP Request. Configure the HTTP method as GET, use an endpoint supplied by your actual API, and create the appropriate n8n credential. Do not paste real API keys into a Code node, workflow export, or query string when the provider supports header-based credentials.

Example starting URL:

https://api.example.com/v1/records?limit=100

The domain is a placeholder and does not serve this example. First execute the request once and inspect the actual JSON structure, status code, response headers, and rate-limit documentation.

5. Choose a Pagination Approach in n8n

The HTTP Request node provides pagination configuration. Depending on the API, its pagination mode can update request parameters or use a next URL derived from the response. Use the node’s currently documented field controls rather than copying screenshots from a different n8n version.

For an API providing a next URL, the conceptual sequence is:

GET /records
    ↓
Response includes next URL
    ↓
GET next URL
    ↓
Repeat until no next URL remains

Security note: If the next value is a URL, only follow destinations allowed by your integration policy. Never blindly forward credentials to an untrusted host supplied in an API response.

For a cursor API, send the token returned by the previous page as the next request’s cursor parameter. When no next token exists, stop. Set a maximum page count or other bounded termination condition for unexpected responses.

Official guide: HTTP Request node.

6. Normalize and Validate Returned Records

Use a Code node in Run Once for All Items mode after the HTTP Request output has been converted to individual record items. The exact preprocessing depends on whether your HTTP Request returns pages, item arrays, or individual n8n items.

The following example expects one input item per record:

const result = [];
for (const [index, item] of $input.all().entries()) {
  const id = String(item.json.id ?? '').trim();
  if (!id || id.length > 200) continue;
  result.push({
    json: {
      externalId: id,
      displayName: String(item.json.name ?? '').slice(0, 500)
    },
    pairedItem: { item: index }
  });
}
return result;

This example checks an identifier and limits a field’s length. It is not a substitute for a full schema validation layer. The pairedItem property helps preserve item linkage in downstream n8n expressions.

7. Batch Processing Is Different from Pagination

Pagination retrieves successive pages from a remote API. Batch processing controls how many local items are processed at once. They solve different problems.

For example, your API may return 100 contacts per page, while your destination permits only 10 writes per second. You may fetch a page, then process its records in smaller groups using Loop Over Items (Split in Batches), inserting a Wait where required.

Fetch one page → Validate 100 records
                 ↓
             Loop: 10 records
                 ↓
             Upsert destination
                 ↓
             Wait if necessary

Do not assume that adding a Wait node after all records have already been fetched prevents upstream rate-limit errors. Place pacing controls where the restricted requests actually occur.

Official guide: Loop Over Items.

8. Understand HTTP 429 and Retry-After

An API may respond with 429 Too Many Requests if you exceed its limits. A Retry-After header may indicate how long to wait; providers can express it as seconds or an HTTP date. Follow the provider’s documented rules.

A robust policy distinguishes:

Result Recommended action
200–299 Validate and continue
400 Fix invalid request; do not blindly retry
401/403 Investigate credentials or access
429 Respect retry guidance, then retry within a limit
500/502/503 Consider bounded retry with backoff

Do not automatically replay non-idempotent writes when the outcome of the previous attempt is unknown. Query the destination or use a provider-supported idempotency key.

n8n API rate limit handling with bounded retries and Retry After

Figure 2: Handle rate limits at the restricted request, with bounded retries and recorded outcomes.

9. Calculate a Safe Request Pace

Suppose an API explicitly permits 60 requests per minute for your credential. A simple average pace is 1 request per second. That is an illustrative planning calculation—not a universal guaranteed-safe policy. Providers may enforce rolling windows, concurrent request limits, or shared quotas.

Prefer the provider’s current rate-limit documentation and response headers. Leave headroom for other applications that use the same credential. If requests arrive in bursts, a queue or token-bucket limiter may be more suitable than a fixed sleep.

10. Save Checkpoints Only After Durable Writes

A frequent data-loss mistake is saving the next cursor immediately after fetching a page, before its records have been persisted.

Use this order instead:

  1. Fetch page using current cursor.
  2. Validate and normalize records.
  3. Upsert records using stable external IDs.
  4. Confirm the destination operation succeeded.
  5. Save the next cursor as the checkpoint.

If persistence fails, leave the checkpoint at the last confirmed page. Retry with idempotent upserts so reprocessing does not create unwanted duplicates.

For concurrent workflow executions, the checkpoint store needs a suitable locking or ownership mechanism. A spreadsheet alone may not provide the necessary atomic guarantees.

n8n API sync monitoring with durable writes checkpoints and progress metrics

Figure 3: Advance the checkpoint only after writes have succeeded, and keep operational metrics.

11. Monitor More Than Execution Success

A workflow can finish with a green status while silently skipping records. Track both operational and business-level signals:

  • Pages fetched and records received.
  • Records validated, skipped, upserted, and failed.
  • Current cursor or page checkpoint.
  • HTTP 429 count and retry attempts.
  • Time since last successful synchronization.
  • Difference between source records and destination records where measurable.

Be careful not to log API tokens, personal data, or full response bodies unnecessarily.

12. Troubleshooting Common Problems

Only the first page appears: Inspect the response’s next-page field and pagination settings; compare with the provider’s actual response schema.

Records are duplicated: Use a stable provider record ID for an idempotent upsert and check overlapping workflow runs.

Some records are missing: Confirm stable sort order, incremental sync boundaries, and that checkpoints advance only after successful writes.

The workflow receives repeated 429 responses: Slow requests, respect the provider’s limits, check other consumers of the same credential, and bound retries.

The run consumes too much memory: Avoid accumulating every page into one huge array. Process chunks and save progress incrementally; test realistic record sizes.

13. Production Checklist

  • Authentication uses managed credentials.
  • Pagination stops when the provider signals completion.
  • Unexpected loops have a page or duration limit.
  • Rate limits are documented and respected.
  • 429 and transient failures have bounded retry policies.
  • Destination writes use stable IDs or an equivalent idempotent strategy.
  • Checkpoints follow confirmed persistence.
  • Concurrent runs cannot overwrite checkpoint state incorrectly.
  • Logging avoids secrets and sensitive payloads.
  • Results are validated against expected record counts when feasible.
  • A test run includes an interrupted-page recovery scenario.

14. Frequently Asked Questions

Does n8n automatically fetch all API pages?

Not universally. You must configure pagination or use a node operation that provides the desired behavior, depending on the integration.

Should I use Offset or Cursor pagination?

Follow the provider’s supported format. Cursor pagination is often better suited to changing datasets, but it is not an automatic guarantee against missing or repeated records.

Does Loop Over Items fetch the next API page?

Not by itself. It batches n8n items. You can construct a loop that makes successive HTTP requests, but that requires explicitly managing page state.

Can I store checkpoints in Google Sheets?

For simple single-run experiments, yes. For high-concurrency systems requiring atomic updates, use storage with stronger consistency guarantees.

How do I handle API rate limits in n8n?

Read provider limits, pace restricted requests, handle 429 according to documented retry guidance, and cap retry attempts.

15. Final Thoughts

Good API automation is not measured by how quickly it sends requests. It is measured by whether it retrieves the intended records, respects the provider, preserves data integrity, and recovers cleanly after interruption.

Start with one real API response. Understand its pagination contract. Validate each page, save records idempotently, and update checkpoints only after successful persistence. This approach is useful for CRM integrations, inventory synchronization, reporting pipelines, and content research without hiding operational failures.

Continue Reading

Official References

Disclosure: The code, API responses and workflow diagrams are educational examples. They are not evidence of a tested live integration or production benchmark. Validate the actual API contract and current n8n interface before deployment.

About the Author

Duong Hoang Nam

Duong Hoang Nam

Software engineer sharing practical tutorials, real-world experiments, and insights on AI tools, automation, and web development.

Read My Story →

Related Articles