IPCub API
Free. No key, no sign-up. Plain text by default.
Your own IP
curl ipcub.com # just the IP
curl ipcub.com/json # IP, location, ISP, ASN, time zone
curl ipcub.com/country # two-letter country code, e.g. US
curl ipcub.com/city
curl ipcub.com/asn # e.g. AS15169
curl ipcub.com/org # your ISP or organization
Want a specific IP version? Force it with curl -4 ipcub.com or curl -6 ipcub.com.
Look up any IP
curl ipcub.com/ip/8.8.8.8/json
{
"ip": "8.8.8.8",
"version": "IPv4",
"hostname": "dns.google",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4056,-122.0775",
"asn": "AS15169",
"org": "Google LLC"
}
Fields with no data are left out. Private and reserved addresses return a reserved field instead of a location.
Fair use
CORS is open, so you can call it from a web page. Please keep it reasonable: a few requests a minute is fine; if you need bulk lookups, download the free DB-IP Lite database instead.
Where the data comes from
Your own location comes from Cloudflare, which serves this site. Lookups of other IPs use DB-IP Lite (CC BY 4.0), refreshed monthly. Hostnames come from public reverse DNS.