---
# Generated by kapten-docs from the CLI's command tree. DO NOT EDIT.
title: "kapten environments"
description: "Create and manage the environments of a project."
sidebar:
  label: "environments"
---

Every command takes the [global flags](/cli/reference#global-flags).

## kapten environments create

Creates an environment in a project, on one of the organization's clusters.

```bash
kapten environments create <project-id> <body...> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `body...` | The request body, as shorthand or JSON. See [Request bodies](/cli/request-bodies). |

| Flag | Description |
| --- | --- |
| `--rsh-generate-body` | Print an example request body and exit |
| `--rsh-validate` | Validate the JSON request body against the OpenAPI schema before sending |

Request body fields, `*` for required:

```text
{
  cluster_id*: (string format:uuid) A universally unique identifier (UUID) string
  name*: (string pattern:\S minLen:1) The name of the environment.
  type*: (string enum:development,staging,production) The type of the environment.
}
```

Example:

```bash
kapten environments create <project-id> 'cluster_id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a", name: string, type: development'
```

## kapten environments delete

Deletes an environment, with its variables and secrets. This cannot be undone.

```bash
kapten environments delete <project-id> <environment-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |

Example:

```bash
kapten environments delete <project-id> <environment-id>
```

## kapten environments get

Returns an environment.

```bash
kapten environments get <project-id> <environment-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |

Example:

```bash
kapten environments get <project-id> <environment-id>
```

## kapten environments list

Returns a project's environments, a page at a time.

```bash
kapten environments list <project-id> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |

| Flag | Description |
| --- | --- |
| `--filter-with-deleted` | Include deleted instances (default: false) |
| `--page-limit int` | Maximum number of records to return (default: 10) |
| `--page-number int` | Page number (default: 1) |

Example:

```bash
kapten environments list <project-id>
```

## kapten environments update

Updates an environment. Fields left out keep their value.

```bash
kapten environments update <project-id> <environment-id> <body...> [flags]
```

| Argument | Description |
| --- | --- |
| `project-id` | The unique identifier for the project |
| `environment-id` | The unique identifier of the environment |
| `body...` | The request body, as shorthand or JSON. See [Request bodies](/cli/request-bodies). |

| Flag | Description |
| --- | --- |
| `--rsh-generate-body` | Print an example request body and exit |
| `--rsh-validate` | Validate the JSON request body against the OpenAPI schema before sending |

Request body fields, `*` for required:

```text
{
  name: (string pattern:\S minLen:1) The updated name of the environment.
}
```

Example:

```bash
kapten environments update <project-id> <environment-id> 'name: string'
```
