Skip to content
New: a free website for your business, live in 48 to 72 hoursWorkflow automation on n8n and Claude, built for your businessFixed price, agreed before we start · Live in 5 to 10 business days30-day money-back guarantee on every planProfessional firms · Agencies · E-commerceYou own every workflow, in your own n8nClaude API: your data is not used for trainingHuman approval on every sensitive stepFree automation audit, no obligation
PURIST
30 days
Money-back window
14 h/wk
Modeled time saved
99.97%
Uptime SLA
< 7 days
Deploy time
PURIST AI
Claude Opus 4.7 · n8n v1.71 · <80ms
What type of business are you running? I'll show you exactly which processes we'd automate first and your estimated ROI.
Powered by n8n + Claude Opus 4.7 Get my free automation plan →
n8n HTTP Request Pagination: Every Pattern With Working Examples
Guides 7 min read · 1,521 words

n8n HTTP Request Pagination: Every Pattern With Working Examples

Most APIs return results in pages. How to make the n8n HTTP Request node fetch them all for page numbers, offsets, cursors and next-page links, and how to stop cleanly.

Steve, founder of PURIST

November 6, 2026

PURIST: Stuck on n8n? Our n8n experts fix and build workflows like this one, at a fixed price →

You call an API, get 100 records, and the account has 4,000. The API paginates, and the HTTP Request node only fetches the first page unless you tell it how to get the next one. n8n has built-in pagination for this, with three variables that cover almost every API: $response, $pageCount and $request.

In short. In the HTTP Request node, Add Option > Pagination. If the response contains the next page's URL, choose "Response Contains Next URL" and set Next URL to an expression such as {{ $response.body.next }}. Otherwise choose "Update a Parameter in Each Request" and set the page, offset or cursor with an expression. Always set a completion condition so the node knows when to stop.

n8n HTTP Request Pagination: Every Pattern With Working Examples: workflow diagram
One HTTP Request node fetches every page, then stops on a clear condition. Illustration: PURIST.

First, look at one response

The documentation's first advice is the right one: before configuring pagination, run the request once without it and read what the API returns. You are looking for one of four patterns.

PatternWhat the API returnsMode to use
Page numberpage=2 in the request, often total_pages in the responseUpdate a Parameter
Offsetoffset=100&limit=100Update a Parameter
CursorA token such as next_cursor to send backUpdate a Parameter
Next URLA full link such as next or links.nextResponse Contains Next URL

Our free JSON Path Finder gives you the exact path of a nested field like paging.next.after once you paste a sample response.

The pagination variables

VariableContains
$responseThe last response: $response.body, $response.headers, $response.statusCode
$pageCountHow many pages the node has fetched, starting at 0
$requestThe request just sent, including its query and body

These variables only work inside the HTTP Request node's pagination settings.

n8n HTTP Request Pagination: Every Pattern With Working Examples: node settings
Cursor pagination settings with a completion expression, a page cap and an interval. Illustration: PURIST.

Pattern 1: page numbers

  1. 1 Pagination Mode: Update a Parameter in Each Request.
  2. 2 Type: Query. Name: page (check the API documentation).
  3. 3 Value, as an expression:
text
{{ $pageCount + 1 }}

$pageCount starts at 0 and most APIs start at page 1, hence the + 1. Set the page size in the main query parameters (often limit or per_page) to the maximum the API allows, to make fewer calls.

Pattern 2: offset and limit

With limit=100 in the main query parameters, set a query parameter offset in the pagination settings:

text
{{ $pageCount * 100 }}

Pattern 3: cursors

The API returns a token to send with the next request, for example {"data":[...],"next_cursor":"abc"}. Set a parameter cursor with:

text
{{ $response.body.next_cursor }}

For APIs that paginate through the body of a POST request, set Type to Body instead of Query; the documentation covers this variant explicitly.

Pattern 4: the response contains the next URL

Choose "Response Contains Next URL" and set Next URL to the field holding it:

text
{{ $response.body.next }}

If the key contains a dash, use brackets: {{ $response.body["next-page"] }}. Some APIs put the link in a Link header instead; read it from $response.headers.

Stopping cleanly

