On this page
Sommatic Docs
Open portal

Inspect Token

Verifies a JWT with a Sommatic AI credential (recommended) or a literal key.

View as Markdown
Open in
Identity Available token.inspect Version 2.0.0 Execution: sync

Verifies a JWT signature and its time claims with the key you provide, and returns the claims and header. Without a key it only decodes the token and sends it to invalid.

How it works

  1. Resolves the config; leaves through error with token is required when token is empty.
  2. Picks the key: connection_id first, otherwise the literal secret_key.
  3. With no key, decodes the token without checking it and returns its claims and header on invalid, never as valid.
  4. Otherwise verifies the signature allowing only algorithm (default HS256), and checks exp and nbf.
  5. Valid: returns { valid: true, verified: true, payload, header } on out. Not valid: returns { valid: false, verified: false, error } on invalid.

In a workflow

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

{
  "node_id": "node-verify-approval-token",
  "label": "Verify approval token",
  "operator_slug": "token.inspect",
  "operator_version": "2.0.0",
  "config": {
    "token": "{{ $json.token }}",
    "connection_id": "pi-credential-xxxx",
    "algorithm": "HS256"
  }
}

Configuration

token string Required
connection_id string Optional

Sommatic AI credential resolved server-side (recommended). Accepts credentials of type `jwt-signing`.

secret_key string Optional

Verification secret or public key as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id.

algorithm string Optional

Default: HS256

Allowed values: HS256HS384HS512RS256RS384RS512ES256ES384ES512

Behaviour in the code

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

connection_id
Takes precedence over secret_key. Resolved on the server when the node runs. A string secret is used as the key; an object secret is read as public_key, then secret, then key.
secret_key
A literal key works, but it is stored in the flow, its version history and Git, and meta.warnings reports it on every run. Prefer connection_id.
algorithm
Exactly one algorithm is accepted. A token signed with any other algorithm goes to invalid.

Output ports

out default

The signature and time claims are valid.

Data
{
  "valid": true,
  "verified": true,
  "payload": {
    "sub": "usr_123",
    "role": "approver",
    "iat": 1795724213,
    "exp": 1795725113
  },
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  }
}
invalid

Verification failed (bad signature, expired, malformed, other algorithm), or no key is configured. Without a key the data also carries the unverified payload and header, and there is no meta.

Data
{
  "valid": false,
  "verified": false,
  "error": "jwt expired"
}
error

token is empty or the credential cannot be resolved.

Data
{
  "error": "token is required"
}

In expressions

What a later node can read from this node's output with $("Inspect Token").item.json.<path> (write your node's label instead of Inspect Token). 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
$("Inspect Token").item.json.validboolean= true
$("Inspect Token").item.json.verifiedboolean= true
$("Inspect Token").item.json.payloadobject= {…}
$("Inspect Token").item.json.headerobject= {…}
$("Inspect Token").item.json.errorstringThe worker does not return it: reads as undefined —
$("Inspect Token").item.json.payload.substringNot suggested by the editor= "usr_123"—
$("Inspect Token").item.json.payload.rolestringNot suggested by the editor= "approver"—
$("Inspect Token").item.json.payload.iatnumberNot suggested by the editor= 1795724213—
$("Inspect Token").item.json.payload.expnumberNot suggested by the editor= 1795725113—
$("Inspect Token").item.json.header.algstringNot suggested by the editor= "HS256"—
$("Inspect Token").item.json.header.typstringNot suggested by the editor= "JWT"—

— 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
token is required error token is empty.
invalid signature invalid The token was signed with a different key.
jwt expired invalid The exp claim is in the past.
jwt malformed invalid The value is not a JWT (three base64url parts).
invalid algorithm invalid The token header uses an algorithm other than algorithm. Set algorithm to the one the issuer uses.
Signature not verified: no key configured invalid Neither connection_id nor secret_key is set, so the token was only decoded.
credential binding 'connection' has no key usable for verify invalid The credential resolved, but its secret is empty or is an object without a usable field. Store the key as a string, or as an object with the field this operation reads (see connection_id).
Failed to resolve connection <connection_id>: <detail> error The credential id does not exist or is not available to this workflow. Check the id and the credential type.

Input contract

token string Required
connection_id string Optional
secret_key string Optional
algorithm string Optional

Output contract

valid boolean Optional
verified boolean Optional
payload object Optional
header object Optional
error string 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": "token.inspect",
  "name": "Inspect Token",
  "category": "identity",
  "version": "2.0.0",
  "description": "Verifies a JWT with a Sommatic AI credential (recommended) or a literal key. Without a key the token is never reported as valid.",
  "capabilities": [
    "authn",
    "jwt",
    "crypto"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "token": {
        "type": "string"
      },
      "connection_id": {
        "type": "string",
        "title": "Verification credential",
        "description": "Sommatic AI credential resolved server-side (recommended). Accepts credentials of type `jwt-signing`.",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "jwt-signing"
          ]
        }
      },
      "secret_key": {
        "type": "string",
        "ui_widget": "password",
        "x-literal-secret": true,
        "description": "Verification secret or public key as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
      },
      "algorithm": {
        "type": "string",
        "default": "HS256",
        "enum": [
          "HS256",
          "HS384",
          "HS512",
          "RS256",
          "RS384",
          "RS512",
          "ES256",
          "ES384",
          "ES512"
        ]
      }
    },
    "required": [
      "token"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "token": {
        "type": "string"
      },
      "connection_id": {
        "type": "string"
      },
      "secret_key": {
        "type": "string"
      },
      "algorithm": {
        "type": "string"
      }
    },
    "required": [
      "token"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "valid": {
        "type": "boolean"
      },
      "verified": {
        "type": "boolean"
      },
      "payload": {
        "type": "object"
      },
      "header": {
        "type": "object"
      },
      "error": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Token Data",
      "description": "Token is valid or decoded",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "invalid",
      "label": "Invalid",
      "description": "Verification failed",
      "is_default": false,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Processing error",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "sync",
  "required_resources": [],
  "compatible_worker_pools": [
    "standard"
  ],
  "tags": [
    "jwt",
    "auth"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_veripass",
    "profile": {
      "name": "Veripass",
      "verified": true,
      "url": "https://me.veripass.com/veripass",
      "logo_url": null
    }
  }
}

Execution

Execution
sync
Stateful
No
Capabilities
authnjwtcrypto
Tags
jwtauth

Notes and limits

  • The definition describes out as "valid or decoded", but decoded-only tokens (no key) always go to invalid.
  • Audience (aud) and issuer (iss) are not checked: compare them yourself with a flow.if on payload after out.
  • Leaving through error does not fail the run: the engine follows the edges wired to error, and if there are none the branch simply ends.

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