---
title: "Add a new environment domain"
method: POST
path: "/projects/{project_id}/environments/{env_id}/domains"
tags: ["Projects"]
---

# Add a new environment domain

`POST /projects/{project_id}/environments/{env_id}/domains`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/environments/{env_id}/domains`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required
- `env_id` integer, required

## Request body

- AddEnvironmentDomainRequest
  - `domain` string, required
  - `is_primary` boolean, required

## Response `201`

Domain added successfully

- EnvironmentDomainResponse
  - `created_at` string, date-time, required
  - `domain` string, required
  - `environment_id` integer, required
  - `id` integer, required
  - `url` string, required: Full URL for this domain (e.g., https://buildtolearndev-production.example.com)

## Other responses

- `400`: Invalid input
- `404`: Project or environment not found
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 1 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `201`
- **2026-11-25** `480a86944327`: 1 info
  - the endpoint scheme security `bearer_auth` was added to the API

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/environments/:env_id/domains/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