Without a stop rule, the node can request an endless series of empty pages. The setting is called Pagination Complete When and has three choices:

  • Response Is Empty: the API returns nothing on the page after the last one;
  • Receive Specific Status Code(s): the API answers, for example, 404 past the last page;
  • Other: a Complete Expression you write, for example {{ !$response.body.next_cursor }} or {{ $response.body.data.length === 0 }}.

Also turn on Limit Pages Fetched and set Max Pages while testing. It protects you from a configuration mistake that would fetch tens of thousands of pages.

Rate limits during pagination

Fetching 40 pages in two seconds is a fast way to hit a 429 error. Set Interval Between Requests (ms) in the pagination settings, and enable Retry on Fail in the node settings. Our API Rate Limit Planner calculates the delay you need from the API's published limit. More in our guide to 429 errors in n8n.

What you get back

Depending on the API, the node outputs one item per page or splits the records into separate items. If you get one item per page with a data array inside, add a Split Out node on data to get one item per record.

Worked example: export every HubSpot-style contact with a cursor

Many CRMs return pages like this:

json
{
  "results": [ { "id": "101", "email": "ana@example.com" } ],
  "paging": { "next": { "after": "101" } }
}

The last page simply has no paging.next. Configuration:

SettingValue
Method / URLGET https://api.example.com/crm/v3/objects/contacts
Query parameterlimit = 100
Pagination ModeUpdate a Parameter in Each Request
Parameter Type / NameQuery / after
Value{{ $response.body.paging?.next?.after }}
Pagination Complete WhenOther
Complete Expression{{ !$response.body.paging?.next }}
Interval Between Requests (ms)200

Add a Split Out node on results to get one item per contact. With 4,000 contacts and 100 per page, the node makes 40 requests and stops by itself.

The exact field names (paging.next.after) are an example of a common pattern. Read one real response from your API and adapt the paths.

Offset pagination and the "total" trap

Some APIs return total and expect offset. It is tempting to compute the number of pages from total. Do not: if records are added or deleted during the export, the total changes and you skip or repeat records. Stop when a page comes back empty or shorter than your page size:

text
{{ $response.body.data.length < 100 }}

When the built-in pagination is not enough

Use a loop (HTTP Request inside Loop Over Items, or a "Wait and repeat" pattern) when:

  • each page needs processing before the next request (for example, write to a database page by page to keep memory low);
  • the next request depends on data computed from the previous page in a way an expression cannot express;
  • the API needs a POST with a body that changes in several fields at once.

For everything else, the built-in pagination is simpler and less error-prone.

Troubleshooting table

SymptomLikely causeFix
Only the first pagePagination not enabledAdd Option > Pagination
Same page fetched foreverNext value never changesCheck the path in $response.body; set Max Pages
Never stopsCompletion condition never trueWrite the condition from the real last response
Missing records at the endStopped on total, or page size changedStop on empty or short page
429 halfway throughNo intervalSet Interval Between Requests; enable Retry on Fail
Memory errors on huge exportsAll pages kept in one executionLoop page by page and write as you go

Production checklist

  • Page size set to the API maximum.
  • A completion condition that matches the API's real last page.
  • A max-pages safety limit during testing.
  • An interval between requests and Retry on Fail.
  • A test against an account with more than two pages of data.

Frequently asked questions

How do I get all pages from an API in n8n?

Enable Pagination in the HTTP Request node options. Use "Response Contains Next URL" when the API returns the next link, or "Update a Parameter in Each Request" with $pageCount or a cursor from $response.body.

What is $pageCount in n8n?

The number of pages the HTTP Request node has already fetched, starting at 0. Use $pageCount + 1 for APIs whose first page is 1.

Why does n8n pagination never stop?

The completion condition does not match the API's last page. Check what the last response looks like and set the condition on that field, plus a maximum page count.

Can I paginate with a Loop node instead?

Yes, but the built-in pagination is simpler and handles the variables for you. Use a loop only for APIs whose logic the built-in options cannot express.

How do I paginate a POST request in n8n?

Set Pagination Mode to "Update a Parameter in Each Request" with Type "Body", and set the page or cursor field with an expression.

How do I read the next-page link from a Link header?

Use $response.headers in the Next URL expression and extract the URL marked rel="next".

