Learn how to paginate API calls using take, skip and pageCount, both in n8n and in your own code.
When you enable pagination in n8n, you can use pageCount to identify which page is being fetched.
The main values are:
take: maximum number of items fetched in each call.
skip: number of items that should be ignored before starting the search.
pageCount: current page number. The count starts at 0.
Set take as:
take = 1000
On the first call, the pageCount will be 0:
pageCount = 0
skip = 1000 × 0
skip = 0
Thus, n8n fetches the first 1,000 items.
On the second call, the pageCount will be 1:
pageCount = 1
skip = 1000 × 1
skip = 1000
Now, n8n skips the first 1,000 items and fetches the next 1,000.
The expression used in the skip field is:
{{ $pageCount * 1000 }}
The general formula is:
skip = take × pageCount

To perform pagination through code, such as JavaScript or Python, we can use the same logic as n8n.
First, we define:
take = 1000: maximum number of items fetched per call.
pageCount = 0: initial page number.
skip: number of items the API should skip.
The value of skip is calculated as follows:
skip = take × pageCount
pageCount = 0
skip = 1000 × 0
skip = 0
The API retrieves the first 1,000 items.
pageCount = 1
skip = 1000 × 1
skip = 1000
The API skips the first 1,000 items and retrieves the next 1,000.
pageCount = 2
skip = 1000 × 2
skip = 2000
The API skips the first 2,000 items and retrieves the next 1,000.
After each call, the code should increase pageCount by 1 and repeat the search.
Since the API routes no longer return the total number of records (count), we must check how many items were received in each call.
Considering take = 1000:
If the API returns 1,000 items, there may be another page.
If it returns fewer than 1,000 items, this is the last page.
If it returns no items, there are no more records.
The rule is:
Continue while the number of items returned equals the take.
Stop when the number of items returned is less than the take.
If there are exactly 1,000, 2,000, or 3,000 records, the last page will be returned in full.
In this case, you will need to make one more call. It will return an empty list, confirming that there are no more items.
Example with exactly 2,000 records:
First call: 1,000 items
Second call: 1,000 items
Third call: 0 items
When you receive 0 items on the third call, pagination should be stopped.
The items received in each call should be added to a single list. At the end of pagination, this list will contain all records found by the API.