# Update Environment

Rename one of your environments.

`PUT https://connect.mindcloud.co/v2/environments/:environmentId`

Permissions: `environment:edit`.

## Parameters

### Path

- `environmentId` (string, required): The environment's id, from List Environments.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `name` (string, required): The new name, up to 255 characters.

## Example request

```bash
curl --request PUT \
  --url 'https://connect.mindcloud.co/v2/environments/Ev4kR8mTq2Lx' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "QA"
}'
```

## Response fields

- `id` (string): Unique id of the environment. Use it to filter runs.
- `name` (string): The environment's name, like Production or Sandbox.
- `isDefault` (boolean): True for the default environment.
- `workflowCount` (number): How many scheduled workflows target it.
- `createdOn` (date): When the environment was created.

## Errors

- 400 Built-in environment: `VALIDATION_FAILED` / `ENVIRONMENT_PREDEFINED` "Cannot update predefined environment name"
