---
title: "Update an Environment"
method: PATCH
path: "/v1/projects/{project}/environments/{key}"
tags: ["Environments"]
---

# Update an Environment

`PATCH /v1/projects/{project}/environments/{key}`

Update an environment by ID or key. The environment key (if edited) must be unique within the project. If permissions are enabled, changing a protected environment type requires Publisher permissions

## Path parameters

- `key` string, required
- `project` string, required

## Request body

- UpdateEnvironmentDto
  - `name` string — A unique display name
  - `key` string — Unique Environment identifier, can be used in the SDK / API to reference by key rather than ID. Must only contain lower-case characters and `_`, `-` or `.`.
  - `description` string — Environment description.
  - `color` string — Environment display color, used to highlight different environments on the dashboard. Must use Hex color code.
  - `type` 'development' | 'staging' | 'production' | 'disaster_recovery' — The environment type
  - `settings` EnvironmentSettings
    - `appIconURI` string — A unique App Icon URI for a given environment

## Response `200`

- Environment
  - `name` string, required — A unique display name
  - `key` string, required — Unique Environment identifier, can be used in the SDK / API to reference by key rather than ID. Must only contain lower-case characters and `_`, `-` or `.`.
  - `description` string — Environment description.
  - `color` string — Environment display color, used to highlight different environments on the dashboard. Must use Hex color code.
  - `_id` string, required — A unique Environment ID
  - `_project` string, required — The Project owning the Environment
  - `type` 'development' | 'staging' | 'production' | 'disaster_recovery', required — The environment type
  - `_createdBy` string, required — ID of the User who created the Environment.
  - `createdAt` string, date-time, required — The date the Environment was created
  - `updatedAt` string, date-time, required — The date the Environment was last updated
  - `sdkKeys` SDKKeys
    - `mobile` APIKey[], required
    - `client` APIKey[], required
    - `server` APIKey[], required
  - `settings` EnvironmentSettings
    - `appIconURI` string — A unique App Icon URI for a given environment
  - `readonly` boolean, required — Controls whether the environment is editable for a given user

## Other responses

- `400` — Invalid request body
- `401`
- `404` — Environment not found
- `409` — Environment key already exists, cannot rename an environment to an existing one.

---

[API](https://skmtc.dev/devcycle/apis/devcycle-management-api.md) · [All operations](https://skmtc.dev/devcycle/apis/devcycle-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/devcycle/devcycle-management-api/revisions/d4a127a37608/schema)
