Docs / Strand / templating/overview

Templating & Data Passing Overview

Strand supports two powerful templating systems for accessing and transforming data in workflows.

Overview

Why Two Templating Systems?

Jinja2 excels at string building and logic, while JSONPath is perfect for querying complex data structures. Use them together for maximum flexibility!

Jinja2

A full-featured templating engine perfect for:

JSONPath

A query language ideal for:

Using Both Together

You can use Jinja2 and JSONPath together in the same template:

jinja

{{ payload | jsonpath('$.users[?(@.active == true)]') | length }} active users
Example: Combined Power
jinja

{% set active_users = payload | jsonpath('$.users[?(@.active == true)]') %}
{% if active_users | length > 10 %}
  {{ 'Many active users: ' + (active_users | length | string) }}
{% else %}
  {{ 'Few active users: ' + (active_users | length | string) }}
{% endif %}

Accessing Data

Current Event

Variable Description
payload Current event payload - automatically contains the previous node's output when directly connected
meta Current event metadata
event Full current event object
Automatic Data Passing

When nodes are directly connected, the previous node's output is automatically available as payload. No need to use steps.{node_id}.output_payload for direct connections!

Previous Steps

Variable Description
steps.{node_id}.output_payload Output payload from a specific step
steps.{node_id}.output_meta Metadata from a step
steps.{node_id}.output Full output array (all events)
steps.{node_id}.output_count Number of output events
Node ID

Replace {node_id} with the actual node ID from your workflow. You can find the node ID in the Node Inspector when you select a node.

Initial Event

Variable Description
initial Original workflow input (before any processing)

Workflow Variables

Variable Description
variables.{key} Workflow-specific values stored in Workflow Variables (plain text)

Global Vault

Variable Description Available In
vault.{key} Encrypted sensitive values stored in the Global Vault (shared across all workflows) All node types
Vault Access

Vault secrets are accessible across all workflow node types: Jinja templates use {{ vault.key }}, Python snippets and functions use vault['key'] or vault.get('key').

Vault values are never stored or displayed as plain text. In all run logs, step outputs, and print output, they are automatically replaced with their {{ vault.key_name }} placeholder.

Use identifier-safe keys (letters, digits, underscores) so {{ vault.key }} dot access works. For keys with hyphens, spaces, or a leading digit, use bracket access: {{ vault['api-token'] }}.

Example:

jinja

# Any Jinja template context (HTTP headers, transforms, conditions, etc.)
"Authorization": "Bearer {{ vault.api_token }}"
When to Use Variables vs Vault
  • Workflow Variables: Non-sensitive configuration (API URLs, timeouts, environment settings), accessed via {{ variables.key }}
  • Global Vault: Sensitive secrets (API tokens, passwords, credentials), accessed via {{ vault.key }}

See the Global Vault guide for details.

Quick Examples

Simple Field Access

jinja

{{ payload.user_id }}

Previous Step Output

For directly connected nodes, use payload:

jinja

{{ payload.email }}

For non-direct access, use step references:

jinja

{{ steps.user_lookup.output_payload.email }}

JSONPath Extraction

jinja

{{ payload | jsonpath('$.items[*].id') }}

Conditional Logic

jinja

{{ 'admin' if payload.role == 'admin' else 'user' }}
Pro Tip

Always use descriptive node IDs (like user_lookup instead of node1) to make your templates more readable!

Learn More