API Documentation

v3.35

Next Whois provides a simple REST API for programmatic WHOIS/RDAP lookups and dynamic OG image generation. All endpoints are publicly accessible and require no authentication.

API Key Auth
Overview

When the administrator enables API Key verification, all public APIs (WHOIS, DNS, SSL, IP lookup) require a valid API Key in the request, otherwise HTTP 401 is returned.

Passing Methods

Request Header (recommended)

curl "https://www.x.rw/api/lookup?query=example.com" \
  -H "X-API-Key: rwh_your_key_here"

URL Query Parameter (fallback)

curl "https://www.x.rw/api/lookup?query=example.com&key=rwh_your_key_here"

Permission Scopes

Scope ValueCovered APIs
apiWHOIS/RDAP, DNS records, SSL certificate, IP/ASN lookup
subscriptionDomain expiry subscription reminder APIs
allAll API features

Error Responses

HTTP StatusReason
401No API Key provided
403Key invalid, disabled, expired or insufficient permissions
WHOIS & Lookup
GET
/api/lookup

Unified lookup endpoint supporting domain WHOIS/RDAP, IPv4, IPv6, ASN (autonomous system), and CIDR subnet — auto-detects input format and routes to the appropriate protocol.

Parameters

ParameterTypeRequiredDefaultDescription
querystring
Required
Query: domain / IPv4 / IPv6 / ASN (e.g. AS15169) / CIDR (e.g. 1.1.1.0/24)

Query Types · Example Requests

Domain (WHOIS / RDAP preferred)

curl "https://www.x.rw/api/lookup?query=google.com"

IPv4 Address

curl "https://www.x.rw/api/lookup?query=8.8.8.8"

IPv6 Address

curl "https://www.x.rw/api/lookup?query=2001:4860:4860::8888"

ASN (Autonomous System Number)

curl "https://www.x.rw/api/lookup?query=AS15169"

CIDR Subnet

curl "https://www.x.rw/api/lookup?query=1.1.1.0/24"

Success Response — Domain Lookup

{
"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
Registry Domain ID: ...",
"rawRdapContent": "{
"objectClassName": "domain",
...
}"
}
}

Success Response — IP / ASN Lookup

{
"status": true,
"time": 0.87,
"cached": false,
"source": "rdap",
"result": {
"domain": "8.8.8.8",
"registrar": "ARIN",
"cidr": "8.8.8.0/24",
"country": "US",
"creationDate": "1992-12-01T00:00:00Z",
"status": [{ "status": "active", "url": "" }],
"nameServers": [],
"rawRdapContent": "..."
}
}

Error Response

{
"status": false,
"time": 0.45,
"error": "No match for domain "EXAMPLE.INVALID""
}

Notes

  • Domain lookup prefers RDAP protocol, falls back to WHOIS on failure; the source field indicates the protocol used
  • Cache hit: cached: true, time: 0; cache TTL: s-maxage=3600
  • IP / ASN / CIDR queries are routed via IANA RDAP bootstrap to the corresponding regional registry (ARIN / RIPE / APNIC etc.)
  • Rate limiting: max 40 requests per IP per minute; exceeding returns HTTP 429
DNS Tools
GET
/api/dns/records

Query any DNS records in parallel via four DoH resolvers (Google, Cloudflare, Quad9, AdGuard), returning deduplicated merged results and per-resolver latency.

Parameters

ParameterTypeRequiredDefaultDescription
namestring
Required
Domain to query, e.g. google.com or _dmarc.google.com
typestring
Optional
ARecord type: A · AAAA · MX · NS · CNAME · TXT · SOA · CAA · SRV

Example Request

curl "https://www.x.rw/api/dns/records?name=google.com&type=MX"
curl "https://www.x.rw/api/dns/records?name=google.com&type=AAAA"
curl "https://www.x.rw/api/dns/records?name=_dmarc.google.com&type=TXT"

Success Response

{
"name": "google.com",
"type": "MX",
"found": true,
"records": [
{ "priority": 10, "exchange": "smtp.google.com" }
],
"flat": ["10 smtp.google.com"],
"resolvers": [
{ "name": "Google DoH", "kind": "doh", "records": [...], "flat": [...], "latencyMs": 42 },
{ "name": "Cloudflare DoH", "kind": "doh", "records": [...], "flat": [...], "latencyMs": 38 },
{ "name": "Quad9 DoH", "kind": "doh", "records": [...], "flat": [...], "latencyMs": 55 },
{ "name": "AdGuard DoH", "kind": "doh", "records": [...], "flat": [...], "latencyMs": 61 }
],
"latencyMs": 63
}

Notes

  • No caching (Cache-Control: no-store), data fetched in real time
  • TXT records return raw values; parse SPF / DMARC / DKIM / BIMI yourself
  • Record not found: found: false, flat: []
  • Single resolver timeout: 7s, four run in parallel, overall usually completes in 1–2s
