Skip to content

Expressions

An expression computes a parameter value at run time instead of pinning it to a constant — pull a field off the item flowing through, fall back to a default, reshape a list, or stamp a timestamp on a message. Expressions are written in {{ … }} and evaluated by the same engine that runs the workflow, so the builder's preview matches what the run produces. This page covers where you can write one, what data is in scope, and every built-in function.

What an expression is

Any parameter that accepts one shows a Toggle expression control next to its label. Turn it on and the field becomes an expression editor — marked with an fx badge, with the placeholder Expression, e.g. item.json.status.

There are two shapes, and the difference matters:

  • Interpolation — one or more {{ … }} inside a longer string. Each result is converted to text and spliced into place, so Hello {{ item.json.name }} produces a string. A value that isn't there renders as nothing rather than blocking the rest of the message.
  • Whole-field expression — the field is exactly one {{ … }} and nothing else. The raw typed value passes straight through: a list stays a list, a number stays a number, an object stays an object. This is how you feed a list parameter from an upstream list.

The preview labels the two cases typed value and text, so you can always tell which one you wrote.

Writing one

The inline editor starts one line high and grows as you type. It gives you:

  • Syntax highlighting — the {{ … }} regions are tinted, with namespaces, functions, strings, numbers and the pipeline operator each colored differently.
  • Autocomplete — namespace roots are offered the moment you type {{, functions by name, node names inside nodes[…], and the fields of an upstream node's output as you type the path. The node list is scoped to nodes upstream of the one you're editing, so you can only complete something that can actually have data, and field suggestions come from the node's pinned fixture, its last run, the shape its type declares, or a shape declared on its Data tab (see Item shapes). Each suggestion notes where the field comes from — Declared · node, Inferred · node and the like, or branch only for a field only some branches carry.
  • Bracket and quote auto-close — typing (, [, {, " or ' closes the pair for you.
  • Live linting — problems are underlined as you type, with the message on hover.
  • A live result — under the field, what the expression evaluates to right now, so the common case never needs the bigger editor. Until there is enough data to evaluate it, it reads Cannot evaluate yet.
  • A reference button — opens Expression reference, a searchable list of every namespace and every function (Search namespaces and functions…), grouped exactly like the tables below.
  • An expand button — Open the expression editor opens the full editor window with a live preview.

The expression editor window

The expanded editor is titled Edit expression. Its header carries Insert an expression — ready-made snippets grouped as Text, Date & time, Lists and Objects, such as Text before a character, Format a date, Keep matching items or Add up a field — and the same Expression reference as the inline field.

Generate writes the expression for you: describe it in plain words (Describe it in plain words — e.g. “the title, uppercased”) and the result lands in the editor for you to check against the preview. If the request cannot be turned into an expression, you get Generation failed — try rephrasing your request.

Preview evaluates what you have written after a short pause and shows the result, or the problem. Before you type anything it reads The result appears here as you type. A failure is badged with its kind — Syntax error, Forbidden, Budget exceeded, Type error or Internal error — and Go to the error position jumps the cursor to the offending characters. The panel carries one standing caveat: now(), uuid() and random() are fixed in previews, so results never flicker between keystrokes.

Context is what the preview evaluates against, laid out as a tree you can browse: Current item, Upstream nodes and Workflow context, each value tagged with where it came from — Pinned, From last run, Sample, Declared or Inferred. Click a row, or drag it into the editor, to insert the exact expression for that path at the cursor (Insert into the expression). You can also drag a row onto a collapsed expression field. Two ways to give the preview data to work with:

  • Sample item JSON — under Edit sample data, paste a representative payload. It is bound as item.json; a JSON list binds items, with item as the first entry. What you paste is remembered per node, so it is still there the next time you open the field.
  • Upstream pinned fixtures — the real outputs you pinned from an earlier run with Pin as fixture, checkable one node at a time. Until you pin something, the panel reads No upstream node has pinned fixtures yet. See Running & debugging for how to capture them.

What data is in scope

Expressions read from a fixed set of namespaces. Nothing else is reachable.

Namespace What it holds Example
item The current input item: .json is the payload, .binary the attachments. {{ item.json.email }}
items All input items of the current batch — item is items[0]. {{ count(items) }}
nodes An executed upstream node, keyed by display name: .item (the item the current one came from), .first(), .last(), .items, .all(port). {{ nodes["Enrich finding"].item.json.summary }}
trigger The trigger's output and metadata — a webhook request, a form submission, a schedule slot, a signal or a collector document. {{ trigger.headers["x-github-delivery"] }}
loop Inside containers: index and path (a while-loop condition also sees first). {{ loop.index }}
workflow This workflow: id, name, version, projectId. {{ workflow.name }}
execution This execution: id, and mode — production, test, partial, retry or subworkflow. {{ execution.mode }}
run This step: stepId, nodeId, nodeName, attempt, iterationPath. {{ run.attempt }}

Nodes are addressed by the name you see on the canvas, not by any hidden identifier — nodes["Enrich finding"]. Renaming a node in the builder rewrites every reference to it in one step, so a rename never silently breaks a downstream field. Referencing a node that is not upstream of the one you are editing is reported as a validation finding, because it can never have data when the workflow runs.

nodes["X"].item follows the item you are on back through the graph: it is the item of X that this one came from. After a step that replaces each item — an HTTP call, say — nodes["Create city items"].item.json.city still reads each item's own city. Where that trail breaks, at a step that builds new items without recording where they came from, it falls back to X's first item. .first() and .last() always read X's first and last item; give them a port number, as with .all(port), to read another output. When X's first output carried nothing — a condition whose items all left on its false branch — nodes["X"] reads the first output that did. Naming the trigger reads what it emitted, the same data as trigger, and naming an agent reads its answer.

Three names are reserved but not bound yet

vars, env and memory are recognized but not yet bound. The editor flags them as you type — "vars" is not available in workflows yet — the step would fail before running — and a step whose parameter references one fails with expression references "vars" (workflow variables), which is not available yet. Use the namespaces in the table above and carry anything else on the item. To remember things between runs, use a Memory node — see Workflow memory.

Syntax

The language is deliberately small. The whole surface:

  • Literals — strings, numbers, true, false, null, lists like [1, 2, 3], and maps like { "a": 1 }.
  • Member and index access — a.b, a[0], and a["key with spaces"].
  • Optional chaining — a?.b short-circuits to nothing when the value before it is null or missing, instead of raising a type error.
  • Null-coalesce — a ?? b yields b when a is null or missing.
  • Arithmetic and comparison — + - * / % and == != < <= > >=.
  • Logic — &&, ||, !, and the ternary cond ? a : b.
  • Membership — x in list.
  • Pipeline — | passes the value on the left as the first argument to the call on the right, so items | filter(i, i.score > 0.5) | map(i, i.title) reads left to right. Every function whose first argument is the natural input can be used this way.

Types are strict

  • + adds two numbers, joins two strings or concatenates two lists. Mixed operands fail with '+' requires matching operand types, so convert first: number(item.json.qty) + 1, "Order " + string(item.json.id).
  • !, &&, || and the condition of ? : take booleans only — !item.json.customer fails with '!' requires a boolean, got map. To test whether a value is there, compare it: item.json.email != null, or use ?? for a fallback.
  • Values have no methods: write upper(x), not x.toUpperCase(). There is no .length either — count(x) is the size of a list, a map or a string.

What the language cannot do

There are no variables, no loops, no assignment, no recursion, and no user-defined functions. An expression cannot call out to the network, read a file, or run arbitrary code — if you need that, use a node. Evaluation also runs under hard budgets on size, steps and time; exceeding one fails the step immediately rather than leaving it hanging.

Built-in functions

The built-ins transform data and nothing else — none of them reads or writes anything outside the expression. They fall into the same five categories the in-editor reference uses.

String

Function What it does
lower(s) Lowercases a string.
upper(s) Uppercases a string.
trim(s) Removes surrounding whitespace.
split(s, sep) Splits a string on a separator into a list.
replace(s, old, new) Replaces every occurrence of a substring.
matches(s, pattern) True when the string matches the regular expression.

Date, time & effects

Function What it does
now() The current time (journaled: fixed within a step and in previews).
parseTime(s) Parses RFC 3339 / date strings into epoch milliseconds.
format(t, layout) Formats a time with YYYY MM DD HH mm ss SSS tokens.
duration(s) Parses durations like "1h30m" into milliseconds.
uuid() A UUID (journaled, like now()).
random() A float in [0, 1) (journaled, like now()).

Journaled means the value is recorded the first time it is produced in a step: a retry or a replay of that step reuses it instead of drawing a new one. That is what keeps a re-run of a failed workflow honest — and why the preview shows a fixed value.

Collections

Function What it does
map(list, x, expr) Transforms every element.
filter(list, x, expr) Keeps elements where the predicate holds.
reduce(list, acc, x, expr, init) Folds a list into a single value.
find(list, x, expr) The first element matching the predicate, or null.
sort(list, [x, keyExpr,] [dir]) Sorts a list, optionally by a key expression and direction.
unique(list) Removes duplicate elements, keeping first occurrences.
group(list, x, keyExpr) Groups elements into a map keyed by the key expression.
flatten(list) Flattens one level of nested lists.
count(v) The number of elements (list), entries (map), or characters (string).
join(list, sep) Joins list elements into a string with a separator.

Objects

Function What it does
keys(m) The map's keys, sorted.
values(m) The map's values, in sorted-key order.
get(v, path) Resolves a dot path inside a value: get(v, "a.b.0").
merge(m1, m2, …) Merges maps left to right; later keys win.

Encoding

Function What it does
json(v) Encodes a value as compact JSON.
parseJson(s) Parses a JSON string into a value.
base64(s) Base64-encodes a string.
parseBase64(s) Decodes a base64 string.
urlEncode(s) Percent-encodes for URLs (RFC 3986).
urlDecode(s) Decodes percent-escapes.
hash(s, [algo]) Hashes a string: hash(s) is sha256; hash(s, algo) for md5, sha1 or sha256.
number(v) Converts text, a boolean or a number to a number: number("12.5") is 12.5, true is 1. Text that is not a number is a type error; null stays null.
bool(v) Converts text (true/false, yes/no, 1/0, any case), a number (zero is false) or a boolean to a boolean; null stays null.
string(v) Converts a value to text: numbers in plain decimal, booleans as true/false, maps and lists as JSON; null is "".

Lambdas

The collection functions are the only place a small inline function may appear, and it always takes the same shape: you name the element, then write one expression using that name.

{{ map(items, x, x.json.title) }}

x is yours to name — i, finding, whatever reads best — and it exists only inside that one expression. filter, find, group and sort follow the same pattern; reduce names two, the accumulator and the element.

Common recipes

Pull a field off the item currently flowing through the node:

{{ item.json.customer.email }}

Reach back to a named node earlier in the graph — for the item you are on, even after steps that replaced it:

{{ nodes["Enrich finding"].item.json.summary }}

Do arithmetic on numbers that arrive as text:

{{ number(item.json.quantity) * number(item.json.price) }}

Supply a fallback when a field may be missing:

{{ nodes["Triage agent"].item.json.summary ?? "no summary" }}

Filter, project and join a list in one readable line:

{{ items | filter(i, i.json.score > 0.5) | map(i, i.json.title) | join(", ") }}

Format a timestamp — either the current time or one carried on the item:

{{ format(now(), "YYYY-MM-DD HH:mm") }}
{{ format(parseTime(item.json.created_at), "YYYY-MM-DD") }}

Build a message out of several fields. This one interpolates, so the result is text:

{{ item.json.severity }} on {{ item.json.host }} — {{ count(item.json.findings) }} findings, owner {{ item.json.owner ?? "unassigned" }}

Deduplicate webhook deliveries on the sender's delivery header, in the Dedupe Key field of a webhook trigger:

{{ trigger.headers["x-github-delivery"] }}

Count what arrived in this batch:

{{ count(items) }}

Errors you may see

The editor lints as you type. The messages you are most likely to meet:

Message What it means What to do
Syntax error: <detail> The expression does not parse. Use Go to the error position in the expanded editor — the cursor lands on the offending characters.
"$json" is n8n syntax — Crios expressions use item.json… instead You wrote an n8n-style $ variable. Accept the suggested fix (Use "item.json"), or rewrite the path with the namespaces above.
Unknown namespace "<name>" The root you typed is not one of the namespaces above. When a close match exists, the message adds did you mean with it. Check the spelling, or open the reference and pick a root from the list.
"loop" is only bound inside a loop or scope container loop is used outside a container. Move the expression into the container's inner graph, or read the value another way.
"vars" is not available in workflows yet — the step would fail before running A reserved but unbound root: vars, env or memory. Carry the value on the item instead.
This workflow has no node named "<name>" nodes["…"] names a node that does not exist, possibly with a did you mean suggestion. Fix the name.
"<name>" is not upstream of this node, so its data is never available here The node exists but its output never reaches this one. Connect the node so its output actually reaches here, or read the value from a node that does.
"<name>" is not a stdlib function The call is not one of the built-ins. The language has no user-defined functions — pick a built-in (the message suggests one when it can), or move the work into a node.
"secrets" is not allowed in expressions — credential material flows only through credential slots The expression referenced a forbidden namespace. Bind a credential to the node instead.
Expression exceeds the <detail> budget Evaluation hit a size, step or time limit. Split the work across nodes, or narrow the list before mapping over it.
Internal evaluator error: <detail> The evaluator itself failed. Simplify the expression to isolate the part that triggers it, and report it.

In the editor, an unknown namespace root and a node name that does not exist or is not upstream are warnings — the editor cannot always see the whole graph, so it points them out without insisting. Everything else above is an error. When you save, the workflow's own validation has the final word: an expression that does not parse, reaches for a forbidden name, or names a node that does not exist keeps the draft from being saved at all, while one that reads from a node that is not upstream is only a warning. See Building a workflow.

Saving also warns about expressions that would fail, or read nothing, when the step runs. These appear in the Problems panel and do not block saving, but the first three block publishing, since the step would fail, or render nothing, every time it runs:

Message What it means
expression calls .<name>() on a value, but values have no methods here A method call in the style of JavaScript. Use the function instead: upper(x), not x.toUpperCase().
expression calls <name>(), which is not an expression function The call is not a built-in. Pick one from the tables above.
expression reads "<name>", which is not a namespace here The root is not one of the namespaces above.
This expression reads a field its input never carries: … The node before it declares everything its items carry, and this field is not among it. The message lists what the items do carry and, when it can, the path you probably meant — such as …json.body.<field> for a webhook request's fields.
This expression uses a field in a way its declared type cannot take: … Arithmetic on a text field, for example. Convert the value first with number() or string(). See Item shapes.

A note on secrets

Secrets are not reachable from an expression

There is no secrets namespace and no function that reads one — a reference to one is rejected as you type, with a message pointing you at credential slots. Secret material only reaches a node by being bound to a credential slot and resolved inside the run, where it is never rendered into a parameter you can read. See Credentials & connections.

For where these fields live and how data moves from one node to the next, see the Node reference and Building a workflow.