Can I limit pagination to a few pages for testing?

Yes. Turn on Limit Pages Fetched and set Max Pages.

Tags

n8nhttp requestpaginationapirest
Steve, founder of PURIST

Steve founded PURIST, a workflow automation studio working with n8n, Make and Claude AI, and is the point of contact on every project. Prices and features in our articles come from vendor documentation and public pricing pages. How we research and score tools.

Complete guide

Automation Tools & Platforms

11 min read n8n Code Node: 15 JavaScript Examples You Can Copy and … 8 min read n8n Code Node With Multiple Inputs: 3 Methods That Work 7 min read Fix "Cannot find module" in the n8n Code Node (npm Pack… 7 min read n8n Code Node Errors Fixed: "Code doesn't return items … 7 min read $env and Credentials in the n8n Code Node: What Works a… 7 min read n8n Code Node Binary Data: Read, Change and Return File… 7 min read Python in the n8n Code Node (n8n 2.x): Setup, Syntax an… 7 min read Fix n8n "The requested webhook is not registered" (Test… 6 min read n8n Webhook URL: Test vs Production, and How to Change … 7 min read n8n Respond to Webhook: Return JSON, Status Codes, Redi… 8 min read Secure an n8n Webhook: Header Auth, Basic Auth, JWT and… 7 min read n8n Webhook Not Working? 10 Causes and How to Fix Each … 7 min read n8n HTTP Request Authentication: API Keys, Bearer Token… 7 min read n8n HTTP Request Timeout and "Aborted" Errors: Causes a… 7 min read Upload and Download Files With the n8n HTTP Request Nod… 6 min read Fix ECONNREFUSED in n8n: Docker, localhost and 127.0.0.… 6 min read n8n 429 Too Many Requests: Batching, Retries and Rate L… 6 min read Fix redirect_uri_mismatch for n8n OAuth2 Credentials (G… 7 min read n8n Expression Errors Fixed: "Referenced node is unexec… 6 min read Anatomy Claude skill: what it is, how to install it, an… 5 min read How to explain a business process with the Anatomy skil… 5 min read Anatomy vs Mermaid vs Excalidraw: which to explain a wo… 14 min read n8n LinkedIn Job Automation: Auto-Apply, Track, and Fol… 16 min read n8n HTTP Request Node: Complete Documentation and Examp… 18 min read The future of automation: how our engineering team is s… 8 min read n8n vs Make vs Zapier: the honest comparison your busin… 11 min read n8n vs Make vs Zapier: an honest comparison for product… 7 min read Webhook vs polling: the architecture decision that dete… 24 min read n8n tutorial: build your first production workflow in u… 26 min read The 9 best Zapier alternatives in 2026: an honest ranki… 21 min read Make.com tutorial: build powerful automations without c… 19 min read Automation consultant vs DIY: how to decide what is rig… 14 min read n8n Self-Hosted vs Cloud: The Complete Decision Guide (… 15 min read 5 Zapier Free Alternatives That Handle Real Production … 15 min read WhatsApp Business Automation With n8n: Build a 24/7 Cus… 17 min read Google Workspace Automation: 15 Workflows for Sheets, D… 16 min read Claude AI for Business Automation: What It Does, What I… 15 min read Airtable Automation With n8n: 10 Workflows That Make Yo… 15 min read Droven.io AI Automation Tools: Full Review and Best Alt… 14 min read Droven.io RPA and Business Automation: An Honest 2026 R… 15 min read Enterprise Workflow Automation: The Complete Guide for … 13 min read Document Workflow Automation: Software, Implementation,… 14 min read Marketing Automation Workflow: From Content Creation to… 16 min read Ad Campaign Workflow Data Model and SDR Inbound Pipelin… 14 min read ComfyUI Workflows for Business: Product Photography, Ma… 13 min read GPT-5.2 for Business Workflows and the spec-workflow-mc… 17 min read ServiceNow vs IBM BAW vs n8n: Enterprise Workflow Autom… 16 min read 9 Best Workflow Automation Tools for Small Business in …

Keep reading

More from the blog.

All articles

From audit to deployment

Experience the automation
these articles are about.

Get my free automation plan →