---
title: "Update a custom domain"
method: PUT
path: "/projects/{project_id}/custom-domains/{domain_id}"
tags: ["Custom Domains"]
---

# Update a custom domain

`PUT /projects/{project_id}/custom-domains/{domain_id}`

## 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}/custom-domains/{domain_id}`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required
- `domain_id` integer, required

## Request body

- UpdateCustomDomainRequest
  - `branch` string, nullable
  - `domain` string, nullable
  - `environment_id` integer, nullable
  - `redirect_to` string, nullable
  - `service_name` string, nullable: Docker Compose service name this domain routes to (empty string clears it)
  - `status_code` integer, nullable

## Response `200`

Custom domain updated successfully

- CustomDomainResponse
  - `branch` string, nullable
  - `created_at` string, date-time, required
  - `domain` string, required
  - `domain_id` integer, nullable
  - `environment` DomainEnvironmentResponse, nullable
    - `id` integer, required
    - `name` string, required
    - `slug` string, required
  - `expiration_time` string, date-time, nullable
  - `id` integer, required
  - `last_renewed` string, date-time, nullable
  - `message` string, nullable
  - `project_id` integer, required
  - `redirect_to` string, nullable
  - `service_name` string, nullable: Docker Compose service name this domain routes to
  - `status` string, required
  - `status_code` integer, nullable
  - `updated_at` string, date-time, required

## Other responses

- `400`: Invalid input
- `401`: Unauthorized
- `404`: Custom domain not found
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 4 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `expiration_time` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `200`
  - the `last_renewed` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `200`
  - the `updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
- **2026-04-25** `774be20905f2`: 2 info
  - added the new optional request property `service_name`
  - added the optional property `service_name` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/custom-domains/:domain_id/put.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)
