whoami
Your public IP address, location and network.
curl whoami.upset.dev
fetching…
API
In a terminal you get readable text. Ask for JSON with the accept header.
curl https://whoami.upset.devconst res = await fetch("https://whoami.upset.dev", {
headers: { accept: "application/json" },
});
const { ip, city, country, org } = await res.json();import requests
me = requests.get(
"https://whoami.upset.dev",
headers={"accept": "application/json"},
).json()
print(me["ip"], me["country"])Questions
- Where does the location come from?
- MaxMind GeoLite2. The country is usually right. The city often isn't, especially on mobile data.
- Does it work behind a proxy or CDN?
- Yes. It reads CF-Connecting-IP, X-Forwarded-For and X-Real-IP, in that order.
- Is the API free?
- Yes, with no sign-up. You can call it from any website. Rate limits may apply.