# updateEnvironmentVariable

```graphql
mutation UpdateEnvironmentVariable($input: UpdateEnvironmentVariableInput!) {
  updateEnvironmentVariable(input: $input) {
    environmentVariable {
      id
      key
      value
      hasValue
    }
    error
  }
}
```

Change the value or the key of one environment variable. Requires project.env\_vars.write.

## Arguments

| Name                  | Type                            | Required | Description |
| --------------------- | ------------------------------- | -------- | ----------- |
| `input`               | UpdateEnvironmentVariableInput! | Yes      |             |
| `input.environmentId` | ID!                             | Yes      |             |
| `input.key`           | String!                         | Yes      |             |
| `input.newKey`        | String                          |          |             |
| `input.value`         | String                          |          |             |

## Variables

```json
{
  "input": {
    "environmentId": "string",
    "key": "string"
  }
}
```

## Responses

| Status | Description                                                             |
| ------ | ----------------------------------------------------------------------- |
| 200    | The UpdateEnvironmentVariablePayload in data.updateEnvironmentVariable. |

## 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 UpdateEnvironmentVariable($input: UpdateEnvironmentVariableInput!) {\n  updateEnvironmentVariable(input: $input) {\n    environmentVariable {\n      id\n      key\n      value\n      hasValue\n    }\n    error\n  }\n}",
  "variables": {
    "input": {
      "environmentId": "string",
      "key": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateEnvironmentVariable": {
      "environmentVariable": {
        "id": "string",
        "key": "string",
        "value": "string",
        "hasValue": false
      },
      "error": "string"
    }
  }
}
```
