On this page
Sommatic Docs
Open portal

Issue Token

Issues a JWT signed with a Sommatic AI credential (recommended) or a literal secret.

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

Signs a JWT with the claims you provide and an expiry of ttl_sec seconds. Supports HS256/384/512, RS256/384/512 and ES256/384/512; the key comes from a jwt-signing credential or a literal secret_key.

How it works

  1. Resolves the config. Claims come from payload; when the node has no payload configured, the node input item is used as the claims.
  2. Leaves through error with payload is required when the claims are missing or not an object.
  3. Uses ttl_sec when it is a positive number, otherwise 3600 seconds.
  4. Picks the key: connection_id first, otherwise the literal secret_key.
  5. Signs with algorithm (default HS256); the token gets iat and exp claims.
  6. Returns { token, expires_at } on out, with meta.crypto and meta.warnings.

In a workflow

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

{
  "node_id": "node-issue-approval-token",
  "label": "Issue approval token",
  "operator_slug": "token.issue",
  "operator_version": "2.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "payload": {
      "sub": "{{ $json.user_id }}",
      "role": "approver"
    },
    "ttl_sec": 900,
    "algorithm": "HS256"
  }
}

Configuration

connection_id string Optional

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

secret_key string Optional

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

payload object Required

Token claims

ttl_sec integer Optional

Default: 3600

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 private_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.
payload
Optional in practice: when it is not configured, the whole input item becomes the claims. Configure it explicitly to avoid signing fields you did not intend to.
ttl_sec
Zero, negative or non-numeric values fall back to 3600. Every token expires; there is no option for tokens without exp.

Output ports

out default

The token was signed.

Data
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMTIzIiwicm9sZSI6ImFwcHJvdmVyIiwiaWF0IjoxNzk1NzI0MjEzLCJleHAiOjE3OTU3MjUxMTN9.<signature>",
  "expires_at": "2026-11-26T15:19:05.000Z"
}
error

Claims are missing, the algorithm or key is not valid, or the credential cannot be resolved.

Data
{
  "error": "Unsupported JWT algorithm: PS256"
}

In expressions

What a later node can read from this node's output with $("Issue Token").item.json.<path> (write your node's label instead of Issue 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
$("Issue Token").item.json.tokenstring= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWI…"
$("Issue Token").item.json.expires_atstring= "2026-11-26T15:19:05.000Z"

Errors

Message Port Cause and fix
payload is required error payload resolved to something that is not an object (a string, for example from mixed text).
Unsupported JWT algorithm: <algorithm> error algorithm is not one of the nine listed values.
Bad "options.expiresIn" option the payload already has an "exp" property. error The claims already contain exp. Remove it: the expiry always comes from ttl_sec.
secretOrPrivateKey must be an asymmetric key when using <algorithm> error An RS* or ES* algorithm was chosen with a shared secret. Use a PEM private key of the matching type.
A key is required: pass { credential: "<alias>" } (recommended) or { key } error Neither connection_id nor the literal key field is set. Select a credential in connection_id.
credential binding 'connection' has no key usable for sign error 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

connection_id string Optional
secret_key string Optional
payload object Required
ttl_sec integer Optional
algorithm string Optional

Output contract

token string Optional
expires_at 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.issue",
  "name": "Issue Token",
  "category": "identity",
  "version": "2.0.0",
  "description": "Issues a JWT signed with a Sommatic AI credential (recommended) or a literal secret.",
  "capabilities": [
    "authn",
    "jwt",
    "crypto"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "Signing 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": "Signing secret or private key as a literal. Allowed, but it is stored in the flow, its version history and Git: prefer connection_id."
      },
      "payload": {
        "type": "object",
        "description": "Token claims"
      },
      "ttl_sec": {
        "type": "integer",
        "default": 3600
      },
      "algorithm": {
        "type": "string",
        "default": "HS256",
        "enum": [
          "HS256",
          "HS384",
          "HS512",
          "RS256",
          "RS384",
          "RS512",
          "ES256",
          "ES384",
          "ES512"
        ]
      }
    },
    "required": [
      "payload"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string"
      },
      "secret_key": {
        "type": "string"
      },
      "payload": {
        "type": "object"
      },
      "ttl_sec": {
        "type": "integer"
      },
      "algorithm": {
        "type": "string"
      }
    },
    "required": [
      "payload"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "token": {
        "type": "string"
      },
      "expires_at": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Token",
      "description": "Issued Token",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Issuance failed",
      "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

  • expires_at is computed from the worker clock right after signing, so it can differ from the token exp by a few milliseconds.
  • Audience, issuer and subject cannot be set as options: put aud, iss or sub in the claims if you need them.
  • 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