Trust2API

WHOIS/RDAP API

Programmatic WHOIS and RDAP lookups for domains and IP addresses.

Project Description: Whois Info API (via RapidAPI)

The Whois Info API provides domain intelligence endpoints (WHOIS, RDAP, SSL info, TLD utilities, and domain availability checks) accessible through RapidAPI. Use it to validate domains, inspect registrar data, and programmatically analyze domain metadata.

How It Works

  • Your application sends HTTPS requests to the RapidAPI gateway.
  • RapidAPI forwards the request to the backend service and returns the response.
  • You authenticate with your RapidAPI key in headers; RapidAPI routes requests using the provided host header.

Base URL

  • https://whois-info-api.p.rapidapi.com

Authentication

Include the following headers in every request:

  • X-RapidAPI-Key: your RapidAPI key (string)
  • x-rapidapi-host: whois-info-api.p.rapidapi.com
  • Accept: application/json

Note: Calling the backend directly (not via RapidAPI) uses X-Api-Key, but the recommended path is via RapidAPI with X-RapidAPI-Key.

Available Endpoints

  1. WHOIS Query
  • GET /query?domain={domain}
  • POST /query with JSON body: {"domain":"example.com"}
  1. RDAP Query
  • GET /rdap?domain={domain}
  • POST /rdap with JSON body: {"domain":"example.com"}
  1. Domain Check
  • POST /check with JSON body: {"domain":"example.com"}
  • Optional v2:
    • GET /v2/check?domain={domain}
    • POST /v2/check with JSON body: {"domain":"example.com"}
  1. SSL Info
  • GET /ssl?domain={domain}
  1. TLD Utilities
  • GET /tld
  • POST /tld with JSON body: {"domain":"example.com"}

Typical Use Cases

  • Validate if a domain is registered or available.
  • Retrieve registrar, name servers, and WHOIS contacts.
  • Pull RDAP records for structured domain/registry data.
  • Inspect SSL details for a domain.
  • Explore supported TLDs and TLD-specific handling.

Quick Start

  1. Create a RapidAPI account and subscribe to the "Whois Info API".
  2. Get your X-RapidAPI-Key from the RapidAPI dashboard.
  3. Make a test call with your preferred HTTP client using the base URL and headers below.

Request Examples

  • cURL (WHOIS GET):
curl -s \
  -H "Accept: application/json" \
  -H "x-rapidapi-host: whois-info-api.p.rapidapi.com" \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  "https://whois-info-api.p.rapidapi.com/query?domain=trust2api.com"
  • cURL (RDAP POST):
curl -s -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "x-rapidapi-host: whois-info-api.p.rapidapi.com" \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -d '{"domain":"trust2api.com"}' \
  "https://whois-info-api.p.rapidapi.com/rdap"
  • JavaScript (fetch):
const res = await fetch("https://whois-info-api.p.rapidapi.com/query?domain=trust2api.com", {
  headers: {
    "Accept": "application/json",
    "x-rapidapi-host": "whois-info-api.p.rapidapi.com",
    "X-RapidAPI-Key": process.env.RAPIDAPI_KEY
  }
});
const data = await res.json();
console.log(data);
  • Python (requests):
import os, requests

url = "https://whois-info-api.p.rapidapi.com/check"
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "x-rapidapi-host": "whois-info-api.p.rapidapi.com",
    "X-RapidAPI-Key": os.environ.get("RAPIDAPI_KEY", "")
}
resp = requests.post(url, json={"domain":"trust2api.com"}, headers=headers)
print(resp.status_code)
print(resp.json())

Sample Responses

  • WHOIS example:
{
  "id": "2910922969_DOMAIN_COM-VRSN",
  "domain": "TRUST2API.COM",
  "name_servers": ["igor.ns.cloudflare.com", "roxy.ns.cloudflare.com"],
  "whois_server": "whois.cloudflare.com",
  "registrar": {"id": "1910", "name": "Cloudflare, Inc.", "url": "https://www.cloudflare.com"},
  "ip_addresses": null,
  "dns_sec": "signedDelegation",
  "contacts": {"admin": {}, "tech": {}, "owner": {}, "billing": {}}
}
  • Domain Check example:
{
  "domain": "trust2api.com",
  "taken": true,
  "register_date": "2024-08-25T16:28:50Z",
  "last_update": "2024-08-25T16:28:53Z"
}

Errors and Status Codes

  • 400 Bad Request: Missing or invalid domain.
  • 401 Unauthorized: Invalid/missing key.
  • 429 Too Many Requests: Rate limit exceeded.

Example error body:

{"message": "validation error", "status": false}

Rate Limiting

  • RapidAPI applies plan-based request limits.
  • The service enforces basic per-IP throttling. If you get 429, back off and retry (e.g., exponential backoff: 1s, 2s, 4s...).

Best Practices

  • Validate domain format before calling the API.
  • For automation or bulk checks, prefer POST and send one domain per request.
  • Cache results where appropriate to reduce repeated lookups.
  • Include a unique X-Request-Id in requests if you need traceability across logs.

Troubleshooting

  • 401 Unauthorized: Ensure your RapidAPI subscription is active and X-RapidAPI-Key is present.
  • 400 Bad Request: Provide a valid domain like example.com.
  • 429 Too Many Requests: Slow down; add retries with jitter/backoff.
  • Support: Use your RapidAPI dashboard to contact the API provider or open a GitHub issue if available.

Summary

Use the base URL https://whois-info-api.p.rapidapi.com with headers X-RapidAPI-Key and x-rapidapi-host: whois-info-api.p.rapidapi.com. Call the endpoints listed above to retrieve WHOIS, RDAP, SSL, and domain availability data. Implement client-side validation, error handling, and retry logic to build a robust integration.