Two APIs: a free, keyless endpoint that returns your own IP address, and a keyed lookup API with location, network and privacy data.
Use it in scripts
The shortest version, for shell scripts, cron jobs, READMEs and quick checks:
curl https://scanmyprivacy.com/api/ip
# 203.0.113.7
curl "https://scanmyprivacy.com/api/ip?format=json"
# {"ip":"203.0.113.7","version":4}
# Windows PowerShell
(Invoke-RestMethod https://scanmyprivacy.com/api/ip).Trim()
- No key and no signup. CORS is open, so it also works from browser code.
- The limit is 120 requests per minute per network. Cache the result rather than calling on every run.
- We do not log visitor IP addresses. See the privacy policy.
- You do not need to credit us, though a link is always appreciated.
- For location, network owner and VPN likelihood for any address, use the keyed lookup API below.
Get your public IP (free, no key)
curl https://scanmyprivacy.com/api/ip
203.0.113.7
curl "https://scanmyprivacy.com/api/ip?format=json"
{"ip":"203.0.113.7","version":4}
Plain text by default, JSON with ?format=json. CORS is open, so you can call it from browser code. The limit is 120 requests per minute per network; over that you receive 429 with a Retry-After header. We do not log the addresses we return.
Force IPv4 or IPv6
If the dual-stack hostnames are enabled on this deployment, ipv4.scanmyprivacy.com only has an IPv4 address and ipv6.scanmyprivacy.com only an IPv6 one, so these return a specific family:
curl https://ipv4.scanmyprivacy.com/api/ip
curl https://ipv6.scanmyprivacy.com/api/ip
Examples
# Python
import requests
ip = requests.get("https://scanmyprivacy.com/api/ip", timeout=5).text.strip()
// JavaScript
const { ip } = await (await fetch("https://scanmyprivacy.com/api/ip?format=json")).json();
# Shell
MYIP=$(curl -s https://scanmyprivacy.com/api/ip)
Lookup API (API key)
curl -H "x-api-key: YOUR_KEY" \
"https://scanmyprivacy.com/api/v1/lookup?ip=8.8.8.8"
Returns location, network (ISP, ASN, VPN likelihood) and a privacy score for any public address. Pass the key in X-API-Key, as Authorization: Bearer, or ?api_key=. Without a key you may look up only your own address, a handful of times per day.
| Plan | Requests / month |
|---|---|
| Anonymous | 5 per day, own IP only |
| Free key | 1,000 |
| Pro | 50,000 |
| Business | 500,000 |
Responses include X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers. Request a key.
Example response
A lookup returns these top-level objects (values shortened):
{
"ip": "8.8.8.8",
"version": 4,
"location": { "country": "United States", "countryCode": "US", "region": "California", "city": "San Francisco", "timezone": "America/Los_Angeles" },
"network": { "isp": "...", "asn": "AS64500", "vpnLikely": false, "vpnConfidence": "low", "vpnBasis": "..." },
"privacy": { "score": 35, "level": "exposed", "factors": [ ... ], "method": { "kind": "heuristic", ... } }
}
Treat location.city as approximate and network.vpnLikely as an inference, not a fact. The method object states exactly how the score was produced.
Errors and status codes
| Status | Meaning | What to do |
|---|---|---|
200 | Success | Cache the result for a while. |
400 | invalid_ip: the address is not valid IPv4 or IPv6 | Validate input before sending it. |
401 | invalid_api_key: the key is not valid | Check the X-API-Key header. |
429 | Rate limit or monthly quota reached | Wait until the time in X-RateLimit-Reset, or request a higher plan. |
Errors are JSON with an error code and a human-readable message.
Good practice
- Cache results per address for hours, not seconds. Addresses rarely change owner that fast.
- Do not send the visitor's address from the browser if your server already knows it; look it up once on your side.
- Use the free
/api/ipendpoint when you only need your own address, and keep the keyed API for other addresses. - Combine results with other signals. See the methodology page for the limits of IP-based inference.
Fair use
Please cache results, set a descriptive User-Agent and do not poll more often than you need. IP geolocation is approximate. See the terms of use.
Privacy score fields
The privacy object includes vpnConfidence (none, low or medium), vpnBasis (a sentence explaining the inference) and method (how the score is computed). VPN detection is inferred from the network name and may be wrong in either direction. Labels read "High", "Some" or "Low exposure observed". See the methodology. Plans and quotas are on the API pricing page.