Check custom domains
get_domain_status
Reads the custom domains of a site, with whether each one is connected and the exact DNS records each hostname needs.
A site can have up to 10 custom domains, and every connected one serves the same site. Each entry in domains carries its _id, which is the domainId the other domain tools take, the hostname in Domain and its www companion in WwwDomain if it has one, whether each is connected in IsConnected and WwwIsConnected, whether the domain is proved to be yours in Verified, and OwnedDomain.
Every DNS record listed for a hostname, in RequiredDnsRecords and WwwRequiredDnsRecords, has a valid flag saying whether it is already in place and a checked flag saying whether the lookup could be completed. IsCloudflare says whether the domain's DNS is on Cloudflare. While one of its hostnames is not connected, DomainConnect says whether its DNS provider supports one-click setup, and it is null once every hostname of that domain is connected or when no supported provider is found.
OwnedDomain is null unless the workspace bought the domain, or the domain it is a subdomain of, on its Domains page or with buy_domain, and that bought domain is active or expiring soon. It then carries that domain's Id, Name, ManagedDns, Ready and Error, and it is null while the custom domains are paused.
ManagedDnstrue means the bought domain uses Modulify's nameservers, so Modulify adds the records the site needs to it by itself, keeps them locked inlist_dns_records, and removes them when the hostname leaves the site. One-click setup is not offered,DomainConnectis null, and you add nothing.Readytrue means every record is in place, so the domain connects once DNS servers pick them up.Errorsays what keeps Modulify from adding them, usually a record of your own at that name, which you delete withdelete_dns_recordor on the domain's DNS records tab. Modulify adds the records within a minute of that.ManagedDnsfalse means the bought domain uses other nameservers, so you add the records where its DNS is hosted, like any other domain.
While Verified is false, the domain still needs its ownership record: RequiredDnsRecords includes a TXT record at _modulify-verification.<domain>, which for a www hostname sits on its root domain instead, and neither the domain nor its www companion serves the site or counts as connected until that record is found, even when the other records are in place. It only counts as a TXT record at exactly that name, never through a CNAME, and one-click setup never adds it, so you always add it by hand. Every record name in the answer is the full DNS name, such as _modulify-verification.example.com, while many DNS hosts expect only the part in front of the zone, such as _modulify-verification, or _modulify-verification.blog for blog.example.com. The tool tells the client to say which form your host wants and never to let the zone appear twice. This call looks for it, and Modulify does too every 10 minutes on its own. Once it is found, Verified turns true, the TXT record leaves the list and can be deleted at the DNS host. Buying the domain on the workspace's Domains page counts as proof too, so a bought domain turns verified on the next check. A domain still unverified 14 days after it was added, or after it was last checked by this call, the Domain panel or chat, is removed from the site, and that count starts over when paused custom domains resume. Connected domains are checked again once a day, and one whose records no longer point at Modulify turns IsConnected false until they do again. See The ownership record.
Pass domainId to check one domain, or leave it out to check them all. A site with no custom domains answers with an empty list, and the site's pending verification, started by start_domain_verification or by add_custom_domain, is not listed until verify_domain adds it. The primary domain, the one links to the live site use, is the connected entry chosen with set_primary_domain, which carries IsPrimary true, else the first entry whose domain is connected, or failing that the first connected www companion, and a domain whose root was removed counts with its www hostname in the root's place.
It runs live DNS lookups against public resolvers, so it is slow and its answer lags a change just made at a registrar. It is also the call that re-checks DNS and marks a domain connected once its records are in place, so call it once after a change rather than polling it.
When the workspace has no paid plan any more, the custom domains are paused. The answer then carries paused true and lists the domains as they are, without any DNS lookup, and none of them serves the site until the workspace is on a paid plan again, when they come back on their own. See Connect a custom domain.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
workspaceId |
string | Yes | The workspace the site belongs to. |
domainId |
string | No | The _id of one custom domain to check, as get_domain_status or add_custom_domain returned it. Leave it out to check every domain of the site. |