Affiliate/Ads disclaimer: Some links on this blog are affiliate/ads links to support this project going on, meaning I may earn a commission at no extra cost to you.
Core n8n Nodes: HTTP Request, Set, IF, Merge & Code Explained
Five core nodes form the backbone of every n8n workflow: the HTTP Request node calls any REST API, the Set node shapes and remaps JSON fields, the IF node splits execution into true/false branches, the Merge node combines multiple data streams, and the Code node runs custom JavaScript (Node.js 18) or Python (Pyodide‑based Python 3.x) for logic beyond built‑in capabilities. Mastering these five nodes unlocks full control over data flow. [1]
| Node | Primary Role | Key Operation | Output |
|---|---|---|---|
| HTTP Request | Call external APIs | GET, POST, PUT, PATCH, DELETE | JSON, text, binary, HTML |
| Set | Edit JSON fields | Add, modify, delete fields | Transformed items |
| IF | Binary branching | Evaluate condition → true/false | 2 output branches |
| Merge | Combine streams | Append, Combine, SQL Query | Unified stream |
| Code | Custom logic | JavaScript / Python execution | Any JSON structure |
How does the HTTP Request node call any REST API in n8n?
The HTTP Request node calls any REST endpoint using standard methods (GET, POST, PUT, PATCH, DELETE). You configure the URL, method, headers, and optional body in the node parameters panel. It parses JSON, XML, text, and binary responses, supports Basic Auth, Custom Auth, Digest Auth, and OAuth2 credential types, and handles pagination and status‑code‑ based branching. [2]
The HTTP Request node is the universal integration adapter: when n8n lacks a native integration for a third‑party API, this node bridges the gap. For production‑grade reliability, the community Better HTTP Request node adds configurable retry logic for specific status codes (default: 429, 500, 502, 503, 504) with a maximum of three retry attempts (range 1–10) and a default delay of 1000 ms between retries [3]. For secure API calls, always pair this node with n8n credential management.
How does the Set node add, rename, and remove JSON fields in a workflow?
The Set node edits JSON fields through a visual field editor: you map a field name to a value or expression. It adds new fields, overwrites existing ones, and—with the “Keep Only Set” option—removes all unlisted fields, enforcing a strict data contract between nodes. Values can be static strings, numbers, booleans, or dynamic expressions. [4]
The Set node excels at normalizing API responses before they reach
downstream nodes—renaming fname to firstName,
converting timestamps to ISO strings, or computing fields with
expressions like {{ $json.total * 1.2 }}. For complex
reshaping or conditional field logic, chain it after an
IF or Switch node
to set different values per branch. The complete Set node tutorial
template demonstrates all six core concepts in one workflow
[5].
How does the IF node branch workflow execution based on data conditions?
The IF node evaluates a true/false condition and routes each data item along the corresponding output branch. It supports 10 comparison operators—equals, not equals, greater than, less than, greater/less than or equal to, contains, not contains, is empty, is not empty—and the “Combine” field controls whether multiple conditions are joined with AND or OR logic. [6]
Use IF for binary decisions: “Is this customer VIP?” or “Does the
invoice total exceed $1,000?” For three or more distinct routes, use the
Switch node instead.
Expressions like
{{ $json.tags.includes("urgent") }} inside IF conditions
unlock dynamic, data‑driven branching without custom code.
How does the Merge node combine multiple data streams into one output?
The Merge node consolidates data from two or more inputs (up to multiple inputs since n8n 1.49.0). Four modes are available: Append stacks all items sequentially; Combine matches items by field, position, or all possible combinations; SQL Query runs a SQL statement over input data; and Choose Branch selects one input based on a condition. [7]
In Combine > Matching Fields mode, the node supports five output types: Keep Matches (inner join), Keep Non‑Matches, Keep Everything (outer join), Enrich Input 1 (left join), and Enrich Input 2 (right join). A classic pattern is Split → Process → Merge: branch with IF or Switch, process each path independently, then reunify with Merge for a clean output.
How do the two Code node execution modes process workflow data?
“Run Once for All Items” (default) executes the code once, receiving all
items via $input.all()—ideal for aggregation, counting, and
cross‑item comparisons. “Run Once for Each Item” executes separately
per item, accessing data through $input.item.json—best for
independent transformations like field mapping or enrichment.
[8]
Both modes return data identically: a single object or an array of objects. The JavaScript runtime is Node.js 18 with full access to n8n built‑in methods; Python runs via Pyodide (CPython compiled to WebAssembly) with a limited package set. Use JavaScript for performance, Python for familiarity. The Code node replaced the legacy Function and Function Item nodes in n8n 0.198.0 [9].
How do you combine HTTP Request, Set, IF, Merge, and Code in one workflow?
A canonical five‑node workflow starts with an HTTP Request node calling an API and returning a JSON array. A Code node in “Run Once for All Items” mode aggregates the data—comparing or counting items—then a Set node reshapes the fields for the next step. An IF node branches on a computed threshold, and a Merge node reunifies the true and false branches into a single output. [10]
References
- n8n Core Nodes Documentation Overview
- n8n HTTP Request Node Documentation
- n8n-nodes-better-http-request — NPM Package with Retry Logic
- n8n Set Node Documentation
- n8n Workflow Template — Complete Set Node Tutorial
- n8n IF Node Documentation
- n8n Merge Node Documentation
- n8n Code Node Documentation
- DeepWiki — n8n Code Node Technical Reference
- n8n Blog — Mastering HTTP Request: Split, Scrape, Paginate

