Issue with Pagination in n8n API Request: How to Increment skip Correctly?

I’m trying to configure pagination for API requests in n8n, but I’m facing some issues. The API I’m using supports pagination through parameters like skip, returning 1000 records per request. I’ve set the skip parameter as {{ $pageCount + 1000 }}, but the request isn’t progressing as expected, and the data returned is identical across multiple iterations.

I’m not sure whether the increment should be done like 1 + 1000 = 1001, and the next one should be 2 + 1000 = 1002, or if the value should accumulate the 1000 for each pagination (i.e., 1000, 2000, 3000, etc.).

Can anyone explain how to ensure the $pageCount variable increments correctly so that the skip value is calculated incrementally (1000, 2000, 3000, etc.)?

Thanks in advance for your help!

Hi there @Henrique_Marsal , instead of using {{ $pageCount + 1000 }}, try

{{ $pageCount * 1000 }}

Will you be able to share the workflow and additional information on the API you’re trying to configure? The information you’ve given is quite vague.

it should accumulate the value, 1000,2000,3000

because you are using skip, which skips the value after 1000 (for example)

so you need to use * instead of +

Oops, I tried to do that, but it gave me an error. I don’t know if the error is in the stop condition, which is an empty array or if it’s in the loop. I can’t share the exact workflow, but I’ll send images. This is the API I use: https://atendimento.movidesk.com/kb/pt-br/article/256/movidesk-ticket-api?ticketId=&q=

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