GET
/api/dns/txt

Dedicated TXT record query, using four standard DNS resolvers (Google, Cloudflare, Quad9, OpenDNS) in parallel — ideal for verifying SPF, DMARC, DKIM and other email security configurations.

Parameters

ParameterTypeRequiredDefaultDescription
namestring
Required
Domain or subdomain to query, e.g. google.com or _dmarc.example.com

Example Request

# 查询 SPF 记录
curl "https://www.x.rw/api/dns/txt?name=google.com"
# 查询 DMARC 记录
curl "https://www.x.rw/api/dns/txt?name=_dmarc.google.com"
# 查询 DKIM 记录
curl "https://www.x.rw/api/dns/txt?name=google._domainkey.gmail.com"

Success Response

{
"name": "google.com",
"found": true,
"records": [
["v=spf1 include:_spf.google.com ~all"],
["docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"],
["globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="]
],
"flat": [
"v=spf1 include:_spf.google.com ~all",
"docusign=1b0a6754-49b1-4db5-8540-d2c12664b289",
"globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
],
"resolvers": [
{ "name": "Google DNS", "records": [...], "flat": [...], "latencyMs": 18 },
{ "name": "Cloudflare", "records": [...], "flat": [...], "latencyMs": 15 },
{ "name": "Quad9", "records": [...], "flat": [...], "latencyMs": 23 },
{ "name": "OpenDNS", "records": [...], "flat": [...], "latencyMs": 31 }
],
"latencyMs": 35
}

Error Response / Not found

{
"name": "_dmarc.example.invalid",
"found": false,
"records": [],
"flat": [],
"resolvers": [...],
"latencyMs": 42,
"error": "ENOTFOUND"
}

Differences from /api/dns/records?type=TXT

Feature/api/dns/txt/api/dns/records?type=TXT
Resolution ProtocolStandard DNS (UDP/TCP)DoH (HTTPS-encapsulated)
Resolvers8.8.8.8 / 1.1.1.1 / 9.9.9.9 / 208.67.222.222Google / Cloudflare / Quad9 / AdGuard DoH
Use CaseEmail security verification (SPF/DMARC/DKIM)General DNS record queries, supports more types
SSL Certificate
GET
/api/ssl/cert

Connects directly to the target host (default port 443), performs a TLS handshake and returns SSL certificate details: validity period, issuer, SAN list, certificate chain, cipher suites, and days remaining.

Parameters

ParameterTypeRequiredDefaultDescription
hostnamestring
Required
Target hostname or IP, e.g. google.com, github.com or 1.1.1.1
portnumber
Optional
443Target TLS port (default 443, SMTPS uses 465, IMAPS uses 993, etc.)

Example Request

curl "https://www.x.rw/api/ssl/cert?hostname=github.com"
# 检测非标准端口
curl "https://www.x.rw/api/ssl/cert?hostname=mail.example.com&port=465"

Success Response

{
"ok": true,
"hostname": "github.com",
"port": 443,
"authorized": true,
"authError": null,
"protocol": "TLSv1.3",
"cipher": "TLS_AES_128_GCM_SHA256",
"subject": { "CN": "github.com", "O": "GitHub, Inc.", "C": "US" },
"issuer": { "CN": "DigiCert TLS Hybrid ECC SHA384 2020 CA1", "O": "DigiCert Inc" },
"valid_from": "2024-03-07T00:00:00.000Z",
"valid_to": "2025-03-07T23:59:59.000Z",
"days_remaining": 120,
"is_expired": false,
"is_expiring_soon": false,
"fingerprint256": "AA:BB:CC:...",
"serialNumber": "0A:1B:2C:...",
"sans": [
{ "type": "DNS", "value": "github.com" },
{ "type": "DNS", "value": "www.github.com" }
],
"chain": [
{ "subject": "CN=DigiCert...", "issuer": "CN=...", "valid_to": "..." }
],
"latencyMs": 185
}

Error Response

{
"ok": false,
"hostname": "expired.badssl.com",
"port": 443,
"authorized": false,
"authError": "certificate has expired",
"error": "certificate has expired",
"latencyMs": 210
}

Notes

  • Certificate chain includes complete intermediate CA info from server to root CA
  • Connection timeout: 10s; unreachable hosts return ok: false + error field
IP & ASN Lookup
GET
/api/ip/lookup

Queries IP geolocation, ASN, ISP, organization, and routing information for IPv4/IPv6 addresses or ASN numbers.

Parameters

ParameterTypeRequiredDefaultDescription
qstring
Required
IPv4 address, IPv6 address, or ASN number (e.g. 8.8.8.8, 2001:db8::1, AS15169)

Example Request

# IPv4 地址
curl "https://www.x.rw/api/ip/lookup?q=8.8.8.8"
# IPv6 地址
curl "https://www.x.rw/api/ip/lookup?q=2001:4860:4860::8888"
# 主机名(自动解析为 IP 再查询)
curl "https://www.x.rw/api/ip/lookup?q=dns.google"
# ASN 归属网段
curl "https://www.x.rw/api/ip/lookup?q=AS15169"

Success Response

{
"type": "ipv4",
"query": "8.8.8.8",
"resolvedFrom": null,
"flag": "🇺🇸",
"country": "United States",
"countryCode": "US",
"region": "California",
"city": "Mountain View",
"timezone": "America/Los_Angeles",
"offset": -28800,
"lat": 37.4056,
"lon": -122.0775,
"isp": "Google LLC",
"org": "AS15169 Google LLC",
"as": "AS15169 Google LLC",
"asname": "GOOGLE",
"reverse": "dns.google",
"mobile": false,
"proxy": false,
"hosting": true,
"rdap": {
"name": "GOGL",
"handle": "NET-8-8-8-0-1",
"startAddress": "8.8.8.0",
"endAddress": "8.8.8.255",
"ipVersion": "v4",
"contact_org": "Google LLC"
}
}

Notes

  • Geolocation data from MaxMind GeoLite2, ASN data from routeviews
  • ASN query returns all prefixes announced by the AS
  • Private IP addresses and reserved ranges return limited information
  • Cache TTL: s-maxage=86400 (24h)
Tools API
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://www.x.rw/api/og?query=google.com&theme=dark" -o og.png
# 自定义尺寸(适合 Twitter Card)
curl "https://www.x.rw/api/og?query=example.com&w=1200&h=600" -o card.png

Preview

OG Image Preview

/api/og?query=google.com

ICP Filing Query
GET
/api/icp/query

Query ICP filing records for Chinese mainland websites and apps. Supports domain lookup, app/mini-program filing, and blacklist queries.

Parameters

ParameterTypeRequiredDefaultDescription
typestring
Required
Query type
searchstring
Required
Domain name or ICP number to query
pageNumnumber
Optional
1Page number (default 1)
pageSizenumber
Optional
10Page number (default 1)

Query Type Reference

typeDescriptionParameter
webWebsiteNormal Filing
appAPPNormal Filing
mappMini ProgramNormal Filing
kappQuick AppNormal Filing
bwebIllegal WebsiteBlacklist
bappIllegal APPBlacklist
bmappIllegal Mini ProgramBlacklist
bkappIllegal Quick AppBlacklist

Example Request

Domain (WHOIS / RDAP preferred)

curl "https://www.x.rw/api/icp/query?type=web&search=baidu.com"

Domain name or ICP number to query

curl "https://www.x.rw/api/icp/query?type=web&search=京ICP证030173号"

Unit name

curl "https://www.x.rw/api/icp/query?type=web&search=深圳市腾讯计算机系统有限公司&pageNum=2&pageSize=20"

Illegal APP

curl "https://www.x.rw/api/icp/query?type=bapp&search=example"

Success Response

{
"ok": true,
"type": "web",
"search": "baidu.com",
"pageNum": 1,
"pageSize": 10,
"total": 1,
"pages": 1,
"list": [
{
"domain": "baidu.com",
"domainId": "12345678",
"limitAccess": false,
"mainLicence": "京ICP证030173号",
"natureName": "企业",
"serviceLicence": "京ICP备030173号",
"unitName": "北京百度网讯科技有限公司",
"updateRecordTime": "2023-09-01",
"contentTypeName": "信息服务",
"mainUnitAddress": "北京市海淀区上地十街10号",
"cityId": "110100",
"countyId": "110108"
}
]
}

Response Fields

ParameterDescription
total / pagesTotal records / total pages
domainFiled domain
domainIdDomain ID
limitAccessWhether access is restricted
mainLicenceICP mainLicence
serviceLicenceICP serviceLicence
natureNameUnit type (company / institution / individual etc.)
unitNameUnit name
updateRecordTimeApproval date
contentTypeNameService pre-approval items / content type
mainUnitAddressMain address
serviceNameService name (APP, mini-program, or quick app name)
versionService version
blackListLevelThreat level (only for violation types; value 2 = no current violation)

Notes

  • ICP data from MIIT (Ministry of Industry and Information Technology) official API
  • Blacklist queries (types starting with b) require special permissions
  • Results are paginated; use the page parameter to fetch additional pages
Rate Limiting & Caching
API EndpointRate Limit RuleCache
/api/lookup40 req/IP/min (sliding window)s-maxage=3600
/api/dns/records60 req/IP/minno-store
/api/dns/txt60 req/IP/minno-store
/api/ssl/cert20 req/IP/minno-store
/api/ip/lookup30 req/IP/minno-store
/api/icp/queryUnlimitedno-store
/api/ogUnlimiteds-maxage=86400

When /api/lookup hits cache: cached: true and time: 0. Exceeding limit returns HTTP 429 with X-RateLimit-Limit / Remaining / Reset headers.

X.RW v3.35 · GitHub