> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Environment management with the Contentful CLI > These commands will help you manage environments in Contentful | Creating a new environment, cloning an existing and deleting These commands will help you manage environments in Contentful. ## Requirements * A (free) [Contentful account](https://www.contentful.com/sign-up/) * Locally [installed](/tutorials/cli/installation) `contentful-cli` * [Authenticated](/tutorials/cli/authentication) with `contentful-cli` ## List available commands and their description ```bash contentful space environment --help ``` ## Create a new environment This is how you create a new environment within a Space. You have to supply an ID for the environment. ```bash contentful space environment create --name release-1 --environment-id release-1 ``` *The output should look similar to this:* ```bash Successfully created environment release-1 (release-1) ``` ## Clone an existing environment You have to supply the ID of the source environment that will be copied to create the new environment. The default is "master". ```bash contentful space environment create --name release-2 --environment-id release-2 --source release-1 ``` *The output should look similar to this:* ```bash Successfully created environment release-1 (release-1) ``` ## Get a list of all available environments Lists all available environments from a Space. ```bash contentful space environment list ``` *The output should look similar to this:* ```bash ┌──────────────────┬──────────────────┬────────────────────┐ │ Environment name │ Environment id │ Environment status │ ├──────────────────┼──────────────────┼────────────────────┤ │ master [active] │ master │ ready │ ├──────────────────┼──────────────────┼────────────────────┤ │ release-1 │ │ ready │ └──────────────────┴──────────────────┴────────────────────┘ ``` ## Set an environment-id to use in all subsequent commands Many commands have an `--environment-id` option since they can be scoped to a specific environment. Since it is unintuitive to pass the environment ID every time, you can use the `environment use` command to lock the CLI to a specific environment. It will be used until you use another environment or pass a different `--environment-id` to a subsequent command. If you specify a different `--space-id`, rather than using the already active space (see `space use`) then the current environment will be ignored and `'master'` will be used instead. ```bash contentful space environment use --environment-id ``` *The output should look similar to this:* ```bash Now using environment release-1 () in Space cli-test () when the `--environment-id` option is missing. ``` ## Delete an environment in your current space You have to supply an ID for the environment. ```bash contentful space environment delete --environment-id ``` *The output should look similar to this:* ```bash Successfully deleted environment release-1 () ``` ## Next steps * [Manage environment aliases with the Contentful CLI](/tutorials/cli/environment-alias-management/) * [Manage extensions with the Contentful CLI](/tutorials/cli/extension-management) * [Check out the documentation in the GitHub repository](https://github.com/contentful/contentful-cli/tree/master/docs/space/environment) > These commands will help you manage environments in Contentful | Creating a new environment, cloning an existing and deleting