# createEnvironment

```graphql
mutation CreateEnvironment($input: CreateEnvironmentInput!) {
  createEnvironment(input: $input) {
    environment {
      id
      name
      projectId
      protected
      domains
      createdAt
      updatedAt
    }
    error
  }
}
```

Create an environment. Requires project.environments.manage.

## Arguments

| Name                     | Type                    | Required | Description |
| ------------------------ | ----------------------- | -------- | ----------- |
| `input`                  | CreateEnvironmentInput! | Yes      |             |
| `input.projectReference` | String                  |          |             |
| `input.name`             | String!                 | Yes      |             |

## Variables

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

## Responses

| Status | Description                                             |
| ------ | ------------------------------------------------------- |
| 200    | The CreateEnvironmentPayload in data.createEnvironment. |

## 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 CreateEnvironment($input: CreateEnvironmentInput!) {\n  createEnvironment(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": {
      "name": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createEnvironment": {
      "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"
    }
  }
}
```
