---
title: "Set the primary custom domain"
method: POST
path: "/websites/{websiteId}/domains/{domainId}/primary"
tags: ["Domains"]
---

# Set the primary custom domain

`POST /websites/{websiteId}/domains/{domainId}/primary`

## Request

- Base URL: `https://api.cactal.ai/v1`
- URL: `https://api.cactal.ai/v1/websites/{websiteId}/domains/{domainId}/primary`
- Auth: HTTP bearer

Makes this domain the canonical hostname for the published website: requests reaching the platform subdomain or any other custom domain are permanently redirected (HTTP 308) to it, preserving path and query. Only `active` custom domains can be made primary — the request fails with 409 otherwise. Any previous primary is cleared in the same transaction.

## Path parameters

- `websiteId` string, required
- `domainId` string, required

## Response `200`

Confirmation that the domain is now primary.

- object
  - `id` string, required: Id of the domain that is now primary.
  - `hostname` string, required: Hostname that published traffic now redirects to.
  - `isPrimary` true, required: The domain is now the canonical custom domain; any previous primary was cleared.

## Other responses

- `400`: Validation failed. The response `message` names the first invalid field.
- `401`: Missing, invalid, expired, or revoked API key.
- `403`: The authenticated principal lacks the required capability.
- `404`: The resource does not exist or is outside the principal’s access scope.
- `409`: The request conflicts with the current state of the resource.
- `429`: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.

---

[API](https://skmtc.dev/cactal/apis/cactal-api.md) · [All operations](https://skmtc.dev/cactal/apis/cactal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cactal/apis/cactal-api/revisions/9cd0fb5eacdd?raw)
