On this page
Sommatic Docs
Open portal

Expression API reference

Every variable and helper an expression can use, with its signature, arguments, return value, errors and examples run against the engine Sommatic AI runs.

View as Markdown
Open in

Everything an expression inside {{ }} can read or call. Each example on these pages was run against the expression engine of the orchestrator, as it is deployed, over one example context; the result shown is what the engine returned.

Previous Nodes

Previous Nodes: The expression API of every node: the paths of its output that later nodes read with $("Label").item.json, as the editor suggests them and as the worker returns them.

Input Data

The data that reached the current node.

Signature Returns Description
$json object The input of the current node.
$binary object Binary data (files) attached to the current item. Reserved: always {}.
$itemIndex number Index of the current item in a batch. Reserved: always 0.
$runIndex number Index of the current attempt. Reserved: always 0.

Input Access

The same input in item form: the current item and the list of items.

Signature Returns Description
$input.item { json, binary } The current input item: { json, binary }.
$input.all() list Every input item, as a list. One item per execution.
$input.first() { json, binary } The first input item (the current one).
$input.last() { json, binary } The last input item (the current one).
$input.params object Configuration of the previous node. Reserved: always {}.
$input.context object Context passed by the previous node. Reserved: always {}.

Node Reference

The output of any node that already ran in this execution, the previous node and the entry point of a chained workflow.

Signature Returns Description
$(label) NodeAccessor The output of an earlier node, found by its label.
$prevNode object Metadata of the previous node. Reserved: always Start.
$('Chain Entry Point').item.json { …data, chain_context } What a workflow started by workflow.chain receives: the data and the chain context.

Execution Context

Ids of the current run, the workflow and the node being executed, and the environment.

Signature Returns Description
$execution object Ids of the current run.
$workflow object Slug and version of the workflow that runs.
$node object Id and label of the current node.
$env object Variables of the environment. Reserved: always {}.
$vars object Workflow variables. Reserved: always {}.
$nodeVersion number Version of the current node operator. Reserved: always 1.

Date & Time

The current moment and today, as Luxon DateTime values.

Signature Returns Description
$now DateTime The moment the node runs, as a Luxon DateTime.
$today DateTime The start of the current day, as a Luxon DateTime.

Generators

New random identifiers.

Signature Returns Description
$uuid string A new UUID v4 on every read.
$randomId({ length, prefix }) string A random id with a prefix.

Encoders

Base64 and URL query strings.

Signature Returns Description
$base64Encode(value) string URL-safe Base64 of a text or of a JSON value.
$base64Decode(text) string The text encoded in a Base64 string.
$toQueryString(object) string A URL query string that starts with ?.

Validators

Checks on values.

Signature Returns Description
$isEmpty(value) boolean true when the value has no own keys.

Helpers

Defaults for empty values, slugs, JMESPath queries and lodash.

Signature Returns Description
$ifEmpty(value, fallback) any value, or fallback when value is empty.
$slugify(text) string A lowercase, hyphenated slug.
$jmespath(data, query) any The result of a JMESPath query over any value.
_ lodash lodash: about 300 functions for lists, objects and text.

JavaScript Globals

JavaScript Globals: Math, JSON, text, numbers, lists, objects, dates, regular expressions, Map and Set, Intl, and what does not exist.

Libraries

The full references of the libraries an expression can use, generated from the exact versions the orchestrator ships.

What does not exist

Names a developer often expects, from other tools or older docs, that the engine does not provide. A name that does not exist throws … is not defined.

Name Instead
$node["X"].json $node is only the current node. Read other nodes with $('X').item.json.
$items() $input.all() or $('X').all().
$parameter The node's own configuration is not exposed to its expressions.
$config Service configuration is never exposed.
DateTime Not a global name. Use $now.constructor.
Several items per node Each node execution handles one item. Iterate with flow.split and flow.join, or with map inside one expression.

Example context

The examples run over this data: the input of the current node ($json), the nodes that already ran ($(…)), the ids of the run and the current node. The clock is fixed at 2026-11-26T14:30:00.000Z and the server zone is UTC, so $now and $today give the same values on every page.

Input of the current node JSON
{
  "$json": {
    "body": {
      "order_id": "ord_1042",
      "email": "ana.perez@example.com",
      "customer": {
        "name": "Ana Pérez",
        "segment": "gold"
      },
      "priority": "",
      "items": [
        {
          "sku": "A-100",
          "qty": 2,
          "price": 10.5
        },
        {
          "sku": "B-200",
          "qty": 0,
          "price": 4
        },
        {
          "sku": "C-300",
          "qty": 1,
          "price": 25
        }
      ],
      "tags": [
        "new",
        "web",
        "new"
      ],
      "created_at": "2026-11-25T09:15:00Z"
    },
    "headers": {
      "content-type": "application/json"
    },
    "query": {},
    "method": "POST"
  }
}
Nodes that already ran (label → output) JSON
{
  "Webhook Receiver": "= $json",
  "Normalize input": {
    "correlation_id": "c-7f3a",
    "channel": "web"
  },
  "Classify": {
    "label": "billing",
    "confidence": 0.92
  }
}
Run and current node JSON
{
  "$execution": {
    "id": "fir-xxxx",
    "flow_instance_id": "fi-xxxx",
    "flow_definition_id": "fd-xxxx",
    "flow_version_id": "fv-xxxx",
    "flow_slug": "order-intake"
  },
  "$node": {
    "id": "node-notify",
    "label": "Notify customer"
  }
}

The examples of a chained workflow run over a second context: a workflow started by workflow.chain, whose workflow.trigger node is labelled Chain Entry Point.

Chained workflow (examples marked chain) JSON
{
  "$json": {
    "order_id": "ord_1042",
    "customer_email": "ana.perez@example.com",
    "amount": 46,
    "chain_context": {
      "caller_flow_definition_id": "fd-caller-xxxx",
      "caller_flow_instance_id": "fi-caller-xxxx",
      "caller_flow_slug": "order-intake",
      "caller_node_id": "node-chain-billing",
      "correlation_id": "chain-7Hq2Lw9sKd3pXa1mZr4t",
      "root_flow_instance_result_id": "fir-root-xxxx"
    }
  },
  "nodes": {
    "Chain Entry Point": {
      "order_id": "ord_1042",
      "customer_email": "ana.perez@example.com",
      "amount": 46,
      "chain_context": {
        "caller_flow_definition_id": "fd-caller-xxxx",
        "caller_flow_instance_id": "fi-caller-xxxx",
        "caller_flow_slug": "order-intake",
        "caller_node_id": "node-chain-billing",
        "correlation_id": "chain-7Hq2Lw9sKd3pXa1mZr4t",
        "root_flow_instance_result_id": "fir-root-xxxx"
      }
    }
  },
  "$execution": {
    "id": "fir-root-xxxx",
    "run_flow_instance_result_id": "fir-hop-xxxx",
    "flow_slug": "billing-review"
  }
}

Examples run against the orchestrator at commit 31e874b

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