> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.nora.my/llms.txt
> Use this file to discover all available pages before exploring further.

# nora vars

> Flow-level variables — declare, update, and remove `{{name}}` placeholders.

Flow variables are named inputs the Flow declares. Blocks interpolate them via `{{name}}`. Runtime callers set values (via the API payload, the chat UI, or a schedule). Variables give one place to declare inputs and one place to interpolate them.

## Commands

| Command                   | Description                                              |
| ------------------------- | -------------------------------------------------------- |
| `vars list`               | List declared variables for the active Flow.             |
| `vars set <name> [flags]` | Add or update a variable (shallow-merges into existing). |
| `vars delete <name>`      | Remove a variable.                                       |

Variable name is a positional argument, e.g. `topic`, `customer_email`.

## `vars list`

```bash theme={null}
nora vars list
```

Prints all declared variables, one per row: name, type, source, required, default.

Add `--json` for structured output.

## `vars set`

```bash theme={null}
nora vars set customer_email --source form --type string --required
```

### Flags

| Flag                     | Values                                           | Purpose                                                 |
| ------------------------ | ------------------------------------------------ | ------------------------------------------------------- |
| `--source`               | `form`, `body_path`, `fixed`                     | Where the value comes from at runtime.                  |
| `--type`                 | `string`, `number`, `boolean`, `object`, `array` | Type coercion + validation.                             |
| `--label <text>`         |                                                  | Human-facing label (chat forms).                        |
| `--description <text>`   |                                                  | One-line hint.                                          |
| `--path <a.b.c>`         |                                                  | For `body_path` source: JSONPath into the trigger body. |
| `--fixed-value <v>`      |                                                  | For `fixed` source: hard-coded value.                   |
| `--default-value <json>` |                                                  | Default when missing. JSON literal.                     |
| `--required`             |                                                  | Fail the run if unset.                                  |

Only the flags you pass update the existing variable — a set is a shallow merge, not a replace. To reset a field, delete and re-create the variable.

### Sources explained

* **`form`** — surfaced in the chat trigger's form UI. User fills it in.
* **`body_path`** — extracted from the request body at a JSON path (webhook and API triggers). Use `--path` to specify.
* **`fixed`** — hard-coded. Same value every run. Useful for constants and feature flags.

## `vars delete`

```bash theme={null}
nora vars delete customer_email
```

Removes the declaration. Blocks that reference `{{customer_email}}` will fail at run time — audit those first.

## Common recipes

### Declare a required user input

```bash theme={null}
nora vars set topic \
  --source form \
  --type string \
  --label "What topic?" \
  --description "One-word topic (e.g. 'billing')" \
  --required
```

Shows in the chat trigger form as a required field.

### Extract from a webhook body

If your webhook posts `{ "customer": { "email": "..." } }`:

```bash theme={null}
nora vars set customer_email \
  --source body_path \
  --path customer.email \
  --type string \
  --required
```

Blocks then interpolate `{{customer_email}}` and see the extracted value.

### A feature-flag switch

```bash theme={null}
nora vars set enable_experimental_prompt \
  --source fixed \
  --type boolean \
  --fixed-value false \
  --description "Toggle to enable variant B of the assistant prompt"
```

Flip it via another `vars set --fixed-value true` when you're ready. No block edits, no republish (settings-scope changes are live immediately).

### Bulk snapshot & restore

Because `vars list --json` is structured, you can persist vars in git and re-apply on another workspace:

```bash theme={null}
# Export
nora vars list --json > vars.json

# Re-apply on another workspace (loops through each)
jq -c '.[]' vars.json | while read v; do
  name=$(echo "$v" | jq -r '.name')
  # translate structured fields back to --set-* flags
  # (usually easier to script via the API for bulk)
done
```

For non-trivial bulk migration, `flows snapshot`/`apply` carries variables along.

## Where variables show up

* **Block content** — anywhere a text field accepts `{{name}}` interpolation.
* **Trigger inputs** — webhook `input_path` maps into a variable; API triggers accept them.
* **Chat form UI** — `--source form` variables render as fields at run start.
* **Schedule triggers** — `--source fixed` values are baked into every scheduled run.

## Variable and version scope

Variables belong to the Flow (draft + published together). Renaming a variable is a Draft edit — publish to make it live. `--fixed-value` changes take effect immediately without republishing.
