WHOIS Lookup Template
- Python
- Flask
Who a domain is registered with, how old it is, when it expires and its name servers.
A Python and Flask app for WHOIS lookups. Enter a domain and see its registrar, when it was registered and when it expires, how old it is, its name servers and its status. Use it to vet domains at signup, track renewals for the domains you own, or look them up from the command line.

What it does
- Registration at a glance
- Registrar, age, registration and expiry dates, with the days left to renew.
- Name servers and status
- Where the domain’s DNS is hosted, and locks such as transfer prohibited.
- Clear when there’s nothing
- Says so when a domain isn’t registered, instead of showing empty fields.
- Keeps your key private
- The page calls a server route that holds the key, checks the input and limits each visitor to 10 lookups a minute.
- A web app and a CLI
- python app.py runs the page and its route locally. The same lookups work from the terminal, sharing one small API helper.
How it works
The Flask route: it checks the domain and calls WHOIS Lookup.
DOMAIN = re.compile(r'^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$')
def domain_arg():
"""The ?domain= value as a bare hostname: "https://Example.com/path" becomes "example.com"."""
value = request.args.get('domain', '').strip().lower()
value = re.sub(r'^[a-z]+://', '', value)
value = re.split(r'[/?#:]', value)[0].rstrip('.')
return value if DOMAIN.match(value) else None
@app.get('/api/whois')
def whois():
"""GET /api/whois?domain=github.com: who registered a domain, and when it expires."""
domain = domain_arg()
if not domain:
return fail('Enter a domain, like example.com.')
return jsonify(call_api('whoislookup', {'domain': domain}))Deploy it
- Get a free API key
The free plan includes 200 credits a month, no card needed. Create your key.
- Deploy it
Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for
APIVERVE_API_KEY: paste your key there. - Open your app
Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.
Try the WHOIS Lookup API — the call this template makes
No key required to try it. Get a key to use it in your app.
{
"status": "ok",
"error": null,
"data": {
"domainName": "MYSPACE.COM",
"registryDomainID": "3877095_DOMAIN_COM-VRSN",
"createdDate": "1996-02-22T05:00:00Z",
"expiryDate": "2029-02-23T05:00:00Z",
"updatedDate": "2023-01-17T00:16:21Z",
"domainStatus": [
"client delete prohibited https://icann.org/epp#client delete prohibited",
"client renew prohibited https://icann.org/epp#client renew prohibited",
"client transfer prohibited https://icann.org/epp#client transfer prohibited",
"client update prohibited https://icann.org/epp#client update prohibited"
],
"dNSSEC": "unsigned",
"registrar": "GoDaddy.com, LLC",
"registrarIANAID": "146",
"registrarURL": "http://www.godaddy.com",
"registrarAbuseContactEmail": "[email protected]",
"registrarAbuseContactPhone": "tel:480-624-2505",
"nameServers": [
"ns-cloud-a2.googledomains.com",
"ns-cloud-a3.googledomains.com",
"ns-cloud-a4.googledomains.com",
"ns-cloud-a1.googledomains.com"
],
"domain": "myspace.com",
"fetchedAtUTC": "2025-12-17T01:54:05.069Z",
"tld": "com",
"status": "active",
"domainAgeDays": 11094,
"domainAgeYears": 30.4,
"isRecentlyRegistered": false,
"trustScore": 93,
"trustLevel": "high"
}
}