Skip to content
ScanMyPrivacy
Menu

Free IP Address API

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()

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.

PlanRequests / month
Anonymous5 per day, own IP only
Free key1,000
Pro50,000
Business500,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

StatusMeaningWhat to do
200SuccessCache the result for a while.
400invalid_ip: the address is not valid IPv4 or IPv6Validate input before sending it.
401invalid_api_key: the key is not validCheck the X-API-Key header.
429Rate limit or monthly quota reachedWait 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

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.