# update

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

## Usage

```bash
bdy variable update|edit [options] <key> [value]
```

Update a variable Required scopes: VARIABLE_WRITE

## Arguments

| **Argument** | **Description** |
| :--- | :--- |
| `key` | Variable key (name) (required) |
| `value` | Variable value. For a secret prefer --file - (stdin), which keeps it out of the shell history (required) |

## Options

| **Option** | **Description** |
| :--- | :--- |
| `--context <name>` | Connection and scope context: default, git, link or a saved name. Overrides the globally active context for this invocation. |
| `--examples` | Show only examples; with this flag --format accepts text, json or jsonl |
| `--verbose` | Show REST API requests, responses, timing and retries on stderr |
| `-w, --workspace <domain>` | Workspace URL handle. Can be set via variable: BUDDY_WORKSPACE |
| `-p, --project <name>` | Project name. Can be set via variable: BUDDY_PROJECT |
| `--pipeline <identifier>` | Pipeline identifier to scope the variable to. Requires --project |
| `--environment <identifier>` | Environment identifier to scope the variable to. Resolves a workspace environment; add --project to point at a project environment |
| `--sandbox <identifier>` | Sandbox identifier to scope the variable to. Resolves a workspace sandbox; add --project to point at a project sandbox |
| `--scope <scope>` | Force scope (WORKSPACE, PROJECT, ENVIRONMENT, PIPELINE, SANDBOX). By default calculated by provided options and environmental variables (--pipeline, --environment, --sandbox, --project, BUDDY_PROJECT, linked project) |
| `--file <path>` | Read the value from a file; - reads it from stdin |
| `--key <key>` | New key of the variable |
| `--encrypted` | Encrypt the value. An encrypted value is never shown again: the API returns it masked and pipeline logs hide it |
| `--no-encrypted` | Store the value as plain text again. Requires a new value - the encrypted one cannot be kept |
| `--settable` | Allow pipeline actions to change the value |
| `--no-settable` | Do not allow pipeline actions to change the value |
| `--enable` | Enable the variable |
| `--disable` | Disable the variable. A disabled variable is not injected anywhere |
| `--note <note>` | Resource note |
| `--agent-note <note>` | Note for AI agents operating on this resource; stored as agent_note and meant to be read before acting on the resource |
| `--format <text\|json>` | Output format: json, text. JSON CLI errors: {error:{code,message,hint}}, exit 1. Default: text (choices: "text", "json") |
| `-h, --help` | display help for command |

Documentation for bdy v1.25.34

## Examples

### Change the value

```bash
bdy var update API_URL https://api2.example.com
```

### Encrypt the stored value

```bash
bdy var update API_TOKEN --encrypted -p project
```

### Rename and disable a variable

```bash
bdy var update OLD_NAME --key NEW_NAME --disable
```

### Return the result as JSON

```bash
bdy variable update API_URL https://api2.example.com --format json
```


---
Original source: https://buddy.works/docs/cli/variable/update