Tips > Data, APIs & Webhooks

Batch API Calls Instead of Looping One-by-One

When processing multiple items, use the HTTP Request node's **batching** capability instead of calling the API in a loop for each item.

To batch API calls in n8n, use the HTTP Request node's batching options instead of calling the API once per item. Set a batch size and interval so items are sent in chunks with delays that respect rate limits. When an API exposes a batch endpoint, send many records in one request; otherwise batch the individual calls. Batching cuts execution time and avoids rate-limit errors.

Why batch API calls instead of looping one-by-one?

When processing multiple items, use the HTTP Request node's batching capability instead of calling the API in a loop for each item. Many APIs support batch endpoints, and even for APIs that do not, n8n's built-in batching processes items in configurable chunks with built-in delays to respect rate limits.

Real-world example: You need to geocode 500 customer addresses. Calling the geocoding API one-by-one takes 8 minutes and risks rate limits. Batching with controlled concurrency finishes in under 2 minutes.

Batching reduces total execution time, avoids rate limit errors, and often qualifies for bulk pricing discounts on APIs that offer them.

How do you call a native batch endpoint from the HTTP Request node?

// HTTP Request node configuration with batching
{
  "method": "POST",
  "url": "https://api.geocoding-service.com/v1/batch",
  "sendBody": true,
  "bodyParameters": {
    "jsonBody": "={{ { \"addresses\": $items.map(item => item.json.address) } }}"
  },
  "options": {
    "batching": {
      "batch": {
        "batchSize": 50,
        "batchInterval": 1000
      }
    }
  }
}

If the API has a native batch endpoint, use a Code node to chunk items first:

// Code node: "Prepare Batches"
const items = $input.all();
const batchSize = 50;
const batches = [];

for (let i = 0; i < items.length; i += batchSize) {
  const chunk = items.slice(i, i + batchSize);
  batches.push({
    json: {
      addresses: chunk.map(item => ({
        id: item.json.id,
        address: item.json.address
      })),
      batchIndex: Math.floor(i / batchSize)
    }
  });
}

return batches;

How do you batch requests when an API has no batch endpoint?

For APIs without a batch endpoint, configure the HTTP Request node to process items in batches:

HTTP Request node settings:
  URL: https://api.geocoding-service.com/v1/geocode
  Method: POST
  Body: ={{ { "address": $json.address } }}

  Options:
    Batching:
      Batch Size: 10          # Process 10 items at a time

      Batch Interval: 1000    # Wait 1 second between batches

    Retry On Fail: true
    Max Retries: 3
    Wait Between Retries: 2000

Related: Use Structured Output (JSON Mode) for Parseable Responses · Configure Payload Size and Binary Data Mode for Large Files

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

190 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 an introductory call