A domain verification screen asks someone to add a TXT record, then checks for it. When the record doesn't appear, "Invalid domain" is usually too broad to help. The DNS name may exist perfectly well. It just doesn't have the record the screen is looking for.
DNS lets you ask that narrower question with GET /dns/{domain}?type=TXT. An empty records array is a successful result when no answer records are available for that type. For example, this illustrative response shows a completed TXT lookup with nothing to display:
{
"domain": "example.com",
"records": []
}
The request didn't fail. Your interface can say that it didn't find the expected TXT record and keep the setup instructions visible. It should also check the returned values: finding some TXT record is different from finding the verification value your application expects.
DNS distinguishes an absent record type from a nonexistent name. The protocol calls them NODATA and NXDOMAIN respectively. RFC 2308 describes both cases. The distinction gives a setup checker three useful outcomes:
| Lookup outcome | ParseAPI response | Useful next step |
|---|---|---|
| No answer records for the requested type | HTTP 200 with records: [] | Check the record name and value in the setup instructions. |
| The queried DNS name does not exist | HTTP 404 | Check the exact name being queried, including any required subdomain. |
| The lookup could not finish | HTTP 503 | Keep the setup state and offer another check later. |
A new record can also take time to appear in a recursive DNS view. One lookup is an observation from that view, not proof that every resolver sees the same answer. Don't promise worldwide propagation because your own check succeeded.
Read the record type as well as the value
Typed answers can include a CNAME, an alias that points to another DNS name. That means a request for TXT records can return an alias record as part of the answer. Inspect each record's type before treating its value as verification text.
An alias can remain published even when its destination no longer exists. A nonempty records array therefore doesn't establish that the destination works. Look for the requested record and the expected value, rather than using array length as the success condition.
Each returned record also has ttl, the remaining time in seconds for which it may be reused. A zero TTL is an answer you can inspect now, without retaining it as a reusable result. The DNS reference covers the value formats, including TXT quoting and chunks, so a setup checker can compare the actual text rather than a convenient-looking fragment.