On this page
Sommatic Docs
Open portal

Data Lookup

Retrieves a value from a provided dictionary or map based on a specific key.

View as Markdown
Open in
Data Available data.lookup Version 1.0.0 Execution: sync

Looks up a key or dotted path in a dictionary with lodash get and routes to found with the value added as lookup_result, or to miss with the payload unchanged.

This operator is used for simple reference data enrichment. It takes a static or dynamic source map and attempts to find a match for the input key.

Use Cases:

  • Enrichment: looking up a "Country Name" from a "Country Code" (e.g., "US" -> "United States").
  • Mapping: Translating status codes (e.g., 200 -> "OK").
  • Authorization: Checking if a User ID exists in an "Admin List".

How it works

  1. Resolves the config: {{ }} in source and key_template are evaluated by the Expression Engine.
  2. Fails when key_template is missing or resolves to an empty value.
  3. Converts the key to a string and reads it with _.get(source, key): dotted paths and indexes such as regions.north[0] work. JSONata is not used.
  4. Any value other than undefined (including null) counts as found: returns the payload plus lookup_result through found.
  5. Otherwise returns the payload unchanged through miss. Both set meta { found, key }.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-country-name",
  "label": "Country name",
  "operator_slug": "data.lookup",
  "operator_version": "1.0.0",
  "config": {
    "source": {
      "US": "United States",
      "CO": "Colombia",
      "MX": "Mexico"
    },
    "key_template": "{{ $json.country_code }}"
  }
}

Configuration

source object Required

Key-Value pairs to search within (e.g., {"US": "United States"}).

key_template string Required Accepts expressions

Key or dotted path looked up in the dictionary (lodash get). Use {{ }} to derive it from the payload, e.g. {{ $json.country_code }}. JSONata is not supported.

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

key_template
Text without {{ }} is taken as a literal key. To read the key from the payload write {{ $json.country_code }}.
source
Defaults to {} when missing, so every lookup misses. It can be a {{ }} that returns an object from an earlier node.

Output ports

found default

The key exists in source.

Data
{
  "country_code": "US",
  "lookup_result": "United States"
}
miss

The key does not exist in source.

Data
{
  "country_code": "BR"
}
error

key_template is empty.

Data
{
  "ok": false,
  "errors": [
    "Key template is required"
  ],
  "port": "error"
}

In expressions

What a later node can read from this node's output with $("Data Lookup").item.json.<path> (write your node's label instead of Data Lookup). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through found, from the output shown in Ports.

ExpressionEditorWorker
$("Data Lookup").item.json.valueanyThe worker does not return it: reads as undefinedThe retrieved value from the dictionary. —
$("Data Lookup").item.json.foundbooleanThe worker does not return it: reads as undefined —
$("Data Lookup").item.json.country_codestringNot suggested by the editor= "US"—
$("Data Lookup").item.json.lookup_resultstringNot suggested by the editor= "United States"—

— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Key template is required error key_template is missing, or its {{ }} resolved to undefined, null, "", 0 or false.

Input contract

payload object Optional

Context for key resolution.

Output contract

value any Optional

The retrieved value from the dictionary.

found boolean Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "data.lookup",
  "name": "Data Lookup",
  "category": "data",
  "version": "1.0.0",
  "description": "Retrieves a value from a provided dictionary or map based on a specific key.\n\n  This operator is used for simple reference data enrichment. It takes a static or dynamic source map and attempts to find a match for the input key.\n\n  **Use Cases:**\n  - **Enrichment:** looking up a \"Country Name\" from a \"Country Code\" (e.g., \"US\" -> \"United States\").\n  - **Mapping:** Translating status codes (e.g., 200 -> \"OK\").\n  - **Authorization:** Checking if a User ID exists in an \"Admin List\".",
  "capabilities": [
    "enrichment",
    "map",
    "dictionary"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "source",
      "key_template"
    ],
    "properties": {
      "source": {
        "type": "object",
        "title": "Dictionary / Map",
        "description": "Key-Value pairs to search within (e.g., {\"US\": \"United States\"})."
      },
      "key_template": {
        "type": "string",
        "title": "Key Expression",
        "format": "expression",
        "description": "Key or dotted path looked up in the dictionary (lodash get). Use {{ }} to derive it from the payload, e.g. {{ $json.country_code }}. JSONata is not supported."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "payload": {
        "type": "object",
        "description": "Context for key resolution."
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "description": "The found value or original payload.",
    "properties": {
      "value": {
        "type": "any",
        "description": "The retrieved value from the dictionary."
      },
      "found": {
        "type": "boolean"
      }
    }
  },
  "ports": [
    {
      "port_id": "found",
      "label": "Found",
      "is_default": true,
      "description": "Key exists in dictionary."
    },
    {
      "port_id": "miss",
      "label": "Missing",
      "description": "Key not found."
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "map",
    "dictionary",
    "lookup"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

Execution

Execution
sync
Stateful
No
Retries (retryOnFail)
No
Capabilities
enrichmentmapdictionary
Tags
mapdictionarylookup

Notes and limits

  • The output key is lookup_result; the value and found fields of the output contract are not produced (found exists only in meta).
  • meta is recorded in the run steps only: downstream nodes receive data as their payload and cannot read meta through $json or $("Node").
  • When the envelope has no data (or data is falsy), the engine stores the whole envelope as the node output: on error the next node receives { ok: false, errors: [...], port: "error" } as its payload.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

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