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

# environment-variable add

> Add one or more environment variables to an Alpic environment

Adds environment variables to an Alpic environment. Runs interactively by default. Variables are marked as secret by default, meaning their values are masked when listed.

## Usage

```bash theme={null}
alpic environment-variable add
```

Prompts for a key, value, and secret preference interactively.

## Extended Usage

**Add a single variable non-interactively:**

```bash theme={null}
alpic environment-variable add --key DATABASE_URL --value postgres://localhost/db
```

**Add a non-secret (visible) variable:**

```bash theme={null}
alpic environment-variable add --key PORT --value 3000 --no-secret
```

**Import all variables from a `.env` file:**

```bash theme={null}
alpic environment-variable add --env-file .env
```

**Import from a `.env` file into a specific environment:**

```bash theme={null}
alpic environment-variable add --env-file .env --environment-id <environmentId>
```

## Options

| Flag                | Description                                                                   |
| ------------------- | ----------------------------------------------------------------------------- |
| `--environment-id`  | The ID of the environment (optional — read from local config if omitted)      |
| `--key`             | The environment variable key                                                  |
| `--value`           | The environment variable value                                                |
| `--secret`          | Mark as secret (default: true). Use `--no-secret` to store in plain text      |
| `--env-file`        | Path to a `.env` file to import (mutually exclusive with `--key`/`--value`)   |
| `--non-interactive` | Disable interactive prompts. Requires `--key` and `--value` (or `--env-file`) |

<Tip>
  When running from a directory linked to an Alpic project (via `alpic deploy`), `--environment-id` is optional — the
  CLI reads it from the local `.alpic` config file.
</Tip>
