API Services

Free privacy & security API

Query IP geolocation, DNS, WHOIS, phishing detection, and VPN/proxy signals directly from your own code. No scraping, no browser automation — just JSON.

What the API does

The API gives you programmatic access to five of PrivacyTestLab's diagnostic tools, so you can run the same checks the free browser tools do, but from your own code instead of a browser tab:

  • IP geolocation — country, region, city, ISP, and organization for any public IP address.
  • DNS lookup — A, AAAA, MX, TXT, NS, CNAME, and SOA records for any domain.
  • WHOIS / RDAP — registrar, nameservers, status, and registration dates for a domain.
  • Phishing check — blocklists, domain age, brand spoofing, homograph, and TLS signals for a URL.
  • Proxy / VPN detection — ASN type, DNSBL blacklists, reverse DNS, and Tor exit-node membership for an IP.

How to get access

Getting a working key takes three steps.

First, create an account — with an email and password, or by continuing with Google or GitHub. An email/password account needs a quick email verification before it can generate a key; signing in with Google or GitHub skips that step, since the provider has already verified your address for us.

Second, once you're signed in, generate a key from your dashboard. It's shown to you once — copy it somewhere safe, since we only ever store a one-way hash of it and can't show it to you again after that.

Third, send that key as an X-Api-Key header on any GET request to one of the endpoints below, and you're making live calls.

Authentication

X-Api-Key is the simpler, always-reliable option — some hosts strip the Authorization header before it reaches PHP, so use it if a Bearer request unexpectedly fails.

# header option 1
curl -H "X-Api-Key: ptl_live_your_key_here" \
  "https://privacytestlab.com/api/v1/ip-geolocation"

# header option 2
curl -H "Authorization: Bearer ptl_live_your_key_here" \
  "https://privacytestlab.com/api/v1/ip-geolocation"

We don't support ?api_key= query params — query strings end up in server access logs, browser history, and proxy logs, exactly the kind of exposure a privacy-focused API shouldn't create.

Endpoint reference

Every endpoint below is a read-only GET request and returns the same JSON envelope, whether it succeeds or fails.

GETIP Geolocation
200 OK

Looks up geolocation and network info for an IP address. Defaults to your server's own connection if ip is omitted.

ParamRequiredDescription
ipNoPublic IPv4 or IPv6 address to look up.
$ curl -H "X-Api-Key: ptl_live_..." "/api/v1/ip-geolocation?ip=8.8.8.8"
{
  "success": true,
  "data": {
    "ip": "8.8.8.8",
    "country": "United States",
    "city": "Mountain View",
    "isp": "Google LLC",
    "as": "AS15169 Google LLC"
  }
}
GETDNS Lookup
200 OK

Looks up DNS records for a domain.

ParamRequiredDescription
domainYesThe domain to query.
typeNoOne of A, AAAA, MX, TXT, NS, CNAME, SOA. Default A.
$ curl -H "X-Api-Key: ptl_live_..." "/api/v1/dns-lookup?domain=example.com&type=MX"
{
  "success": true,
  "data": {
    "domain": "example.com",
    "type": "MX",
    "records": [
      { "host": "example.com", "target": "mail.example.com" }
    ]
  }
}
GETWHOIS / RDAP
200 OK

Registration lookup via RDAP, the modern WHOIS replacement. Returns a parsed summary plus the full raw response.

ParamRequiredDescription
domainYesRegistrable domain, not a subdomain.
$ curl -H "X-Api-Key: ptl_live_..." "/api/v1/whois?domain=example.com"
{
  "success": true,
  "data": {
    "registrar": "Example Registrar, Inc.",
    "status": ["client transfer prohibited"],
    "nameservers": ["a.iana-servers.net"]
  }
}
GETPhishing Check
200 OK

Runs the same checks as the free Phishing Link Detector: blocklists, domain age, brand spoofing, homograph/punycode, redirect chain, TLS cert age, login-form detection. Slow endpoint — can take up to ~30s.

ParamRequiredDescription
urlYesFull http:// or https:// URL to check.
$ curl -H "X-Api-Key: ptl_live_..." "/api/v1/phishing-check?url=https://example.com"
{
  "success": true,
  "data": {
    "signals": {
      "blocklist": { "status": "clean" },
      "domain_age": { "status": "clean" }
    }
  }
}
GETProxy / VPN Detect
200 OK

Runs ASN classification, DNSBL blacklist, reverse DNS, and Tor exit-node checks against an IP.

ParamRequiredDescription
ipYesPublic IPv4 or IPv6 address to check.
$ curl -H "X-Api-Key: ptl_live_..." "/api/v1/proxy-vpn-detect?ip=185.220.101.1"
{
  "success": true,
  "data": {
    "geo": { "country_name": "Germany" },
    "signals": {
      "tor": { "detected": true }
    }
  }
}

What's intentionally left out

The IP, DNS, WebRTC, and IPv6 leak tests measure the browser making the request — they run entirely in JavaScript against your own connection. A server-side version of "check my leak" would only ever report the PrivacyTestLab server's own connection, which would be misleading, so those stay browser-only tools. Password generation and strength checking are also excluded: sending a real password over any network, even to a privacy tool, is a step backward for the exact users this site serves.

Errors & rate limits

Every error response follows the same shape:

{ "success": false, "error": { "code": "invalid_key", "message": "..." } }

Error codes

StatusCodeMeaning
400invalid_ip / invalid_domain / invalid_urlA parameter was missing or malformed.
401invalid_keyMissing, invalid, revoked, or unverified-account key.
404domain_not_foundNo registration data found (WHOIS endpoint).
405method_not_allowedOnly GET is supported.
429rate_limitedDaily quota exceeded — see Retry-After header.
502upstream_errorAn upstream data source failed to respond.

Rate-limit headers

Every successful response also carries these headers:

HeaderDescription
X-RateLimit-LimitYour daily quota (100).
X-RateLimit-RemainingRequests left today, across all your keys.
Retry-AfterSeconds until the quota resets (429 responses only).

Pricing

The API is free: 100 requests a day, per account, no credit card, no trial period, no expiration date. Need a higher limit for a production use case? Get in touch.

FAQ

Is the PrivacyTestLab API free?

Yes. Every account gets 100 requests per day at no cost, no credit card required.

How do I authenticate requests?

Send your API key in an X-Api-Key header (or Authorization: Bearer). Query-string keys aren't supported — they leak into server logs.

Why do I need to verify my email before generating a key?

It confirms you actually control the inbox tied to the account, keeping keys tied to a real, reachable owner.

Can I run the leak-test tools through the API?

No. The IP, DNS, WebRTC, and IPv6 leak tests measure the browser making the request, so a server-side version would only report the server's own connection. Those stay browser-only tools.

What happens when I hit the rate limit?

You'll get a 429 response with a Retry-After header telling you how many seconds until the quota resets at 00:00 UTC.

How many API keys can I have?

Up to 3 active keys per account. Your 100/day quota is shared across all of them.