# createDomain

```graphql
mutation CreateDomain($input: CreateDomainInput!) {
  createDomain(input: $input) {
    id
    domain
    environmentId
    projectId
    createdAt
    updatedAt
  }
}
```

Add a custom domain. Requires project.domains.write.

## Arguments

| Name                  | Type               | Required | Description                                                                    |
| --------------------- | ------------------ | -------- | ------------------------------------------------------------------------------ |
| `input`               | CreateDomainInput! | Yes      |                                                                                |
| `input.environmentId` | ID!                | Yes      | Environment UUID.                                                              |
| `input.domain`        | String!            | Yes      | Custom hostname. The hostname must resolve to Veryfront before it is attached. |

## Variables

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

## Responses

| Status | Description                       |
| ------ | --------------------------------- |
| 200    | The Domain! in data.createDomain. |

## 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 CreateDomain($input: CreateDomainInput!) {\n  createDomain(input: $input) {\n    id\n    domain\n    environmentId\n    projectId\n    createdAt\n    updatedAt\n  }\n}",
  "variables": {
    "input": {
      "environmentId": "string",
      "domain": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createDomain": {
      "id": "string",
      "domain": "string",
      "environmentId": "string",
      "projectId": "string",
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-01T00:00:00Z"
    }
  }
}
```
