await host.domains.attach("www.example.com");host.domains.attach("www.example.com")The domain must be attached first
Serving a name means writing in its zone. We only write in a zone we hold — so the domain goes through api.domains.add() first, and its nameservers must point here.
It does both halves
The record, and the registration that makes the platform accept the name. A record alone gives an address that resolves and refuses — which is the same reason domain.serve() exists for things hosted elsewhere.
A new name means a new certificate
It takes a moment, and until it is active the address refuses the connection. Read certificate on the host before telling anyone the address works.
Several names, one host
await host.domains.attach("example.com");
await host.domains.attach("www.example.com");host.domains.attach("example.com")
host.domains.attach("www.example.com")Each gets its own record and its own certificate. The host's own address keeps working alongside them.
Errors
| Code | Status | When |
|---|---|---|
| domain_not_attached | 409 | The domain is not on this account. |
| invalid_name | 400 | Not a usable hostname. |