Back to Blog

Try n8n free for 10 days

After trial, plans start from $7/mo. No charge until day 11.

n8nguideautomationapipagination

n8n API Pagination: A Complete Step-by-Step Guide for 2026

n8nautomation TeamMay 5, 2026
TL;DR: n8n's HTTP Request node has powerful built-in pagination features that can automatically fetch all results from an API. This guide shows you how to configure it for page/offset, cursor-based, and other common pagination methods, so you never have to work with incomplete datasets again.

When you first start building automation workflows, it’s a magical feeling. But that magic quickly fades when you realize your workflow only processed 100 records when you were expecting 10,000. The culprit is almost always the same: you haven't handled n8n API pagination. This guide provides a complete, step-by-step walkthrough for mastering pagination in n8n, ensuring you retrieve every single piece of data from your connected services.

What is API Pagination and Why Is It Essential?

Imagine asking an API for "all your users." If the service has millions of users, sending that data in a single request would be incredibly slow and resource-intensive, likely causing timeouts for you and performance issues for the API provider. To prevent this, APIs "paginate" their responses.

Pagination is the process of dividing a large dataset into smaller, more manageable chunks called "pages." Instead of returning everything at once, the API returns the first page of results and provides a way to request the next page, and the next, until you've retrieved the entire dataset.

Common pagination mechanisms include:

  • Page/Offset Pagination: The most straightforward method. You request a specific page number (e.g., page=2) or specify an offset (how many items to skip, e.g., offset=100) and a limit (how many items per page, e.g., limit=100).
  • Cursor-Based Pagination: Considered more robust. The API response includes a "cursor" (a unique identifier, often a string of characters) that points to the next set of results. To get the next page, you simply include this cursor in your next request.
  • Link Header Pagination: The API includes a Link header in its HTTP response containing a direct URL to the next page of results.

Without properly handling pagination, your n8n workflows will only ever see the first page of data, leading to incomplete reports, missed updates, and inaccurate syncs.

Tip: Before automating, always check the documentation of the API you're using. It will specify which pagination method it uses and the names of the required parameters (e.g., `page`, `offset`, `limit`, `cursor`, `after`).

Understanding n8n's HTTP Request Pagination Options

Thankfully, n8n has a powerful, built-in solution for this right inside the HTTP Request node. You don't need to build complex looping logic for most use cases. Let's break down the settings.

When you add an HTTP Request node, scroll down to the "Options" section and click "Add Option". Select Pagination. This will reveal a new set of fields:

  • Mode: This is the core of the feature. You tell n8n how to get to the next page.
    • Update a Parameter in Each Request: Used for Page/Offset pagination. n8n will automatically increment a number for you.
    • Use a Cursor/ID from Previous Run: Used for Cursor-Based pagination. n8n will extract the cursor from the previous response and use it in the next request.
    • Use Link Header: Used for APIs that provide a "next" link in the response headers.
  • How to Stop: This tells n8n when it has reached the last page. You can stop when the response is empty, when a specific field no longer exists, or when a field has a certain value.

Building reliable workflows requires a stable environment. An n8nautomation.cloud dedicated instance ensures your workflows run without interruption, with automatic backups and maintenance handled for you, starting at just $7/month.

How to Handle Page/Offset Based Pagination in n8n

This is the most common method you'll encounter. Let's say an API uses a limit parameter for the number of items per page and an offset parameter to determine where to start. We want to get 100 items at a time.

  1. Set up the Initial Request:

    In your HTTP Request node, configure the URL and any necessary authentication. Go to the "Parameters" section and add two parameters:

    • Name: limit, Value: 100
    • Name: offset, Value: 0 (We start at the beginning)
  2. Configure Pagination:

    In the "Pagination" option, set the following:

    • Mode: Update a Parameter in Each Request
    • Parameter to Update: offset (This must match the name from Step 1)
    • How to Update: Add to Previous Value
    • Update by Value: 100 (This should match your limit)
    • Parameter Location: Query (Or wherever the API expects it)
  3. Define the Stop Condition:

    Now, tell n8n when the job is done.

    • How to Stop: When Last Response Is Empty

    This is the most common condition. If the API returns an empty list (e.g., []) on the last page, n8n knows it's finished and will stop making requests. Sometimes, an API might return something like { "data": [] }, in which case you might need to use the "When a Field in Last Response Doesn't Exist" and set the field to data.0.

