Pagination Loop HELP

How do I set the page increment to a variable that uses a fixed value?

Please help. I’ve been trying to figure this out for months.

  • setPage Variable” is fixed so I can’t change it using the “setPage Increment.”
  • The HTTP Request “page” is using “{{ $json.page }}” from “setPage Variable”

Information on your n8n setup

  • n8n version: - 1.78.1
  • Running n8n via: Selfhost Caprover
  • Operating system: Windows

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

If you just want to consume pages of a paginated service, there is a built in feature for that in the HTTP Request node, so you can let n8n handle all that consuming and incrementing stuff. Take a look at this

if you’re referring to the pagination feature inside the node, using {{$response.header}}, I read that using this method will help data handling. Using the pagination feature, this HTTP request always crashed or took forever.

It is possible that consuming all of the content from a paginated source could fill up memory and slow things down I guess.

The problem your loop has is that you are resetting the value of page to 1 every time you reach the setPage Variable node again.

I thought it would be generally useful to have an example of how to set up a loop like this, so instead of posting it as an answer here, I made a Tips & Tricks post at: Incrementing Your Own Loop Variable

Take a look and see if that helps you get things working.

but I run into the same problem. The “page” parameter in the API request is referencing a fixed value. I can’t reference the incremental page value because it won’t be generated until the first API call

The example workflow in Incrementing Your Own Loop Variable works. Just to be sure, I (locally) added an ‘HTTP Request’ node in the middle that calls this dummy “echo” endpoint URL: https://httpbin.org/anything?page={{ $('Increment Loop Var').first().json.page }} (expression, not fixed value), and that works as expected. I suspect you might still not be doing things the same way. Did you copy the example into a new workflow in your environment and test it? Maybe that would help you examine exactly what’s happening.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.