# Environments API

> The environments endpoints, each in TypeScript, Python, the CLI and curl.

The environments endpoints, each in TypeScript, Python, the CLI and curl.

## Set up

* TypeScript

  ```bash
  npm install @reminix/sdk
  export REMINIX_API_KEY="<your API key>"
  ```

* Python

  ```bash
  pip install reminix
  export REMINIX_API_KEY="<your API key>"
  ```

* CLI

  ```bash
  npm install -g @reminix/cli
  reminix login
  ```

* curl

  ```bash
  export REMINIX_API_KEY="<your API key>"
  ```

To pass the key yourself, use `createClient({ apiKey: key })` in TypeScript or `Reminix(api_key=key)` in Python.

## List environments

`GET /v1/environments`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/environments/GET/environments)

Scope: `environments:read`.

Lists the workspace’s environments, oldest first, and shows which one is the default.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const environments = await reminix.environments.list();
  console.log(environments);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  environments = reminix.environments.list()
  print(environments)
  ```

* CLI

  ```bash
  reminix environments list
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/environments" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "env_6a88d290-171d-4fba-8710-21b0f94a5f0a",
      "name": "staging",
      "approvalPolicy": "agents",
      "agentsAllowed": true,
      "isDefault": false,
      "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
      "createdAt": "2026-08-20T09:00:00.000Z",
      "updatedAt": "2026-08-20T09:00:00.000Z"
    }
  ],
  "nextCursor": null
}
```

| Field                  | Description                                     |
| ---------------------- | ----------------------------------------------- |
| `limit` number, query  | Items per page, 1–100 (default 25).             |
| `cursor` string, query | Opaque token from a previous page's nextCursor. |

More about this endpoint

To act in an environment, name it in the X-Environment header.

## Add an environment

`POST /v1/environments`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/environments/POST/environments)

Scope: `environments:write`.

Adds an environment with no secret values yet.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const environment = await reminix.environments.create({
    name: "staging",
    approvalPolicy: "agents",
  });
  console.log(environment);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  environment = reminix.environments.create(name="staging", approval_policy="agents")
  print(environment)
  ```

* CLI

  ```bash
  reminix environments create --name staging --approval-policy agents
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/environments" \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"name":"staging","approvalPolicy":"agents"}'
  ```

**Returns:**

```json
{
  "id": "env_6a88d290-171d-4fba-8710-21b0f94a5f0a",
  "name": "staging",
  "approvalPolicy": "agents",
  "agentsAllowed": true,
  "isDefault": false,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "createdAt": "2026-08-20T09:00:00.000Z",
  "updatedAt": "2026-08-20T09:00:00.000Z"
}
```

| Field                   | Description                                                                                                                                                                                                |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` string, required | The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.                                                                             |
| `approvalPolicy` string | Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. The default is `none`. |
| `agentsAllowed` boolean | Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here. The default is true.                            |

More about this endpoint

To save its values, call secretValues.set with the new environment in the path. Workspace owners, admins and API keys can add an environment.

## Get an environment

`GET /v1/environments/{environment}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/environments/GET/environments/{environment})

Scope: `environments:read`.

Returns one environment and what uses it: its secret values, and the schedules and triggers that run in it.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const environment = await reminix.environments.get("staging");
  console.log(environment);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  environment = reminix.environments.get("staging")
  print(environment)
  ```

* CLI

  ```bash
  reminix environments get staging
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/environments/staging" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "id": "env_6a88d290-171d-4fba-8710-21b0f94a5f0a",
  "name": "staging",
  "approvalPolicy": "agents",
  "agentsAllowed": true,
  "isDefault": false,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "createdAt": "2026-08-20T09:00:00.000Z",
  "updatedAt": "2026-08-20T09:00:00.000Z",
  "usedBy": {
    "secretValues": 1,
    "schedules": 0,
    "triggers": 0
  }
}
```

| Field                                | Description           |
| ------------------------------------ | --------------------- |
| `environment` string, path, required | The environment's ID. |

More about this endpoint

Deleting the environment deletes its secret values. You can’t delete it while a schedule or trigger runs in it.

## Change an environment

`PATCH /v1/environments/{environment}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/environments/PATCH/environments/{environment})

Scope: `environments:write`.

Renames an environment, changes its rules, or makes it the workspace’s default with `isDefault: true`.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const environment = await reminix.environments.update("staging", {
    approvalPolicy: "agents",
  });
  console.log(environment);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  environment = reminix.environments.update("staging", approval_policy="agents")
  print(environment)
  ```

* CLI

  ```bash
  reminix environments update staging --approval-policy agents
  ```

* curl

  ```bash
  curl -X PATCH "https://api.reminix.com/v1/environments/staging" \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"approvalPolicy":"agents"}'
  ```

**Returns:**

```json
{
  "id": "env_6a88d290-171d-4fba-8710-21b0f94a5f0a",
  "name": "staging",
  "approvalPolicy": "agents",
  "agentsAllowed": true,
  "isDefault": false,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "createdAt": "2026-08-20T09:00:00.000Z",
  "updatedAt": "2026-08-20T09:00:00.000Z"
}
```

| Field                                | Description                                                                                                                                                                         |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `environment` string, path, required | The environment's ID.                                                                                                                                                               |
| `name` string                        | The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.                                                      |
| `approvalPolicy` string              | Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. |
| `agentsAllowed` boolean              | Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here.                          |
| `isDefault` boolean                  | Makes this the default environment. To change the default, make another environment the default.                                                                                    |

More about this endpoint

Runs keep the environment name they ran under. Workspace owners, admins and API keys can change an environment.

## Delete an environment

`DELETE /v1/environments/{environment}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/environments/DELETE/environments/{environment})

Scope: `environments:write`.

Deletes an environment and every secret value it holds.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  await reminix.environments.delete("staging");
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  reminix.environments.delete("staging")
  ```

* CLI

  ```bash
  reminix environments delete staging --yes
  ```

* curl

  ```bash
  curl -X DELETE "https://api.reminix.com/v1/environments/staging" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns** nothing (`204`).

| Field                                | Description           |
| ------------------------------------ | --------------------- |
| `environment` string, path, required | The environment's ID. |

More about this endpoint

Get the environment first to see how many values that is. You can’t delete the only environment, the default environment, or one that a schedule or trigger runs in. Workspace owners, admins and API keys can delete an environment.
