Tips > Reliability & Performance

Use Built-in HTTP Request Pagination Instead of Manual Loops

Many n8n users build manual pagination with Loop + HTTP Request + IF (check for more pages) + Merge.

Many n8n users build manual pagination with Loop + HTTP Request + IF (check for more pages) + Merge. The HTTP Request node has a built-in pagination feature that handles this automatically with far less overhead and no risk of infinite loops.

Real-world example: Fetching all repositories from the GitHub API, which returns 30 items per page with a Link header containing the next page URL.

HTTP Request node configuration:

Setting Value
Method GET
URL https://api.github.com/orgs/your-org/repos
Authentication Predefined Credential (GitHub API)
Pagination
Pagination Mode Response Contains Next URL
Next URL {{ $response.headers.link?.match(/<([^>]+)>;\s*rel="next"/)?.[1] }}
Max Pages 50
Options
Batch Size 1

For APIs using offset-based pagination:

Setting Value
Pagination Mode Update a Parameter in Each Request
Parameter Name offset
Parameter Type Query
Initial Value 0
Next Value {{ $response.body.offset + $response.body.limit }}
Stop Condition {{ $response.body.results.length === 0 }}

This eliminates the need for the Split In Batches loop pattern for simple pagination and reduces execution time because there is no inter-node overhead per page.

Related: Flatten Deeply Nested API Responses | Use Docker Compose with Health Checks for n8n and PostgreSQL

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

191 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book a 20-minute call