Skip to content

CustomNameserver

Source: src/Cloudflare/CustomNameserver/CustomNameserver.ts

An account-level custom (vanity) nameserver — e.g. ns1.yourbrand.com — that zones on the account can use instead of their assigned *.ns.cloudflare.com names.

The nameserver’s identity is its nsName (FQDN) within the account. There is no update API: both nsName and nsSet are immutable, so changing either triggers a replacement. After creation, Cloudflare returns the A/AAAA glue records (dnsRecords) that must be registered at the domain registrar.

Requires the account custom nameservers entitlement (Business/Enterprise or a paid add-on); on unentitled accounts every API call fails with the typed CustomNameserversNotEnabled error.

Safety: custom nameservers carry no ownership markers. When there is no prior state, read scans the account for an existing nameserver with the same nsName and reports it as Unowned, so the engine refuses to take it over unless --adopt (or adopt(true)) is set.

Vanity nameserver on the default set

const ns1 = yield* Cloudflare.CustomNameserver.CustomNameserver("Ns1", {
nsName: "ns1.yourbrand.com",
});
// Glue records to register at your registrar:
const glue = ns1.dnsRecords; // [{ type: "A", value: "..." }, ...]

Nameserver on a specific set

yield* Cloudflare.CustomNameserver.CustomNameserver("Ns2", {
nsName: "ns2.yourbrand.com",
nsSet: 2,
});