Five core nodes form the backbone of every n8n workflow: the HTTP Request node calls any REST API with full control over method, URL, headers, body, and query params plus built‑in credential management and a 300‑second default timeout; the Set node adds, renames, and removes JSON fields through both manual mapping and a JavaScript mode with Generate Custom Fields; the IF node evaluates conditions with 10 operators combined via AND or OR logic (not mixed); the Merge node consolidates streams through four modes with five join types in Combine mode; and the Code node executes JavaScript (Node.js 18) or native Python with two execution modes. [1] [2]
| 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, Choose Branch | Unified stream |
| Code | Custom logic | JavaScript / Python execution | Any JSON structure |
How do you configure the HTTP Request node to call any REST API with headers, body, and auth?
The HTTP Request node supports all standard HTTP methods—GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS—and provides dedicated sections for Query Parameters, Headers, and Body configuration. Built‑in authentication options include Basic Auth, Bearer Token, API Key, and OAuth, selectable from a dropdown rather than requiring manual header construction. The node also accepts cURL imports for rapid prototyping. [1] [6]
The default timeout is 300 seconds, configurable per node in the
Options panel. For unstable or rate‑limited APIs, configure retry behavior via
the Retry on Fail toggle in node Settings—this enables
automatic re‑execution with configurable max retries and wait intervals
[1]. Use
Query Parameters for dynamic values (e.g., user_id → {{ $json.user_id }})
rather than appending them directly to the URL, which can be unreliable with
expressions [7]. For JSON payloads in POST
requests, set the Content‑Type header to application/json and
construct the body in the Body section; for form‑encoded data, select
Form-Data or x-www-form-urlencoded as the body
content type. For complex API integrations lacking a native n8n node, the
community Better HTTP Request node adds configurable retry
logic for specific status codes (default: 429, 500, 502, 503, 504) with up to
10 retry attempts and configurable delay. For the complete expression
reference used in dynamic headers and URL parameters, see the
n8n Expression Node reference.
How does the Set node add, rename, and remove JSON fields using manual and JavaScript modes?
The Set node (formerly Edit Fields) provides two editing approaches. In
Manual Mapping, you define individual fields with name, type
(string, number, boolean, or array), and value—static or dynamic expressions
({{ $json.orderTotal * 1.2 }}). The node supports dot‑notation
for nested objects: setting address.city creates the nested
structure automatically. Enable Keep Only Set to drop
unlisted fields and enforce a strict schema.
[3]
[8]
Since n8n version 1.92.0, the Set node also supports a
Generate Custom Fields JavaScript mode. This feature allows
defining field generation logic programmatically, where your JavaScript code
returns an object whose properties become the output fields. This is especially
useful when constructing fields dynamically from upstream data or when
maintaining a reusable JSON schema that returns exactly the fields needed.
The JavaScript must return a valid object containing fieldName:
value pairs—n8n then applies the same output processing as manual
mapping. Both modes support referencing data from multiple
upstream nodes simultaneously using the expression editor’s data tree
[9].
For complex transformations beyond what the Set node can handle, see the
n8n Code Node transformation guide.
How does the IF node evaluate conditions with AND/OR logic and route data to true/false branches?
The IF node evaluates one or more conditions against each incoming data item and routes matching items to the true output and non‑matching items to the false output. It supports 10 comparison operators—equals, not equals, greater than, less than, larger or equals, smaller or equals, contains, not contains, exists, empty—across five data types: String, Number, Date & Time, Boolean, and Array/Object. [4] [10]
Multiple conditions are combined via the Combine field: select
AND to require all conditions to be true, or OR
to require at least one condition to be true. A single IF node cannot mix AND
and OR simultaneously—if mixed logic is required, chain two IF nodes in
sequence [10].
For advanced string matching, the node supports regex
operations (e.g., email validation with ^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$)
and case‑insensitive comparison via the Case Sensitive toggle.
For multi‑way routing with three or more distinct outcomes—such as routing
support tickets by category or orders by status—switch to the
IF & Switch node branching guide.
How does the Merge node combine data streams with Append, Combine, SQL, and Choose Branch modes?
The Merge node provides four operation modes. Append
stacks all input items sequentially—input 1 items first, then input 2,
supporting up to 10 upstream connections (chain multiple Merge nodes for
more). Combine merges two inputs by Matching Fields, Position,
or All Possible Combinations. SQL Query runs arbitrary SQL
(via AlaSQL) over input tables named input1, input2,
etc. Choose Branch waits for both inputs then outputs only
the selected branch.
[5]
[11]
Combine > Matching Fields 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). When fields with the same name clash across inputs, the default behavior prioritizes Input 2; you can change this via Options > Clash Handling, or preserve all values with Always Add Input Number to Field Names. For nested objects, choose Deep Merge (merge all property levels) or Shallow Merge (top‑level properties only). The canonical Split → Process → Merge pattern uses conditional nodes (IF/Switch) to branch, processes each path independently, then reunifies with Merge for a clean output. For the complete pattern guide, see the n8n Node Configuration Hub.
How do you use $input, $json, $itemIndex, and execution modes in the Code node?
The Code node provides two execution modes controlling how data flows in.
Run Once for All Items (default) executes once, receiving
all items via $input.all() as an array—ideal for aggregation,
counting, or cross‑item comparisons. Run Once for Each Item
executes separately per item, accessing data through
$input.item.json (shorthand: $json)—best for
independent transformations.
[2]
[12]
Six built‑in variables provide data access across modes: $input.all(),
$input.first(), $input.last(), $json
(shorthand for $input.item.json in Each Item mode),
$binary, $itemIndex (0‑based), $workflow,
$execution, and $prevNode. JavaScript execution runs
on Node.js 18 with support for Promises, async/await,
console.log() debugging (requires CODE_ENABLE_STDOUT=true
on self‑hosted), and external npm modules via
NODE_FUNCTION_ALLOW_EXTERNAL. Native Python execution (version
3.10+) was introduced in n8n 1.63.0, replacing the legacy Pyodide‑based
Python introduced in 1.0. The Python mode runs in a sandboxed subprocess and
requires the n8n-python package installed on the host.
For self‑hosted Docker deployments, use the n8nio/n8n:latest
image—the Python runtime is bundled in the container since version 1.63.0
[13]. Both languages must return an array
of objects, each containing a json key:
return [{ json: { key: "value" } }]. For complete
transformation patterns including flatMap expansion of nested arrays,
Luxon date formatting, and AJV JSON Schema validation, see the
n8n Code Node transformation examples.
{ json: {...} } produces the error “A ‘json’ property isn’t
an object.” Always return return [{ json: { key: "value" } }]—
an array of objects, each with a json key [12].
How do you build a complete workflow combining all five core nodes?
A canonical five‑node pipeline chains: HTTP Request calls an
API and returns a JSON array; a Code node in “Run Once for
All Items” mode aggregates or transforms the data; a Set node
reshapes fields (rename temp_c to temperature, add
a processed_at timestamp); an IF node checks a
computed field (e.g., temperature > 30 for heat alerts); and a
Merge node in Append mode reunifies the true and false
branches into a single output stream.
[14]
[6]
This pattern—pull data, compute, reshape, branch on logic, reunify—appears in
marketing analytics, DevOps monitoring, e‑commerce reporting, and customer
support dashboards. For paginated API endpoints, add a Set node to initialize
a page counter before the HTTP Request node, then loop with an IF
node checking whether results exist; for rate‑limited APIs, insert a Wait node
between batches. For complete production‑grade pipeline
patterns including error handling and retry logic, see the
n8n Node Configuration Hub.
References
- n8n Documentation — HTTP Request Node: HTTP methods, headers, body, query params, built-in auth (Basic, Bearer, API Key, OAuth), uploads, cURL import, 300s default timeout, retry on fail
- n8n Documentation — Code Node: JavaScript (Node.js 18) and Native Python execution, two execution modes, $input/$json/$itemIndex variables, return format
- n8n Documentation — Set Node: Manual Mapping and JavaScript modes, Keep Only Set, dot‑notation for nested fields, field types (string, number, boolean, array)
- n8n Documentation — IF Node: 10 comparison operators, AND/OR combine logic (not mixed), 5 data types, regex matching, case sensitivity
- n8n Documentation — Merge Node: 4 modes (Append, Combine, SQL Query, Choose Branch), 5 join types in Matching Fields, clash handling, deep/shallow merge
- SurferCloud — n8n HTTP Request Node: Real-World Use Cases — GET/POST examples, webhook forwarding, cURL import, auth options, timeout configuration (2026)
- n8n Community — HTTP Request Node Query Parameters: use dedicated section instead of inline URL with expressions (2026)
- n8n.blog — Assign Values with the n8n Set Node: manual mapping, static values, dynamic expressions, Keep Only Set, field types (Sep 2025)
- n8n Community — Set Node JavaScript Mode: Generate Custom Fields, programmatic field generation, dynamic field logic (v1.92.0+)
- dev.to — Using IF Nodes for Conditional Logic: 10 operators, AND/OR logic, regex matching, nested conditions, data type comparisons (Aug 2025)
- 科技文西 TEKVINCI — n8n Merge Node Complete Guide: Append, Combine (5 join types), SQL Query, Choose Branch, clash handling, deep/shallow merge (Sep 2025)
- DeepWiki — Code Node: JavaScript (Node.js), two execution modes, $input.all(), $input.item.json, $itemIndex, return format, common pitfalls (2026)
- n8n Community — Python Code Node: Native Python 3.10+ execution, upgrade from Pyodide, n8n-python package installation, subprocess sandbox, version 1.63.0+ (2026)
- Betazeta — Diving Deeper into n8n: Node types, Set/IF/Merge/SplitInBatches patterns, credential management, best practices (Jul 2025)

