API Documentation

v1.6

Next Whois provides a simple REST API for WHOIS/RDAP lookups and OG images. Set the server environment variable API_KEY to require Bearer authentication. In the UI, use the API key button in the navigation bar; the key is stored locally in your browser.

GET
/api/lookup

Query WHOIS/RDAP information for a domain, IP address, ASN, or CIDR range. RDAP and WHOIS are queried in parallel; structured fields prefer RDAP data, falling back to WHOIS. Both raw responses are included.

Parameters

ParameterTypeRequiredDefaultDescription
querystring
Required
—Domain name, IPv4/IPv6 address, ASN (e.g. AS13335), or CIDR range. Alias: q

Example Request

curl "https://your-domain.com/api/lookup?query=google.com" \
  -H "Authorization: Bearer $API_KEY"

Success Response

{
"status": true,
"time": 1.23,
"cached": false,
"source": "rdap",
"result": {
"domain": "google.com",
"registrar": "MarkMonitor Inc.",
"registrarURL": "http://www.markmonitor.com",
"ianaId": "292",
"whoisServer": "whois.markmonitor.com",
"creationDate": "1997-09-15T04:00:00Z",
"expirationDate": "2028-09-14T04:00:00Z",
"updatedDate": "2019-09-09T15:39:04Z",
"status": [
{ "status": "clientDeleteProhibited", "url": "..." },
{ "status": "clientTransferProhibited", "url": "..." }
],
"nameServers": ["ns1.google.com", "ns2.google.com", "ns3.google.com", "ns4.google.com"],
"dnssec": "unsigned",
"domainAge": 28,
"remainingDays": 945,
"rawWhoisContent": "Domain Name: GOOGLE.COM\nRegistry Domain ID: ...",
"rawRdapContent": "{\n \"objectClassName\": \"domain\",\n ...\n}"
}
}

Error Response

{
"status": false,
"time": 0.45,
"error": "No match for domain \"EXAMPLE.INVALID\""
}
GET
/api/og

Generate a dynamic Open Graph image with WHOIS details. Internally queries /api/lookup and renders a card-style summary. Returns a PNG image.

Parameters

ParameterTypeRequiredDefaultDescription
querystring
Optional
—Domain name, IP, ASN, or CIDR to look up and display. Alias: q
wnumber
Optional
1200Image width in pixels (200-4096)
hnumber
Optional
630Image height in pixels (200-4096)
themestring
Optional
lightColor theme: "light" or "dark"

Example Request

curl "https://your-domain.com/api/og?query=google.com&theme=dark" \
  -H "Authorization: Bearer $API_KEY" -o og.png

Preview

Loading…

/api/og?query=google.com

Rate Limiting & Caching

When API_KEY is set, every API request requires Authorization: Bearer <key>. Missing or invalid keys return HTTP 401 with Error 401. Protected responses use private, no-store; server-side Redis caching can still be used. Without API_KEY, the API remains public and lookup responses allow shared caching.

Cached responses include
"cached": true
in the JSON body and report
"time": 0
.

Next Whois v1.6 · GitHub