Skip to content

Custom variables#

n8n provides the following variables:

  • $binary: incoming binary data from a node
  • $data: incoming raw data from a node
  • $env: contains environment variables
  • $json: incoming JSON data from a node
  • $now: a Luxon object containing the current timestamp. Equivalent to DateTime.now().
  • $parameters: parameters of the current node
  • $position: the index of an item in a list of items
  • $resumeWebhookUrl: the webhook URL to call to resume a waiting workflow.
  • $runIndex: how many times the node has been executed. Zero-based (the first run is 0, the second is 1, and so on).
  • $today: a Luxon object containing the current timestamp, rounded down to the day. Equivalent to DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).
  • $workflow: workflow metadata

Examples#

$executionId#

Contains the unique ID of the current workflow execution.

1
2
3
const executionId = $executionId;

return [{json:{executionId}}];

$runIndex#

Contains the index of the current run of the node.

1
2
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
const allItems = $items("IF", 0, $runIndex);

$workflow#

Gives information about the current workflow.

1
2
3
4
5
6
// Boolean. Whether the workflow is active (true) or not (false)
$workflow.active
// Number. The workflow ID.
$workflow.id
// String. The workflow name.
$workflow.name