api.domains

Overview

Attach a domain and we hold its DNS zone — which is what lets mail and hosting write what they need. Ownership is proven by the nameservers, not declared.

8 methodslive extension listsearch is free
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

CallDoes
tlds()Extensions currently offered by the connected registrar.
search(query, options)Which names are free. Free, and reserves nothing.
add(name)Attaches it and hands back the nameservers to set.
list()Every attached domain.
get(id)One, by identifier or by name.
servers()What can serve a hostname on this account.
remove(id)Detaches it. The domain stays the customer's.
expiring(options)Which names are near renewal. Read at the registry.

Ownership is proven, not declared

Until the registrar points at us, the zone serves nothing

A domain stays pending_nameservers, and attaching a name you do not own gains you nothing. That is the whole proof — there is no verification record to add, and nothing else to do.

A name can be attached once across all accounts. A second attempt answers domain_taken, because the second account would overwrite the first one's zone.

The order that does not break anything

const domain = await api.domains.add("example.com");   // the zone starts EMPTY

const plan = await domain.migration();                 // what does it serve today?
if (!plan.safeToSwitch) await domain.records.import(); // copy it over first

// only now tell the customer to point their registrar at domain.nameservers
await domain.check();                                  // until status is "active"
domain = api.domains.add("example.com")      # the zone starts EMPTY

plan = domain.migration()                    # what does it serve today?
if not plan["safeToSwitch"]:
    domain.records.import_zone()             # copy it over first

# only now tell the customer to point their registrar at domain.nameservers
domain.check()                               # until status is "active"
A zone starts empty

Telling a customer to switch their nameservers before copying what the domain served stops their site, their mail and their signature at the same moment. migration() exists to be read before that sentence is written.

What a zone is for

  • Mail — the records that make an address receive and be trusted.
  • Serving a hostname from something that hosts it.
  • Records of your own, for anything else.

One record type is refused

NS. A record delegating a name away is exactly what a subdomain takeover looks like, so it is not accepted at all.