When you execute this node, n8n will make the first request with offset=0, the second with offset=100, the third with offset=200, and so on, until the API returns an empty response. All the results from every page will be combined into a single output.

How to Handle Cursor-Based Pagination in n8n

Cursor pagination is more reliable as it doesn't depend on the order or number of items. An API response will typically look something like this:


{
  "results": [...],
  "next_cursor": "cjY4ajJjNzA5MmM3MDJmMjM5"
}

Our goal is to extract next_cursor and use it in the next request.

  1. Set up the Initial Request:

    Configure your HTTP Request node as usual. You might need to add a limit parameter if the API supports it. You do not need to add the cursor parameter yet.

  2. Configure Pagination:

    In the "Pagination" option, set the following:

    • Mode: Use a Cursor/ID from Previous Run
    • Cursor Parameter: after (Or whatever the API calls its cursor parameter, like cursor or page_token)
    • Where to Find Cursor: In Response Body
    • Key for Cursor: next_cursor (This is the name of the field in the JSON response that contains the cursor value)
    • Parameter Location: Query
  3. Define the Stop Condition:

    When using a cursor, the pagination usually ends when the next_cursor field is no longer present in the response.

    • How to Stop: When a Field in Last Response Doesn't Exist
    • Field to Check in Response: next_cursor

    n8n will now automatically perform the first request, find the value of next_cursor, and place it into an after query parameter for the second request. It will repeat this process until a response arrives without the next_cursor key, at which point it stops and merges all the results.

This method is less common but very easy to handle in n8n. The API response won't contain a cursor in the body, but instead, the HTTP headers will contain something like:

Link: <https://api.example.com/data?page=2>; rel="next", <https://api.example.com/data?page=10>; rel="last"

n8n can parse this automatically.

  1. Set up the Request: Configure your HTTP Request node normally.
  2. Configure Pagination:
    • Mode: Use Link Header
  3. Define the Stop Condition:
    • How to Stop: When Last Response Is Empty

    That's it! n8n knows to look for the Link header and find the URL with rel="next". It will follow these links until it gets an empty response or the Link header is no longer present.

Note: If the built-in pagination options don't work for a very unusual API, you may need to build a manual loop. This typically involves an HTTP Request node, a Split in Batches node, and an IF node to check a condition, looping back to the HTTP node. This is an advanced technique and should only be used as a last resort.

Common Pitfalls and How to Avoid Them

  • Hitting Rate Limits: When n8n requests hundreds of pages in a few seconds, it can easily trigger an API's rate limit, causing your workflow to fail. Solution: Place a Wait node right after the HTTP Request node. Set a delay (e.g., 1-2 seconds) to slow down your requests and stay within the API's limits. Since the HTTP Request node with pagination enabled will output all items at once *after* it has finished, you need to place the Wait node inside the loop. Go to the pagination options, click "Add Option", and select "Wait Time Between Requests". A value of 1000 ms (1 second) is a good starting point.
  • Incorrect Stop Condition: If your stop condition is wrong, your workflow might end prematurely or run forever (until it times out or you manually stop it). Solution: Before running the full workflow, use the "Test" functionality within the pagination options. n8n will show you the URL it's trying, what it found, and whether it would stop. Always check the last page of an API response manually (e.g., using Postman or Insomnia) to see what it looks like so you can set the correct stop condition.
  • All Data Output at Once: The HTTP Request node with pagination enabled will collect all items from all pages and then output them as a single, large list. This is usually what you want, but if you need to process each item one by one as it comes in, pagination might not be the right tool. You would need a manual loop in that scenario.

Mastering n8n API pagination is a crucial skill for building robust and reliable automation. By using the built-in features of the HTTP Request node, you can save hours of development time and ensure your workflows always run on complete, accurate data. Take the time to understand the API you are working with, test your setup, and you'll be a pagination pro in no time.

Ready to build powerful, scalable automations without server headaches? Get started with a dedicated n8n instance on n8nautomation.cloud today.

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.