# Environments

> Run the same script against production or staging, each with its own secret values and rules.

An environment is where a run happens: production for real work, staging to try things first. The nightly sync, for example, copies real orders in production and test orders in staging. Each environment has its own value for every secret and its own approval rules. The script is the same in each environment. Only the keys and the rules change.

Every workspace starts with one environment, **production**. While a workspace has only one, there’s nothing to choose. Runs happen in production, and the app, the API, the CLI and agents never ask which environment to use.

[![Settings, Environments: production, marked Default, and staging, each with no approval and agents allowed, with Edit and Delete buttons and Make default for staging.](/docs/_astro/environments.CwReuK46_1HepvQ.webp) ![Settings, Environments: production, marked Default, and staging, each with no approval and agents allowed, with Edit and Delete buttons and Make default for staging.](/docs/_astro/environments-dark.FhgrGHgi_ZLbzDA.webp) ![Settings, Environments: production, marked Default, and staging, each with no approval and agents allowed, with Edit and Delete buttons and Make default for staging.](/docs/_astro/environments-phone.JKLnYeRf_ZCiusT.webp) ![Settings, Environments: production, marked Default, and staging, each with no approval and agents allowed, with Edit and Delete buttons and Make default for staging.](/docs/_astro/environments-phone-dark.BpM-IgXJ_Z1vUOVg.webp)](/docs/_astro/environments.CwReuK46.png "Open the screenshot at full size")

## Adding one

Owners and admins add environments in **Settings → Scripts → Add environment**. A name can have up to 32 lowercase letters, digits and hyphens, and it starts with a letter, as in `staging` or `eu-test`.

How many environments a workspace can have depends on its plan. Free includes production only, Pro includes 3 and Business 10 (see [Plan limits](/docs/plans/)). At the limit, Reminix refuses a new environment with `402 plan_limit_reached`. If a workspace moves to a smaller plan, its environments keep working, but it can’t add more.

## Choosing one for a run

If a workspace has more than one environment, every way of running a script can choose one. If you don’t choose, the run uses the workspace’s **default**. The default is production until you pick another with **Make default**.

* **In the app:** the **Environment** field on the run form, and on schedules and triggers.
* **From your code:** `createClient({ environment: "staging" })` in TypeScript, `Reminix(environment="staging")` in Python, or the `X-Environment` header on any HTTP call.
* **From the CLI:** `--environment staging` on any command, or `reminix environment use staging` to make it the default for later commands. Every command prints the environment it used to standard error.
* **From an agent:** each script’s tool takes an optional `environment` argument. See [MCP server](/docs/mcp/).

- TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  const reminix = createClient({ environment: "staging" });

  const run = await reminix.run("nightly-sync", { date: "2026-10-04" });
  console.log(run);
  ```

- Python

  ```python
  from reminix import Reminix

  reminix = Reminix(environment="staging")

  run = reminix.run("nightly-sync", {"date": "2026-10-04"})
  print(run)
  ```

- CLI

  ```bash
  reminix run nightly-sync -f date=2026-10-04 \
    --environment staging
  ```

- curl

  ```bash
  curl -X POST https://api.reminix.com/v1/scripts/nightly-sync/runs \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "X-Environment: staging" \
    -H "Content-Type: application/json" \
    -d '{ "inputs": { "date": "2026-10-04" } }'
  ```

The run records its environment, and the Runs page shows it. A script’s code reads the name from the environment variable `REMINIX_ENVIRONMENT`, for example to pick the shop’s test or live base URL.

## Secrets in each environment

A secret has one value per environment, such as the shop’s test key in staging and its live key in production. A run uses only its own environment’s value, and Reminix never borrows another environment’s. If the value is missing, the run fails before it starts:

```text
SHOP_KEY has no value in staging. Add it in Settings → Scripts.
```

Each value lists its own hosts, so the staging value can go to a test host such as `api.staging.shop.example` that production never calls. See [Secrets](/docs/secrets/).

## Rules for each environment

On **Edit**, a workspace owner or admin sets two rules: which runs need approval, and whether AI agents may run scripts there.

The approval rule is one of these:

| Approval                 | Which runs wait for a person                                                                                                    |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| No approval              | None, beyond what the script’s own policy asks for.                                                                             |
| Agents need approval     | Runs that AI agents start, and runs a webhook trigger starts.                                                                   |
| Every run needs approval | Every run, except runs that workspace owners, admins and API keys start themselves. An agent’s run always waits. Business only. |

A run follows the stricter of its environment’s rule and its script’s own policy. That way, production can require approval for runs that staging lets through.

When AI agents aren’t allowed in an environment, an agent that tries to run a script there gets `403`. People can still run scripts there.

## Access for keys and agents

Under **Access → Can act in**, an owner or admin can give an API key or a connected agent access to only some environments. For example, a CI key might reach only staging. A key that names an environment it has no access to gets `403`. A key that can’t reach the default environment must send `X-Environment` on every call.

## Deleting one

**Delete** removes the environment and its secret values. The dialog says how many values it will remove. Reminix won’t delete:

* the workspace’s only environment
* the default environment
* an environment that a schedule or trigger uses

Make another environment the default, or move those schedules and triggers, first. Past runs keep the environment’s name.

## For developers

`reminix environments list` lists the workspace’s environments. `reminix environments get <environment>` reads one, including how many secret values, schedules and triggers use it. See [Environments](/docs/reference/environments/) in the API reference. To add, change or delete environments, use a workspace API key or a workspace owner’s or admin’s token with `environments:write`. Agents connected through MCP can only list and read environments.

The `run.succeeded`, `run.failed` and `run.cancelled` webhook events include the run’s `environment`. A trigger can use it to react only to failures in production, with `"filter": { "environment": "production" }`.
