On this page
Sommatic Docs
Open portal

Variables

The variables an expression can read, with their type and an example each — the current input, the output of any earlier node, the run, the workflow, the node itself, dates and ids — and the names that do not exist.

View as Markdown
Open in

Every expression can read the variables below. They describe one node execution: the data that reached the node, the nodes that already ran, the run and the workflow it belongs to.

VariableTypeWhat it holds
$jsonobjectThe input of the current node.
$inputobjectThe same input, as an item.
$('Node label')functionThe output of an earlier node, looked up by its label.
$executionobjectIds of the current run.
$workflowobjectSlug and version of the workflow.
$nodeobjectId and label of the current node.
$now, $todayLuxon DateTimeThe current moment and the start of today.
$uuidstringA new UUID v4 on every read.

$json

$json is the input of the current node: the output of the node that routed to it. For the first node after the trigger, it is the trigger’s input.

JavaScript
{{ $json.customer.email }}
{{ $json.items.length }}

A webhook trigger delivers the raw request as { body, headers, query, method }, so the node right after it reads the request fields under body:

JavaScript
{{ $json.body.order_id }}
{{ $json.headers['content-type'] }}

$json changes from node to node. To read the webhook body further down the graph, use $('Webhook Receiver') (below), not $json.

$input

$input wraps the same input as an item, for expressions written in the item style:

MemberReturns
$input.item{ json }, where json is $json
$input.first(), $input.last()The same item
$input.all()A list with exactly one item
JavaScript
{{ $input.item.json.status }}

A node handles one item per execution, so $input.all() always returns one element.

$(‘Node label’)

$ is a function: it takes the label of a node that already ran in this execution (the name shown on the canvas) and returns an accessor. When a node has no label, use its node_id.

MemberReturns
.item{ json } with the output of that node
.first(), .last()The same item
.all()A list with that item
.isExecutedtrue when the node already ran in this execution
JavaScript
{{ $('Normalize input').item.json.correlation_id }}
{{ $('Webhook Receiver').item.json.body.email }}
{{ $('Enrich customer').isExecuted }}

For a node that did not run (it is on another branch, or after the current one), .item returns { json: {} }, so reading a field gives undefined instead of an error. Check .isExecuted when the difference matters.

$execution

Ids of the current run. Write them in messages, tasks and logs so anyone can trace a case back to its run.

FieldContains
idThe principal id of the run. When the run was started by workflow.chain, it is the id of the root run, so the whole chain shares it.
flow_instance_result_idThe principal result id (same as id).
root_flow_instance_result_idThe result id of the root run of a chain.
run_flow_instance_result_idThe result id of this specific run, also inside a chain.
flow_instance_idThe id of the flow instance.
flow_definition_idThe id of the workflow definition.
flow_version_idThe id of the published version that runs.
flow_slugThe workflow slug.
JavaScript
Case received. Reference: {{ $execution.id }}

Fields that are not available in a run are null.

$workflow

FieldContains
slugThe workflow slug.
versionIdentifies the version that runs. Treat it as an opaque value, not as a number.
JavaScript
{{ $workflow.slug + '@' + $workflow.version }}

Use only these two fields. For the id of the definition, use $execution.flow_definition_id.

$node

Metadata of the node being executed: id (its node_id), label and name (equal to label).

JavaScript
Created by {{ $node.label }} in {{ $workflow.slug }}

$now and $today

$now is a Luxon DateTime for the moment the node runs. $today is the start of the current day. Both use the server’s time zone, so set the zone you need before formatting:

JavaScript
{{ $now.setZone('America/Bogota').toFormat('yyyy-LL-dd HH:mm') }}
{{ $now.setZone('UTC').toISO() }}
{{ $today.plus({ days: 30 }).toISODate() }}

In a mixed field, format the date yourself (toISO(), toFormat(…)): a bare $now is inserted as a quoted JSON string.

$uuid

A new random UUID v4 each time you read it. It is a property, not a function:

JavaScript
{{ $uuid }}

Two reads give two different values. When several nodes need the same id, generate it once (for example in a data.transform) and read it from that node with $('…').

What does not exist

Not availableUse instead
$node["X"].json$node is only the current node’s metadata. Use $('X').item.json.
$items()$input.all() or $('X').all().
$parameterThe node’s own configuration is not exposed.
$configService configuration is not exposed.
Several items per nodeEach execution of a node handles one item. Iterate with flow.split and flow.join.

A name that does not exist throws … is not defined: a mixed field shows [ERROR: …] and a pure field keeps its {{ … }} text unresolved.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs