WHOIS Lookup API: Domain Registration Data at Scale
Query WHOIS data programmatically to get registrar information, expiration dates, name servers, and domain ownership data. Working examples in Python, Node.js, Go, and PHP.
What Is WHOIS Data and Why Businesses Need It
WHOIS is a public database protocol that stores domain registration information. When a domain is registered, the registrar records details including the registrant, administrative and technical contacts, registration and expiration dates, name servers, and domain status codes.
For businesses, WHOIS data is essential for:
Domain Portfolio Management
Track expiration dates, monitor registrar changes, and manage renewals across your entire domain portfolio.
Brand Protection
Detect trademark infringement by monitoring new domain registrations that match your brand.
Security Research
Investigate suspicious domains by analyzing registration patterns and name server relationships.
Competitive Intelligence
Monitor competitor domain strategies, new product launches, and infrastructure changes.
WHOIS Data Fields Explained
| Field | Description | GDPR Status |
|---|---|---|
| domainName | The queried domain | Available |
| registrar | Domain registrar name | Available |
| registrationDate | Domain creation date | Available |
| expirationDate | Domain expiration date | Available |
| nameServers | Authoritative DNS servers | Available |
| status | Domain status codes | Available |
| registrant | Domain owner information | Often redacted |
| contactEmail | Registrant email | Often redacted |
WHOIS Privacy and GDPR Considerations
Since GDPR took effect in May 2018, WHOIS data has undergone significant changes. Registrars now redact personal information (registrant name, email, phone, address) by default for domains registered by EU residents.
What This Means for Your Application
- Always handle WHOIS data as potentially GDPR-sensitive
- Do not store personal registrant data without a legal basis
- Non-personal data (dates, registrar, name servers, status) remains fully accessible
- WHOIS APIs aggregate data from multiple sources to maximize available information
Getting Started with the WHOIS Lookup API
Query Domain WHOIS Data
Send a GET request with the target domain name:
curl -X GET "https://api.ops.tools/v1/whois?domain=example.com" \ -H "Authorization: Bearer YOUR_API_KEY"
Parse the Response
{
"domainName": "example.com",
"registrar": "GoDaddy.com, LLC",
"registrationDate": "1995-08-14T04:00:00Z",
"expirationDate": "2026-08-13T04:00:00Z",
"nameServers": ["a.iana-servers.net", "b.iana-servers.net"],
"status": ["clientDeleteProhibited", "clientTransferProhibited"],
"daysUntilExpiration": 148,
"registrarUrl": "https://www.godaddy.com",
"registrant": {
"organization": "Internet Corporation for Assigned Names",
"country": "US"
}
}Code Examples
Python
import requests
apiUrl = "https://api.ops.tools/v1/whois"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get(apiUrl, headers=headers, params={"domain": "example.com"})
data = response.json()
print(f"Domain: {data['domainName']}")
print(f"Registrar: {data['registrar']}")
print(f"Expires: {data['expirationDate']}")
print(f"Days remaining: {data['daysUntilExpiration']}")Node.js
const response = await fetch(
"https://api.ops.tools/v1/whois?domain=example.com",
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const data = await response.json();
console.log(`Domain: ${data.domainName}`);
console.log(`Registrar: ${data.registrar}`);
console.log(`Days until expiry: ${data.daysUntilExpiration}`);Go
req, _ := http.NewRequest("GET",
"https://api.ops.tools/v1/whois?domain=example.com", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Domain: %s\n", result["domainName"])
fmt.Printf("Expiry: %s\n", result["expirationDate"])PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"https://api.ops.tools/v1/whois?domain=example.com"
);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Domain: " . $data['domainName'];
echo "Expiry: " . $data['expirationDate'];Domain Expiration Tracking
One of the most valuable uses of a WHOIS API is automated expiration tracking. Losing a domain to expiration can cost thousands in lost revenue, brand damage, and recovery fees.
The Cost of Domain Expiration
Check out our domain expiration monitoring guide for a complete automated monitoring implementation.
Bulk WHOIS Lookups for Domain Portfolios
For organizations managing large domain portfolios, the API supports batch operations. Query hundreds of domains efficiently with proper rate limiting and parallel processing.
Bulk WHOIS Best Practices
- Cache WHOIS data for 24-48 hours (data changes infrequently)
- Space requests 1-2 seconds apart to respect rate limits
- Monitor expiration dates in priority order (closest to expiry first)
- Set up alerts at 90, 60, 30, and 14 days before expiration
- Track registrar changes as potential security indicators
Frequently Asked Questions
Q: What is a WHOIS lookup?
A WHOIS lookup queries a public database that stores domain registration information including the registrar, registrant contact details, registration and expiration dates, name servers, and domain status codes. It is the primary method for finding out who owns a domain.
Q: Is WHOIS data still available after GDPR?
GDPR significantly changed WHOIS data availability. Many registrars now redact personal registrant information. However, registration dates, registrar info, name servers, domain status, and expiration dates remain publicly accessible. WHOIS APIs aggregate data from multiple sources to maximize available information.
Q: How to check domain expiration dates programmatically?
Use a WHOIS lookup API like Ops.Tools to query domain expiration dates. Send a request with the domain name, and the API returns the registration date, expiration date, and days remaining. This enables automated monitoring for domain portfolios. Professional plans start at $29/month.
Q: What is reverse WHOIS lookup?
Reverse WHOIS lookup finds all domains associated with a specific registrant, email address, name server, or IP address. This is useful for competitive research, fraud investigation, and brand protection. The Ops.Tools API supports reverse WHOIS queries by email and name server.
Related Articles
DNS Lookup API: How to Check DNS Records Programmatically
Complete developer guide to querying DNS records via API. Includes working code examples in Python, Node.js, Go, and PHP with caching best practices.
Read ArticleIP Geolocation API: Complete Developer Guide
Build location-aware applications with IP geolocation data. Get country, city, ISP, timezone, and VPN detection from any IP address. Code examples included.
Read ArticleAPI Integration Guide: Getting Started with Ops.Tools APIs
Complete getting started guide for DNS, WHOIS, IP, and SSL APIs. Authentication, code examples, caching strategies, and production deployment patterns.
Read ArticleStart Querying WHOIS Data via API
Get domain registration data, expiration tracking, and ownership intelligence. Plans from $29/month.