Skip to content
Domain SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

DNS records in the SDK: types, status, and zone writes

The DNS records Domain SDK returns for a custom domain: type, full name, value, purpose, and status. Show them to customers, or write them to a DNS zone with createDnsClient.

When you add a custom domain, the hosting provider says which DNS records the customer needs. Domain SDK returns them as one normalized list on domain.records, in the same shape for every platform. You can show that list to the customer, or write it into a DNS zone yourself with createDnsClient and a DNS adapter.

Every DnsRecord has a type, full name, value, purpose, required flag, and normalized status, plus an optional ttl and description. Identical records are deduplicated; multiple valid verification methods remain available.

Field Values
type A, AAAA, CNAME, TXT, CAA, ALIAS, ANAME
purpose routing, ownership, certificate, other
status pending, valid, invalid, unknown
required true for records the domain needs, false for optional ones
for (const record of domain.records.filter((item) => item.required)) {
  console.log(record.type, record.name, record.value, record.purpose, record.status);
}

Names are full hostnames where the provider supplies enough context. Your UI may additionally explain registrar shorthand, but it should not replace the authoritative value stored by your application.

Write the records to a DNS zone

If the domain’s zone is at Porkbun, Namecheap, or Spaceship, a DNS client can write the records instead of the customer. dns.applyDomainRecords(domain, { zone }) writes the required records, skips records that already exist, and leaves unrelated records alone. Pass includeOptional: true to also write optional records that fit the required ones; optional alternatives that would clash are skipped. See DNS adapters for setup and conflict handling.

Read next: Display DNS records correctly. For raw API walkthroughs next to the adapters, see the Porkbun API, Namecheap API, and GoDaddy API guides.

Last updated on