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

> ## Agent Instructions
> These are the public docs of Meridian for Shopify apps: hosting, billing (Plan Builder and the @the-meridian/sdk package), CRM, emails and automations for Shopify app developers.
> Start with these pages: Meridian MCP (https://help.the-meridian.ai/mcp-server.md) to connect a coding agent, AI coding agents (https://help.the-meridian.ai/ai-agents.md) for the agent skill, SDK quickstart (https://help.the-meridian.ai/sdk-quickstart.md), Running your app with the CLI (https://help.the-meridian.ai/cli-dev.md), Deployment (https://help.the-meridian.ai/deployment.md), and Errors (https://help.the-meridian.ai/errors.md) to look up an error code or message.
> Fetch one page at a time as Markdown (the page URL followed by .md), using the index in https://help.the-meridian.ai/llms.txt. llms-full.txt holds every page in one file of about 900 KB, so avoid loading it whole.
> With Meridian MCP connected, search these docs with docs_search and docs_get, and read live facts (feature and event keys, plan ids, environments, deployments, logs) from the MCP tools instead of guessing them.

# Environment variables

> List, set and unset a hosted environment's variables and secrets with meridian env, on development, staging and production, or for all environments at once.

`meridian env` lists, sets and unsets the linked app's [environment variables and secrets](https://help.the-meridian.ai/secrets.md) from a terminal, in one hosted environment or for all environments at once. It makes the same changes as the **Environment** page in the dashboard, with the same permissions, and each change lands in the [activity log](https://help.the-meridian.ai/activity-log.md) marked as made from the CLI.

```bash theme={null}
meridian env list --env production
printf '%s' "$API_URL" | meridian env set API_URL --env development --plain
meridian env set STRIPE_KEY --env staging
meridian env set STRIPE_KEY --env production
meridian env set LOG_LEVEL --all-environments --plain
meridian env unset API_URL --env development
```

`--env` names the environment by type: `development`, `staging` or `production`. `set` and `unset` take `--all-environments` instead to write the value set for **All environments**, and refuse the two together (`Pass --env or --all-environments, not both.`). One of them is required. In an interactive terminal the CLI asks for the environment, offering the three types but never all environments, and otherwise the command fails and names `--env`.

## What the CLI can change

| Command | Development and staging | Production | All environments (`--all-environments`) |
| - | - | - | - |
| `meridian env list` | Yes | Yes | Listed with each environment |
| `meridian env set` | Yes | Yes, after a confirmation, with production access | Yes, after a confirmation, with production access |
| `meridian env unset` | Yes, after a confirmation | Yes, after a confirmation, with production access | Yes, after a confirmation, with production access |

Production, and all environments (which reach production), need CLI 1.9.0 or later. An older CLI refuses production itself with `Production variables can't be changed from the CLI.` and does not know `--all-environments`: upgrade it with `npm install -g @the-meridian/cli@latest`.

## Production and all environments

A CLI token stays valid for 90 days on your machine, and a production variable such as `DATABASE_URL` or the Shopify secret amounts to production access. So a `set` or an `unset` on production, or with `--all-environments`, counts as a production change, like a [production deploy](https://help.the-meridian.ai/deployment.md#what-starts-one).

First, the CLI asks you to confirm, naming the key, the environment and the app, before it reads the value:

```text theme={null}
Set STRIPE_KEY in production of "My App"? (y/N)
Set LOG_LEVEL in all environments of "My App", production included? (y/N)
Delete STRIPE_KEY from production of "My App"? (y/N)
Delete LOG_LEVEL from all environments of "My App", production included? (y/N)
```

The default is No. Answering No reads no value and sends nothing, and the CLI prints `Aborted. Nothing was changed.` (`Aborted. Nothing was deleted.` for `unset`). Without a terminal, pass `--yes` or set `MERIDIAN_YES=1` instead. For `unset`, this question replaces the usual one.

Then the API wants [production access](https://help.the-meridian.ai/cli-auth.md#production-access) on your token, approved in your browser with `meridian login --production`. `--yes` only answers the question above and never stands in for it. Without production access, in a terminal, the CLI asks `Production changes need production access, approved in your browser. Request it now?`, and once you approve it sends the same change again, without reading the value a second time. Outside a terminal it never asks: it prints the refusal and `Run: meridian login --production`, then exits non-zero.

A piped value counts as running without a terminal. To pipe a value into a production or all-environments write, get production access first with `meridian login --production`, then pass `--yes`:

```bash theme={null}
meridian login --production
openssl rand -hex 32 | meridian env set SESSION_SECRET --env production --secret --yes
```

Production access adds no permission: the [permissions](#permissions-and-the-activity-log) below still apply. On development and staging, `set` asks no question, and neither command needs production access.

## Listing

```bash theme={null}
meridian env list --env development
```

Lists what the environment gets at deploy: its own variables and secrets, and the ones set for all environments.

| Column | Shows |
| - | - |
| `KEY` | The variable's name |
| `TYPE` | `secret` or `plain` |
| `SCOPE` | The environment, or `all environments` |
| `NOTE` | `overridden here` on an all-environments entry the environment sets too. The environment's value wins at deploy |
| `UPDATED` | When the value last changed |

The list never shows a value, not even a plain variable's, which the dashboard can show you. `--json` prints every entry with its metadata. The variables Meridian injects itself at deploy are not listed. See [Managed variables](https://help.the-meridian.ai/secrets.md#managed-variables).

## Setting

```bash theme={null}
meridian env set STRIPE_KEY --env staging
```

Creates the key in the environment, or replaces its value when it already exists there. With `--all-environments` instead of `--env`, it does the same for the value every environment gets unless it sets its own. The output says which, for example `Created STRIPE_KEY in production (secret).` or `Updated LOG_LEVEL for all environments (plain variable).` Keys follow the dashboard's rules: letters, digits and underscores, uppercased for you, and the `HOSTING_` prefix and the names Meridian always sets (`MERIDIAN_APP_ID`, `MERIDIAN_API_URL`, `MERIDIAN_OAUTH_CLIENT_ID`, `MERIDIAN_OAUTH_CLIENT_SECRET`) are refused.

The value never goes on the command line, where it would stay in your shell history, show in `ps` and land in an AI agent's transcript. The CLI reads it from the first of:

1. `--from-file <path>`: the file's contents.
2. Standard input, when it is piped: `printf '%s' "$VALUE" | meridian env set KEY --env development`.
3. A masked prompt, when you run the command in an interactive terminal. You type the value once and every character shows as `*`.

When none applies (no file, nothing piped, no interactive terminal), the command fails and names the three ways. An empty value, or one longer than 8192 characters, is refused before anything is sent. The value is trimmed like a dashboard save, and it is never printed, not with `--json`, not with `--verbose` and not in an error. A `KEY=VALUE` argument, or a value passed as a second argument, is refused without being repeated.

| Flag | Effect |
| - | - |
| `--secret` | Store the value in the secret store, write-only. The default for a new key |
| `--plain` | Store a plain variable, which the dashboard can show |
| `--from-file <path>` | Read the value from this file |
| `--all-environments` | Write the value every environment gets unless it sets its own, instead of one environment (`--env`). Counts as production |

An existing key keeps its type when you pass neither flag. Asking for the other type is refused: unset the key, then set it again with the flag you want.

When the key is also set for all environments, `set` creates the environment's own entry, which overrides the shared one in that environment, and says so: `STRIPE_KEY is also set for all environments: this value overrides it in staging.` A value set with `--all-environments` does not reach an environment that sets its own, and the CLI prints one line for each, such as `production keeps its own value.` When the key overrides a variable Meridian manages, such as `SHOPIFY_API_KEY`, the output says that too.

A generated secret can go straight in without ever being printed:

```bash theme={null}
openssl rand -hex 32 | meridian env set SESSION_SECRET --env development --secret
```

## Unsetting

```bash theme={null}
meridian env unset API_URL --env development
```

Deletes the environment's own entry of the key, after you confirm (`Delete API_URL from development?`). `--yes` skips the question, and is required when the CLI cannot ask. On production, the [production question](#production-and-all-environments) replaces it. With `--all-environments`, `unset` deletes the value set for all environments, after the same production question, and prints a line for each environment that keeps its own value. A key that is not set there changes nothing (`API_URL is not set in development. Nothing was deleted.`).

A key set for all environments, with no entry of the environment's own, is refused with HTTP 409, and nothing is deleted:

```text theme={null}
STRIPE_KEY is set for all environments, not in staging only. Nothing was deleted. To delete it from every environment, run meridian env unset STRIPE_KEY --all-environments. To give staging its own value, run meridian env set STRIPE_KEY --env staging.
```

The hint under it is the command that deletes it everywhere, `meridian env unset STRIPE_KEY --all-environments`.

When the key overrides a variable Meridian manages and its value is different from Meridian's, or cannot be compared, deleting it changes the value the app runs with. The CLI shows why and asks again before it deletes (`Delete SHOPIFY_API_KEY from production anyway?`), and `--yes` answers that question too. See [Managed variables](https://help.the-meridian.ai/secrets.md#managed-variables).

## Permissions and the activity log

| Command | Permission on the app |
| - | - |
| `meridian env list` | **Hosting: View** |
| `meridian env set` | **Hosting: Edit** |
| `meridian env unset` | **Hosting: Delete** |

The app's Meridian plan must include the Deploy feature, and an organization in [demo mode](https://help.the-meridian.ai/demo-mode.md) refuses every change. `set` and `unset` share a budget of 20 calls a minute per user. Each change records **Secret created**, **Secret updated** or **Secret deleted** with the key in the activity log, marked as made from the CLI. The value is never recorded.

## When changes take effect

Like any change on the Environment page, a change reaches the app at the next deploy of that environment, for example `meridian deploy --env development`. A change for all environments reaches each environment at its next deploy. The running revision keeps the values it was deployed with. See [When changes take effect](https://help.the-meridian.ai/secrets.md#when-changes-take-effect).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.