> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/commands/environments.md).

# environments

Manage the environments on your account — named, isolated spaces (Production plus any non-production environments) that segregate connections, flows, and other resources by lifecycle stage.

**REST API**: [Environments](https://developer.celigo.com/api/api-reference/account-and-admin/environments)

```
celigo environments <subcommand> [flags]
```

Supports all [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

***

## Subcommands

| Subcommand | Purpose                                                                                                |
| ---------- | ------------------------------------------------------------------------------------------------------ |
| `list`     | List every environment configured on the account.                                                      |
| `get`      | Fetch a single environment by ID.                                                                      |
| `create`   | Create a new environment from a JSON body (`--file <path>` or stdin).                                  |
| `update`   | Replace an environment's mutable fields from a JSON body (`--file <path>` or stdin).                   |
| `set`      | Edit one or more fields on an environment without hand-writing the full document (GET → modify → PUT). |
| `audit`    | Show the audit log (change history) for one environment. Added in celigo-cli 2026.11.2.                |
| `enable`   | Enable an environment (no-op if already enabled).                                                      |
| `disable`  | Disable an environment (no-op if already disabled).                                                    |

`delete` is intentionally absent — see [Gotchas](#gotchas).

***

## `celigo environments list`

List all environments in the account.

**Signature**

```bash
celigo environments list
```

**Arguments**

None.

**Flags**

| Flag              | Type    | Default   | Description                                                                                                                                                                                                                                                                                                 |
| ----------------- | ------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--fields <spec>` | string  | `default` | Fields to return per row. `default` returns `_id`, `name`, and the table columns; `all` returns complete documents; a comma-separated list requests specific fields (dot notation allowed). Applied client-side — see [field projection](https://developer.celigo.com/cli/getting-started/global-flags.md). |
| `--limit <n>`     | integer | —         | Return at most `<n>` rows, fetching a single page.                                                                                                                                                                                                                                                          |

**Example**

```bash
celigo environments list --format table
```

Default table columns: `_id`, `name`, `lastModified`.

In celigo-cli 2026.8.1 through 2026.8.8 the default `list` failed with `422 Unprocessable Entity` because the endpoint rejects the `include` projection, and only `--fields all` worked; since 2026.9.1 the default form works again (rows are trimmed client-side to the same columns).

**Corresponds to**: [`GET /v1/environments`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#get-v1-environments)

***

## `celigo environments get`

Fetch a single environment by its ID.

**Signature**

```bash
celigo environments get <id>
```

**Arguments**

| Argument | Required | Description                           |
| -------- | -------- | ------------------------------------- |
| `<id>`   | Yes      | Environment `_id` (24-character hex). |

**Flags**

None beyond the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

**Example**

```bash
celigo environments get 5f8d43a1b9e5a80011a35f2c
```

**Corresponds to**: [`GET /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#get-v1-environments-_id)

***

## `celigo environments create`

Create a new environment from a JSON document. Read the body from a file with `-f, --file` or pipe it on stdin. `name` is required; `description` and `apim` metadata are optional.

**Signature**

```bash
celigo environments create --file <path>
celigo environments create < body.json     # or pipe on stdin
```

**Arguments**

None. The request body comes from `--file` or stdin.

**Flags**

| Flag                | Type   | Default | Description                                                                                                  |
| ------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------ |
| `-f, --file <path>` | string | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1. |

Plus the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Blocked in `read` mode.

**Example**

```bash
celigo environments create < qa-env.json
```

**Corresponds to**: [`POST /v1/environments`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#post-v1-environments)

***

## `celigo environments update`

Replace an environment with a JSON document. Read the body from a file with `-f, --file` or pipe it on stdin. PUT is a full replace — omitted fields are cleared.

> ⚠️ **`PUT` fully replaces the environment.** Any field omitted from the body is cleared. `GET` the environment first, edit, then send the complete object back — or use `set` for targeted field edits.

**Signature**

```bash
celigo environments update <id> --file <path>
celigo environments update <id> < body.json     # or pipe on stdin
```

**Arguments**

| Argument | Required | Description                   |
| -------- | -------- | ----------------------------- |
| `<id>`   | Yes      | Environment `_id` to replace. |

**Flags**

| Flag                | Type    | Default | Description                                                                                                  |
| ------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| `-f, --file <path>` | string  | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1. |
| `--force`           | boolean | `false` | Submit even if the body contains masked credential values (`"******"`) copied from a GET.                    |

Plus the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Blocked in `read` mode.

**Example**

```bash
celigo environments get 5f8d43a1b9e5a80011a35f2c --format json \
  | jq '.description = "Updated QA environment"' \
  | celigo environments update 5f8d43a1b9e5a80011a35f2c
```

**Corresponds to**: [`PUT /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#put-v1-environments-_id)

***

## `celigo environments set`

Edit one or more fields on an environment. No environment field is PATCH-whitelisted, so every assignment goes through `GET` → apply assignments → `PUT` with the complete document — the fields you don't name are kept.

**Signature**

```bash
celigo environments set <id> <key=value> [<key=value>...]
```

**Arguments**

| Argument      | Required | Description                                                                                                                                                                                                         |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<id>`        | Yes      | Environment `_id` to modify.                                                                                                                                                                                        |
| `<key=value>` | Yes (≥1) | One or more assignments. Values are auto-parsed as JSON — `null` removes the field. Dot notation (`apim.environmentHRID=prod`) is supported. Array indexing does not apply here — no Environment field is an array. |

**Flags**

None beyond the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Blocked in `read` mode, and an environment has no operate-level fields, so `set` needs `full` mode. Since celigo-cli 2026.10.1, `operate` mode refuses every assignment before any request — `disabled=true` included: `Field(s) not allowed in operate mode: disabled. This group has no operate-level fields; set needs full mode, which a person raises this profile to at a terminal; an agent must not raise it to get past this refusal.` Since celigo-cli 2026.11.2, the refusal ends by saying who raises the mode, and it names `CELIGO_MODE` instead when that variable set the mode. See [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).

**Examples**

```bash
celigo environments set 5f8d43a1b9e5a80011a35f2c description="Shared UAT environment"
celigo environments set 5f8d43a1b9e5a80011a35f2c apim.environmentHRID=prod-us apim.groupId=admins
celigo environments set 5f8d43a1b9e5a80011a35f2c description=null
```

**Corresponds to**: [`GET /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#get-v1-environments-_id) followed by [`PUT /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/account-and-admin/environments#put-v1-environments-_id).

***

## `celigo environments audit`

Show the audit log (change history) for one environment. The CLI reads every page of the log, and the table shows `_id`, `resourceType`, `event`, `source`, `byUser.email`, and `time`. Added in celigo-cli 2026.11.2.

**Signature**

```bash
celigo environments audit <id>
```

**Arguments**

| Argument | Required | Description        |
| -------- | -------- | ------------------ |
| `<id>`   | Yes      | Environment `_id`. |

**Flags**

None beyond the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Works in `read` mode.

**Example**

```bash
celigo environments audit 5f8d43a1b9e5a80011a35f2c --format table
```

**Corresponds to**: `GET /v1/environments/{_id}/audit`

***

## `celigo environments enable`

Enable an environment. No-op if it is already enabled. The endpoint toggles whatever state it finds, so the CLI reads the environment first and sends the toggle only when the state differs.

Since celigo-cli 2026.10.1, `enable` requires `full` mode (it was `operate`): it is account administration. The toggle is sent once — never resent after a 5xx or a timeout, since a resend of a toggle the platform had already applied would flip it back.

**Signature**

```bash
celigo environments enable <id>
```

**Arguments**

| Argument | Required | Description                  |
| -------- | -------- | ---------------------------- |
| `<id>`   | Yes      | Environment `_id` to enable. |

**Flags**

None beyond the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Requires `full` mode.

**Example**

```bash
celigo environments enable 5f8d43a1b9e5a80011a35f2c
```

**Corresponds to**: [`PUT /v1/environments/{_id}/enable`](https://developer.celigo.com/api/api-reference/account-and-admin/environments) (operationId: `toggleEnvironment`)

***

## `celigo environments disable`

Disable an environment. No-op if it is already disabled. The Production environment cannot be disabled. Like `enable`, it reads the environment first and sends the toggle only when the state differs.

Since celigo-cli 2026.10.1, `disable` requires `full` mode (it was `operate`), and the toggle is never resent after a 5xx or a timeout.

> ⚠️ **Disabling an environment takes it out of service.** The environment is unavailable until you re-enable it with `enable`. The Production environment cannot be disabled.

**Signature**

```bash
celigo environments disable <id>
```

**Arguments**

| Argument | Required | Description                   |
| -------- | -------- | ----------------------------- |
| `<id>`   | Yes      | Environment `_id` to disable. |

**Flags**

None beyond the [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md). Requires `full` mode.

**Example**

```bash
celigo environments disable 5f8d43a1b9e5a80011a35f2c
```

**Corresponds to**: [`PUT /v1/environments/{_id}/enable`](https://developer.celigo.com/api/api-reference/account-and-admin/environments) (operationId: `toggleEnvironment`)

***

## Gotchas

* **No `delete` subcommand.** There is no public delete endpoint for environments. Delete environments through the UI, which warns about the downstream cascade (connections, flows, integrations) before the operation proceeds.
* **Toggle `enabled` with `enable`/`disable`, not `set`/`update`.** The `enabled` flag is managed through the dedicated [`enable`](#celigo-environments-enable) / [`disable`](#celigo-environments-disable) subcommands; including it in a `create`/`update`/`set` body is ignored. `_envUserId` is likewise system-managed and read-only.
* **A toggle is sent once.** `PUT /v1/environments/{_id}/enable` flips whatever state it finds. Since celigo-cli 2026.10.1 the CLI never resends it after a 5xx or a timeout (only a `429` is retried), so a slow toggle that landed is not flipped back. After a timeout, run the same command again: it reads the current state first and does nothing if the toggle already landed.
* **Permission modes.** `list`, `get`, and `audit` work in `read` mode. `create`, `update`, `set`, `enable`, and `disable` need `full` mode — since celigo-cli 2026.10.1 for `enable`/`disable` (they were `operate`), and an environment has no fields `operate` mode's `set` may change. See [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).
* **APIM metadata is usually provisioned for you.** The `apim.environmentId`, `apim.environmentHRID`, and `apim.groupId` fields are normally populated by API-management workflows. Only set them if you are explicitly configuring APIM for this environment.
* **Resources don't cross environments.** A flow can reference only the connections, exports, imports, and scripts that live in the same environment — keep every resource aligned with its environment.

## Related

* [integrations](https://developer.celigo.com/cli/commands/integrations.md) — integrations live inside a single environment.
* [connections](https://developer.celigo.com/cli/commands/connections.md) — connections belong to one environment and can only be used by resources in that same environment.
* [stacks](https://developer.celigo.com/cli/commands/stacks.md) — reusable execution environments for NetSuite/custom JavaScript; a separate concept despite the overlapping terminology.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.celigo.com/cli/commands/environments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
