# environments

Manage the sandbox and production partitions on your account — named containers that segregate connections, flows, and other resources by lifecycle stage.

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

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

Supports all [global flags](/cli/setup/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 JSON on stdin.                                     |
| `update`   | Replace an environment's mutable fields with JSON on stdin.                      |
| `set`      | Patch one or more fields on an environment without re-sending the full document. |

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

***

## `celigo environments list`

List all environments in the account.

**Signature**

```bash
celigo environments list
```

**Arguments**

None.

**Flags**

None beyond the [global flags](/cli/setup/global-flags.md) (`--format`, `--jq`, `--profile`, `--verbose`).

**Example**

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

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

**Corresponds to**: [`GET /v1/environments`](https://developer.celigo.com/api/api-reference/environments#list-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](/cli/setup/global-flags.md).

**Example**

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

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

***

## `celigo environments create`

Create a new environment from a JSON document read from stdin. `name` is required; `description` and `apim` metadata are optional.

**Signature**

```bash
celigo environments create < body.json
```

**Arguments**

None. The full request body is piped via stdin.

**Flags**

None beyond the [global flags](/cli/setup/global-flags.md). Blocked in `read` mode.

**Example**

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

**Corresponds to**: [`POST /v1/environments`](https://developer.celigo.com/api/api-reference/environments#create-an-environment)

***

## `celigo environments update`

Replace an environment with the JSON document piped on stdin. PUT is a full replace — omitted fields are cleared.

**Signature**

```bash
celigo environments update <id> < body.json
```

**Arguments**

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

**Flags**

None beyond the [global flags](/cli/setup/global-flags.md). Blocked in `read` mode.

**Example**

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

**Corresponds to**: [`PUT /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/environments#update-an-environment)

***

## `celigo environments set`

Patch one or more fields on an environment. The CLI does `GET` → apply assignments → `PUT` to avoid clobbering fields you don't intend to change.

**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`) and array indexing (`tags[0]=sandbox`) are supported. |

**Flags**

None beyond the [global flags](/cli/setup/global-flags.md). Blocked in `read` mode.

**Examples**

```bash
celigo environments set 5f8d43a1b9e5a80011a35f2c description="UAT sandbox, shared"
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/environments#get-an-environment) followed by [`PUT /v1/environments/{_id}`](https://developer.celigo.com/api/api-reference/environments#update-an-environment).

***

## 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.
* **`enabled` and `_envUserId` are read-only.** They appear in `get`/`list` responses but are managed by the system; including them in a `create`/`update` body is ignored.
* **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.
* **Sandbox/production partitions must not cross.** A flow with `sandbox: true` may only reference connections with `sandbox: true`, and vice versa — keep resources aligned with the environment they're assigned to.

## Related

* [integrations](/cli/build/integrations.md) — integrations live inside an environment and inherit its sandbox/production partition.
* [connections](/cli/build/connections.md) — connections carry the `sandbox` flag that must match the environment they're used in.
* [stacks](/cli/infrastructure/stacks.md) — reusable execution environments for NetSuite/custom JavaScript; a separate concept despite the overlapping terminology.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.celigo.com/cli/infrastructure/environments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
