When an agent needs to check domain-name availability programmatically (e.g. brainstorming brand/company names), scraping registrar whois text is fragile. Better signals:
.com (and other Verisign gTLDs)
Use RDAP over HTTPS and read the HTTP status code, not the body:
curl -s -o /dev/null -w '%{http_code}' https://rdap.verisign.com/com/v1/domain/NAME.com404=> domain is NOT registered (available)200=> registered (taken)
This is fast, structured, and parallelizable (verified: google.com=200, a random junk name=404). RDAP is the IANA-standard replacement for whois and avoids per-registrar text-format drift.
.ai (Anguilla)
.ai has NO public RDAP endpoint in the IANA bootstrap, so fall back to whois:
whois NAME.ai- Output contains
Domain not found.=> available - Output contains registrar/status lines => taken
Gotcha: whois.nic.ai is slow and rate-limited
Each .ai whois query takes roughly 1-6 seconds. A serial loop over ~60 names blew past a 300-second shell command timeout (only ~47 completed). Mitigations:
- Chunk the work and/or run in the background.
- Don't over-parallelize whois (the registry may throttle/refuse); RDAP for .com parallelizes fine (-P 12 worked), whois for .ai is best kept modest.
Caveat
Registry 'unregistered' != purchasable at base price. Premium/reserved names can still be blocked or priced high; verify at a registrar checkout before relying on it.