Check domain availability in bulk with RDAP and Python
DNS first, RDAP second, WHOIS only where you have to. A tested script, real results, and the registry rules worth knowing before you automate it.

Naming something is hard enough without typing 40 name ideas into a registrar's search box one at a time, across five extensions each. Registrar APIs usually want an account and an API key. Old WHOIS scripts break on every registry's slightly different text format.
There's a better source: RDAP, the Registration Data Access Protocol. It's the official replacement for WHOIS, it's run by the registries themselves, and it returns JSON over HTTPS. This post builds a small bulk checker around it and covers the two gaps you'll hit in practice.
The plan
For each domain:
- DNS lookup. If the domain has nameservers, it's registered. Done, and it costs nothing.
- RDAP lookup at the registry. A 404 means the registry has no record of it. A 200 means it's registered, and you get dates for free.
- WHOIS fallback, only for extensions that don't offer RDAP yet.
The order matters. DNS is fast and cached, so it removes most taken names before you touch a registry's rate limit.
Step 1: DNS can prove "taken", but never "free"
Cloudflare's DNS-over-HTTPS endpoint returns JSON, so there's no DNS library to install:
import time
import requests
BOOTSTRAP = "https://data.iana.org/rdap/dns.json"
DOH = "https://cloudflare-dns.com/dns-query"
def has_nameservers(domain):
"""True if the domain has NS records. That proves it's registered (the reverse is not true)."""
r = requests.get(DOH, params={"name": domain, "type": "NS"},
headers={"accept": "application/dns-json"}, timeout=15)
answers = r.json().get("Answer", [])
return any(a.get("type") == 2 for a in answers)
The catch is in the docstring. A domain can be registered and have no nameservers at all: parked without DNS, on hold, or simply never set up. In our test run, openai.ai had no NS records, but RDAP showed it's registered until 2029. So "no DNS" only means "go ask the registry".
Step 2: find the right RDAP server
Every registry runs its own RDAP server. IANA publishes a bootstrap file that maps each TLD to its server:
def load_rdap_servers():
"""Map each TLD to its registry's RDAP base URL, using IANA's bootstrap file."""
data = requests.get(BOOTSTRAP, timeout=30).json()
servers = {}
for tlds, urls in data["services"]:
base = next((u for u in urls if u.startswith("https://")), urls[0])
for tld in tlds:
servers[tld.lower()] = base.rstrip("/") + "/"
return servers
When we ran this, the file covered 1,204 TLDs. Download it once per run, not once per domain.
Step 3: ask the registry
An RDAP domain lookup is a plain GET to <server>domain/<name>:
def rdap_lookup(domain, servers, retries=3):
tld = domain.rsplit(".", 1)[-1].lower()
base = servers.get(tld)
if not base:
return {"domain": domain, "status": "unknown", "note": f".{tld} has no RDAP server"}
for attempt in range(retries):
r = requests.get(base + "domain/" + domain, timeout=20,
headers={"accept": "application/rdap+json"})
if r.status_code == 404:
return {"domain": domain, "status": "available"}
if r.status_code == 200:
events = {e["eventAction"]: e["eventDate"] for e in r.json().get("events", [])}
return {"domain": domain, "status": "registered",
"expires": events.get("expiration"), "created": events.get("registration")}
if r.status_code == 429: # slow down and retry
time.sleep(2 ** attempt * 2)
continue
break
return {"domain": domain, "status": "unknown", "note": f"RDAP HTTP {r.status_code}"}
The events list is where the useful dates live: registration, expiration, last changed. That makes the same function handy for watching when your own domains expire.
Step 4: the gap, and the WHOIS fallback
Some popular extensions still aren't in the bootstrap file. In our run, .io and .de were both missing, so RDAP can't answer for them. Their registries still run WHOIS on port 43, which is plain text over a socket. Each registry phrases "not registered" differently, so you match a marker per TLD:
import socket
# TLDs without RDAP still answer WHOIS on port 43. Each registry words "not found" differently.
WHOIS = {
"io": ("whois.nic.io", "domain not found"),
"de": ("whois.denic.de", "status: free"),
}
def whois_available(domain):
tld = domain.rsplit(".", 1)[-1].lower()
host, free_marker = WHOIS[tld]
query = f"-T dn {domain}\r\n" if tld == "de" else f"{domain}\r\n"
with socket.create_connection((host, 43), timeout=15) as s:
s.sendall(query.encode())
chunks = []
while data := s.recv(4096):
chunks.append(data)
text = b"".join(chunks).decode("utf-8", "replace").lower()
return free_marker in text, text[:300]
Read the terms printed in those responses before you scale this up. The .io WHOIS output, for example, says you may not use it to "enable high volume, automated, electronic processes" except as reasonably necessary to register domain names, and that queries are throttled. Checking a shortlist before you register is exactly that use. Hammering it with a million names is not.
Results from a real run
| Domain | Result | Answered by |
|---|---|---|
brightquokka-tools.com |
available | RDAP 404 |
brightquokka-tools.dev |
available | RDAP 404 |
brightquokka-tools.ai |
available | RDAP 404 |
brightquokka-tools.io |
available | WHOIS |
brightquokka-tools.de |
available | WHOIS |
stripe.com |
registered | DNS (has nameservers) |
notion.io |
registered | DNS (has nameservers) |
openai.ai |
registered, expires 2029-11-03 | RDAP 200 (no NS records) |
What "available" really means
A 404 from the registry means there's no registration record. It doesn't always mean you can buy the name at the normal price:
- Premium names are unregistered but priced far above standard.
- Reserved names are blocked by the registry and may not show up in RDAP at all.
- Recently expired names can sit in a redemption or pending-delete period before they're released.
Treat the script's output as a shortlist, then confirm the final pick at your registrar before you print the business cards.
Be a good citizen
Registries throttle both RDAP and WHOIS and answer with HTTP 429 or dropped connections when you go too fast. Keep one or two requests in flight per registry, back off when you see a 429, cache results, and let DNS filter out the obvious taken names first. Never store or publish registrant contact data. You don't need it to answer "is it free?"
The shortcut
If you'd rather not maintain per-registry WHOIS quirks, we built this into Bulk Domain Availability Checker on Apify. You give it name ideas and a list of extensions (or full domains), and it runs the same DNS, RDAP and WHOIS sequence with per-registry rate limits. It returns available or registered with a confidence level, plus registrar, created and expiry dates, days until expiry and status codes for taken names. It's priced per domain checked, and inconclusive results aren't charged. To be upfront: we built it and maintain it.
Either way, check the whole shortlist across every extension you care about before you fall in love with a name.
Written with AI assistance. Every code sample in this post was run before publishing, and the numbers come from those runs.
About the author
- Cuesta Data builds and maintains small data tools on Apify: website screenshots, PDF and image OCR, job feeds, SEO and Lighthouse audits. Here we write up the techniques behind them, with code you can run yourself.
Comments
Join the discussionYour point about missing DNS records not proving availability also matters when an AI assistant interprets the results.
In a four-domain test I ran on 30 November with Domain Discovery MCP and Claude Desktop, a generated .com name returned available, while the same label under .hu returned unknown, with “no delegation; registry unreachable for this TLD”. Claude preserved that uncertainty in its summary. That single result does not establish a general limitation for .hu.
How does your full checker report cases where neither RDAP nor the WHOIS fallback can confirm the result?
I documented the setup and checked Claude’s summary against the raw tool response here: https://ezstgb.hashnode.dev/checking-domain-availability-in-claude-desktop-a-practical-windows-test
Disclosure: I help with discoverability and listings for Domain Discovery MCP.


