n8n metadata
Methods for working with n8n metadata.
This includes:
Access to n8n environment variables for self-hosted n8n.
Metadata about workflows, executions, and nodes.
Information about instance Variables and External secrets.
JavaScript
$execution.customData
Set and get custom execution data. Refer to Custom executions data for more information.
✅
$execution.id
The unique ID of the current workflow execution.
✅
$execution.mode
Whether the execution was triggered automatically, or by manually running the workflow. Possible values are test and production.
✅
$getWorkflowStaticData(type)
This gives access to the static workflow data. Static data doesn't persist when testing workflows: publish the workflow and run it from a trigger or webhook to save static data. For persisting data between executions, consider data tables instead. View an example.
✅
$("<node-name>").isExecuted
Check whether a node has already executed.
✅
$itemIndex
The index of an item in a list of items.
❌
$nodeVersion
Get the version of the current node.
✅
$prevNode.name
The name of the node that the current input came from. When using the Merge node, note that $prevNode always uses the first input connector.
✅
$prevNode.outputIndex
The index of the output connector that the current input came from. Use this when the previous node had multiple outputs (such as an If or Switch node). When using the Merge node, note that $prevNode always uses the first input connector.
✅
$prevNode.runIndex
The run of the previous node that generated the current input. When using the Merge node, note that $prevNode always uses the first input connector.
✅
$runIndex
How many times n8n has executed the current node. Zero-based (the first run is 0, the second is 1, and so on).
✅
$version
The node version.
❌
$workflow.active
Whether the workflow is active (true) or not (false).
✅
$workflow.id
The workflow ID.
✅
$workflow.name
The workflow name.
✅
Python (native)
_items
Contains incoming items in "Run once for all items" mode.
_item
Contains the item being iterated on in "Run once for each item" mode.
_query
In the Code Tool, contains the input string the AI Agent passes when it calls the tool. Available in "Run once for all items" mode.
Python (Pyodide, deprecated)
Python (Pyodide) support is deprecated from n8n 1.113.2. Use Python (native) instead.
_env
Contains n8n instance configuration environment variables.
_execution.customData
Set and get custom execution data. Refer to Custom executions data for more information.
_execution.id
The unique ID of the current workflow execution.
_execution.mode
Whether the execution was triggered automatically, or by manually running the workflow. Possible values are test and production.
_execution.resumeUrl
The webhook URL to call to resume a workflow waiting at a Wait node.
_getWorkflowStaticData(type)
This gives access to the static workflow data. Static data doesn't persist when testing workflows: publish the workflow and run it from a trigger or webhook to save static data. For persisting data between executions, consider data tables instead. View an example.
_("<node-name>").isExecuted
Check whether a node has already executed.
_nodeVersion
Get the version of the current node.
_prevNode.name
The name of the node that the current input came from. When using the Merge node, note that _prevNode always uses the first input connector.
_prevNode.outputIndex
The index of the output connector that the current input came from. Use this when the previous node had multiple outputs (such as an If or Switch node). When using the Merge node, note that _prevNode always uses the first input connector.
_prevNode.runIndex
The run of the previous node that generated the current input. When using the Merge node, note that _prevNode always uses the first input connector.
_runIndex
How many times n8n has executed the current node. Zero-based (the first run is 0, the second is 1, and so on).
_secrets
Contains information about your External secrets setup.
_vars
Contains the Variables available in the active environment.
_workflow.active
Whether the workflow is active (true) or not (false).
_workflow.id
The workflow ID.
_workflow.name
The workflow name.
Last updated
Was this helpful?