﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>---
url: https://docs.puppetflow.com/guide/variables.md
---
# Variables

Variables store reusable values that are securely injected into your flows at runtime.

## Variable types

| Type | Description |
| --- | --- |
| **Text** | Plain text value, visible in the UI. |
| **Secret** | Encrypted at rest, masked in the UI, never logged in run output. |
| **Object** | Structured key-value data, accessible with dotted paths. |
| **Array** | Structured list data. |
| **One Time Password** | A TOTP secret that generates a fresh code on every `$vars()` call. |
| **MCP Credentials** | Credentials for an MCP client connection. |
| **Vault provider** | A field fetched from a connected vault such as 1Password. |

## Visibility

* **Owner** - Private to you.
* **Team** - Shared with members of the selected team.
* **Workspace** - Shared with every workspace member.

## Using variables

### In flow code

Call `$vars(variableId)` to resolve a variable at runtime:

```js
await $fillInput('#email', $vars('variable-id'));
await $fillInput('#password', $vars('variable-id'));
```

For OTP variables, `$vars('variable-id')` computes a fresh TOTP code every time it is called.

### In flow inputs

Use the `${vars.ID}` syntax in JSON input templates:

```json
{
  "username": "${vars.variable-id}",
  "api_key": "${vars.variable-id}"
}
```

Variables are resolved before the input is passed to the flow.

### Object paths

Object variables support dotted paths. Given a variable with this value:

```json
{
  "api": {
    "key": "abc123",
    "url": "https://api.example.com"
  }
}
```

You can access nested values:

```js
const key = $vars('variable-id.api.key'); // "abc123"
const url = $vars('variable-id.api.url'); // "https://api.example.com"
```

## Groups

Variables can be organized into named groups for easier management. Use the group filter in the variables table to narrow down the list.

## OTP variables

OTP variables store a TOTP secret (Base32-encoded or an `otpauth://` URI). Always resolve them while the flow is running with `$vars(variableId)`:

```js
const otp = $vars('variable-id');
await $fillInput('#otp', otp);
```

TOTP codes change after each rotation period. Calling `$vars()` at runtime generates the code that is valid at that moment.

The generated code uses:

* **Algorithm** - SHA1, SHA256, or SHA512
* **Digits** - Number of digits (default: 6)
* **Period** - Rotation interval in seconds (default: 30)

Do not copy or save a generated TOTP code in the flow: it will expire.

## Vault variables

Available on Pro and above, vault variables reference a specific field inside a 1Password item. They require a configured 1Password integration. At runtime, the value is fetched directly from the vault.

## Usage tracking

Before deleting a variable, you can inspect where it is used across:

* Flow code (direct `$vars()` calls)
* Flow input templates (`${vars.ID}` synta