---
title: "Link a custom domain to a certificate"
method: POST
path: "/projects/{project_id}/custom-domains/{domain_id}/link-certificate/{certificate_id}"
tags: ["Custom Domains"]
---

# Link a custom domain to a certificate

`POST /projects/{project_id}/custom-domains/{domain_id}/link-certificate/{certificate_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}/link-certificate/{certificate_id}`
- Auth: HTTP bearer

## Path parameters

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

## Response `200`

Custom domain linked to certificate 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

- `401`: Unauthorized
- `404`: Custom domain or certificate 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`: 1 info
  - 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/link-certificate/:certificate_id/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)
