# updateEnvironment

```graphql
mutation UpdateEnvironment($input: UpdateEnvironmentInput!) {
  updateEnvironment(input: $input) {
    environment {
      id
      name
      projectId
      protected
      domains
      createdAt
      updatedAt
    }
    error
  }
}
```

Update an environment. Requires project.environments.manage.

## Arguments

| Name              | Type                         | Required | Description                                                                                                                                                                                        |
| ----------------- | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input`           | UpdateEnvironmentInput!      | Yes      |                                                                                                                                                                                                    |
| `input.id`        | ID!                          | Yes      |                                                                                                                                                                                                    |
| `input.name`      | String                       |          |                                                                                                                                                                                                    |
| `input.variables` | \[EnvironmentVariableInput!] |          | Atomic variable upserts in this environment. Existing keys retain their IDs; omitted keys remain unchanged and returned values are masked. A non-empty list also requires project.env\_vars.write. |
| `input.protected` | Boolean                      |          |                                                                                                                                                                                                    |

## Variables

```json
{
  "input": {
    "id": "string"
  }
}
```

## Responses

| Status | Description                                             |
| ------ | ------------------------------------------------------- |
| 200    | The UpdateEnvironmentPayload in data.updateEnvironment. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateEnvironment($input: UpdateEnvironmentInput!) {\n  updateEnvironment(input: $input) {\n    environment {\n      id\n      name\n      projectId\n      protected\n      domains\n      createdAt\n      updatedAt\n    }\n    error\n  }\n}",
  "variables": {
    "input": {
      "id": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateEnvironment": {
      "environment": {
        "id": "string",
        "name": "string",
        "projectId": "string",
        "protected": false,
        "domains": [
          "string"
        ],
        "createdAt": "2026-01-01T00:00:00Z",
        "updatedAt": "2026-01-01T00:00:00Z"
      },
      "error": "string"
    }
  }
}
```
