← Lesson
BitWithBite
n8n Automation · Quick Reference

Lesson 9: Loops, Splits & Batch Processing — N8N Course Cheat Sheet

n8n Automation
In one line: Master N8N's approach to handling large datasets — split thousands of items into manageable chunks, understand automatic iteration, and respect API rate limits like a pro.

Key Ideas

11The SplitInBatches Node. When you need to process a large list of items — think 1,000 contacts, 500 orders, or 10,000 spreadsheet rows — sending them all at once is dangerous. The SplitInBatch...
22How N8N Naturally Iterates. Here is something powerful about N8N that beginners often miss: every node automatically processes all items in sequence. If a previous node outputs 10 items, the next...
33Rate Limiting — Why Batching Matters ⚠️ API Rate Limits Are Real — And Costly Most APIs cap requests per minute or per second. Sending 1,000 requests instantly will get your API key blocked or throttled. Mailchimp allows 10 req/sec. Clearbit allows 20 req/min. Stripe allows 100 req/sec. Always check the API docs and use SplitInBatches + a Wait node to stay safely within limits. Beyond rate limits, batching also protects your N8N server's memory. Processing 50,000 spreadsheet rows all at once can crash a low-memory instance. Batching keeps memory usage flat and predictable across long-running workflows. Scenario Batch Size Delay Between Batches Reason Email sending (Mailchimp) 50 / batch 1,000 ms 10 req/sec limit CRM contacts (HubSpot) 100 / batch 500 ms 100 req / 10 sec limit Database inserts (Postgres) 200 / batch 0 ms Memory management only AI API calls (OpenAI) 5 / batch 2,000 ms Strict RPM limits on free tier 🔵 Add a Wait Node Between Batches Place a Wait node between the SplitInBatches loop output and your processing node. Set it to 1 second. This creates a natural pause between each batch and keeps you comfortably within most API rate limits without any extra code. 4N8N Loop Expressions in Code. When using the Code node inside a SplitInBatches loop, you can access batch context information using N8N's built-in node variables. Here is how to work with batch dat...
45Loop Approaches Compared. N8N gives you three distinct ways to loop over data. Choosing the right approach depends on your data volume, API rate limits, and whether you need in-memory transform...

Code Examples

// Get current batch info from SplitInBatches context const batchIndex = $node["SplitInBatches"].context.currentRunIndex; const totalItems = items.length; // Log progress for debugging in execution log console.log(`Processing batch #${batchIndex + 1} ...