# Domains and redirects

## Connect a domain

1. Call `POST /sites/{siteId}/domains` with `{"domain":"www.example.com"}`, or use `add_domain`.
2. Follow the DNS instructions returned for that domain.
3. Read `GET /sites/{siteId}/domains` or `list_domains` until verification and serving readiness complete.
4. Call `POST /sites/{siteId}/domains/{domain}/primary`, or use `set_primary_domain`, when the domain is ready.

Domain registration, DNS verification, certificate readiness, and primary-domain selection are distinct steps. Use the returned DNS records; do not hard-code a DNS target into your integration.

`onboardingDomain` on site creation is an unverified reference to an existing website. It does not replace this attachment flow.

## Remove a domain

Use `DELETE /sites/{siteId}/domains/{domain}` or `remove_domain`. Confirm the customer's intended domain before removing it. If it is the primary domain, establish the replacement first.

## Redirects

Read `/sites/{siteId}/redirects` or use `list_redirects`. MCP provides `add_redirect`, `set_redirect_target`, and `remove_redirect`; corresponding HTTP endpoints are in the [reference](/reference/http). Inspect existing redirects before changing them and avoid loops. Verify the deployed URL after propagation.
