# createEnvironmentVariable

```graphql
mutation CreateEnvironmentVariable($input: CreateEnvironmentVariableInput!) {
  createEnvironmentVariable(input: $input) {
    environmentVariable {
      id
      key
      value
      hasValue
    }
    error
  }
}
```

Create an environment variable; a key that exists already is a conflict. Requires project.env\_vars.write.

## Arguments

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

## Variables

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

## Responses

| Status | Description                                                             |
| ------ | ----------------------------------------------------------------------- |
| 200    | The CreateEnvironmentVariablePayload in data.createEnvironmentVariable. |

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

## Example response

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