await host.domains.detach("www.example.com");host.domains.detach("www.example.com")Both halves go
The platform stops accepting the name, and the record is removed. Leaving either one would give a name that resolves and refuses, or a registration pointing at nothing.
The domain stays on the account
Only the link to this host goes. The zone, the mail and everything else are untouched — removing the domain itself is api.domains.remove().
The host keeps serving at its own address
Detaching a custom name does not take anything offline; it stops one of the ways in.
Moving a name to another host
await oldHost.domains.detach("www.example.com");
await newHost.domains.attach("www.example.com");old_host.domains.detach("www.example.com")
new_host.domains.attach("www.example.com")Between the two calls the name serves nothing, and the new host issues its own certificate — so the name refuses connections for a moment after attaching. Do it when a short interruption is acceptable, and read the certificate state before announcing it.
Resolvers keep the record briefly
For its lifetime. The name can keep answering after this returns, which is DNS rather than a failure of the call.