# domains.detach()

Canonical URL: https://developers.iagenify.com/sdk/ref/host/domains/detach/
Language: en

`host.domains.detach(name) → Promise<{ ok: true }>`

Stops serving this host at that name: the registration and the DNS record both go.

Status: DELETE · both halves · the domain stays attached

```javascript
await host.domains.detach("www.example.com");
```

## Both halves go {#both}

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 {#domain-stays}

Only the link to this host goes. The zone, the mail and everything else are untouched — removing the domain itself is [api.domains.remove()](/sdk/ref/domains/remove).

## The host keeps serving at its own address {#host-stays}

Detaching a custom name does not take anything offline; it stops one of the ways in.

## Moving a name to another host {#moving}

```javascript
await oldHost.domains.detach("www.example.com");
await newHost.domains.attach("www.example.com");
```

> **There is a gap, and a new certificate**
>
> 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 {#propagation}

For its lifetime. The name can keep answering after this returns, which is DNS rather than a failure of the call.

- [domains.attach()](/sdk/ref/host/domains/attach): The other direction.
- [api.domains.remove()](/sdk/ref/domains/remove): Removing the domain itself.

```python
host.domains.detach("www.example.com")
```

```python
old_host.domains.detach("www.example.com")
new_host.domains.attach("www.example.com")
```
