# Create environment domain

```http
POST /projects/{project_reference}/environments/{environment_id}/domains
```

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

## Parameters

| Name                | In   | Required | Description    |
| ------------------- | ---- | -------- | -------------- |
| `project_reference` | path | Yes      |                |
| `environment_id`    | path | Yes      | Environment ID |

## Request body

| Field    | Type   | Required | Description                                  |
| -------- | ------ | -------- | -------------------------------------------- |
| `domain` | string | Yes      | Custom domain name to add to the environment |

## Responses

| Status | Description                                                                                     |
| ------ | ----------------------------------------------------------------------------------------------- |
| 201    | Domain added successfully                                                                       |
| 400    | Invalid input - Domain format is invalid                                                        |
| 401    | Unauthorized                                                                                    |
| 403    | Forbidden - User does not have permission to add domains or custom\_domains feature not enabled |
| 404    | Environment not found                                                                           |
| 429    | Resource limit exceeded - Custom domain quota reached                                           |
| 500    | Server error                                                                                    |
