Reference Data from a Previous Node in n8n
You are 5 steps deep into a workflow and need to grab the 'id' field from the very first node named 'Webhook'.
Incoming Payload / Data:
// Node Name: 'Webhook'
// Output Data:
{
"id": "usr_99812"
}
Press Enter or click Check Answer. +20 XP
β Solution & explanation
Output: usr_99812
$('Node Name') gives you access to any earlier node's output. .item returns the item linked to the one currently being processed, and .first() returns that node's first output item. Both expose the data under .json.π‘ Pro tip: The node name must match exactly, including spaces and capitalization. Renaming a node in n8n updates expressions that reference it automatically.
Also accepted: first().json.id, last().json.id