On this page
Sommatic Docs
Open portal

Generate UUID

Generates a cryptographically strong unique identifier (UUID/NanoID).

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

Generates a random v4 UUID, a deterministic v5 UUID or a 20-character random hex id, returned as { uuid, result }.

This operator produces unique strings suitable for database keys, transaction IDs, or idempotency tokens.

Formats:

  • v4: Random UUID (Standard).
  • v5: Name-based UUID (Deterministic based on namespace + name).
  • NanoID: Compact, URL-friendly unique string.

Use Cases:

  • Assigning an ID to a newly created resource.
  • Generating a correlation ID for tracking request chains.

How it works

  1. Resolves the config; version defaults to v4.
  2. v4: random UUID.
  3. v5: requires namespace_id (a UUID) and name; the same pair always gives the same UUID.
  4. nanoid: 10 random bytes as hex (20 characters); it is not a real nanoid.
  5. Returns { uuid, result } (same value twice) through out; the incoming payload is not passed through.

In a workflow

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

{
  "node_id": "node-order-key",
  "label": "Order key",
  "operator_slug": "data.uuid",
  "operator_version": "1.0.0",
  "config": {
    "version": "v5",
    "namespace_id": "6ba7b811-9dad-11d1-80b4-00c04fd430c8",
    "name": "{{ $json.order_id }}"
  }
}

Configuration

version string Optional

Type of ID to generate.

Default: v4

Allowed values: v4v5nanoid

namespace_id string Optional

Namespace UUID for deterministic v5 generation.

name string Optional

Input name used for deterministic v5 generation.

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

Output ports

out default

The id was generated.

Data
{
  "uuid": "3b1f8e2a-6c4d-4f7e-9a2b-8d5c1e0f7a34",
  "result": "3b1f8e2a-6c4d-4f7e-9a2b-8d5c1e0f7a34"
}
error

v5 inputs are missing or invalid, or version is unknown.

Data
{
  "ok": false,
  "errors": [
    "UUID Error: v5 requires namespace_id and name"
  ],
  "port": "error"
}

In expressions

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

ExpressionEditorWorker
$("Generate UUID").item.json.uuidstring= "3b1f8e2a-6c4d-4f7e-9a2b-8d5c1e0f7a34"The generated unique identifier.
$("Generate UUID").item.json.resultstringNot suggested by the editor= "3b1f8e2a-6c4d-4f7e-9a2b-8d5c1e0f7a34"—

— 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
UUID Error: v5 requires namespace_id and name error version is v5 and one of the two keys is empty.
UUID Error: Invalid UUID error namespace_id is not a valid UUID.
UUID Error: Unknown UUID version: <version> error version is not v4, v5 or nanoid.

Input contract

name string Optional

Input name for v5 generation (optional).

Output contract

uuid string Optional

The generated unique identifier.

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.uuid",
  "name": "Generate UUID",
  "category": "data",
  "version": "1.0.0",
  "description": "Generates a cryptographically strong unique identifier (UUID/NanoID).\n\n  This operator produces unique strings suitable for database keys, transaction IDs, or idempotency tokens.\n\n  **Formats:**\n  - **v4:** Random UUID (Standard).\n  - **v5:** Name-based UUID (Deterministic based on namespace + name).\n  - **NanoID:** Compact, URL-friendly unique string.\n\n  **Use Cases:**\n  - Assigning an ID to a newly created resource.\n  - Generating a correlation ID for tracking request chains.",
  "capabilities": [
    "utils",
    "id-generation",
    "security"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "version": {
        "type": "string",
        "enum": [
          "v4",
          "v5",
          "nanoid"
        ],
        "default": "v4",
        "title": "Format",
        "description": "Type of ID to generate."
      },
      "namespace_id": {
        "type": "string",
        "title": "Namespace UUID (v5 only)",
        "description": "Namespace UUID for deterministic v5 generation."
      },
      "name": {
        "type": "string",
        "title": "Name (v5 only)",
        "description": "Input name used for deterministic v5 generation."
      },
      "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": {
      "name": {
        "type": "string",
        "description": "Input name for v5 generation (optional)."
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "uuid": {
        "type": "string",
        "description": "The generated unique identifier."
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Generated",
      "is_default": true
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "id",
    "uuid",
    "key",
    "generator"
  ],
  "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
utilsid-generationsecurity
Tags
iduuidkeygenerator

Notes and limits

  • The payload is replaced by { uuid, result }: reference earlier data with $("Node"), or generate the id inline with {{ $uuid }} in another 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