> ## Documentation Index
> Fetch the complete documentation index at: https://feather.mupeni.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Environment

> Updates environment metadata. All fields are optional.

## Path parameters

<ParamField path="projectId" type="string" required />

<ParamField path="envId" type="string" required />

## Body

<ParamField body="name" type="string">
  New display name.
</ParamField>

<ParamField body="color" type="string">
  New hex color.
</ParamField>

<ParamField body="protected" type="boolean">
  Set to `true` to enable the [change proposal
  workflow](/docs/concepts/environments#protected-environments) for this environment. Requires **Pro or
  Enterprise** plan.

  **Warning:** setting `protected` to `false` on an environment that currently has pending proposals
  will **auto-reject all of them**. Direct writes will be allowed again immediately, so pending
  proposals are considered stale and cannot be safely approved.
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X PATCH https://nest.feather.mupeni.dev/v1/projects/proj_01hx.../environments/env_01hx... \
    -H "Authorization: Bearer <server_key>" \
    -H "Content-Type: application/json" \
    -d '{ "protected": true }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "env_01hx...",
    "name": "Production",
    "slug": "production",
    "color": "#ef4444",
    "protected": true,
    "createdAt": "2024-03-01T12:00:00.000Z"
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": "UPGRADE_REQUIRED",
      "message": "Environment protection requires a Pro or Enterprise plan."
    }
  }
  ```
</ResponseExample>
