Developers

Use ipinfo.io to quickly and simply integrate IP geolocation into your script or website. Save yourself the hassle of setting up local GeoIP libraries and having to remember to regularly update the data.

Full IP Details

When called from the command line or a script we will return a JSON response with all of the IP details that you see on the website. You can pass in the IP you're interested in, or ommit it to get details about your own IP.

$ curl ipinfo.io/8.8.8.8{  "ip": "8.8.8.8",  "hostname": "google-public-dns-a.google.com",  "loc": "37.385999999999996,-122.0838",  "org": "AS15169 Google Inc.",  "city": "Mountain View",  "region": "California",  "country": "US",  "phone": 650}

We do a little bit of magic on the server to determine if we should send the JSON response or the webpage. We usually get it right, but if you're seeing the webpage instead of the JSON (or want to check the JSON output in a browser) you can force the JSON response by adding /json to the end of the URL, eg:

http://ipinfo.io/json for your own IP

http://ipinfo.io/8.8.8.8/json for details on another IP

Specific Fields

If you're only interested in specific details you can add a field to get a plain text response that includes just the field you're after.

$ curl ipinfo.io/8.8.8.8/orgAS15169 Google Inc.
$ curl ipinfo.io/8.8.8.8/cityMountain View

JSONP

JSONP is also supported, which allows you to use ipinfo.io entirely in client-sde code. You just need to specify the callback parameter, eg. http://ipinfo.io/?callback=callback. Most javascript libraries will automatically handle this for you though. Here's a jQuery example that logs the client IP and country:

$.get("http://ipinfo.io", function(response) {    console.log(response.ip, response.country);}, "jsonp");

Additional IP information

We can provide additional information and services on a paid basis, including proxy detection, scraping prevention, and improved geolocation accuracy. Contact us for more details.

Terms of use

This is all provided as-is, with no guarantees on availability or accuracy of the results. We'll certainly do our best to make the service highly-available though, and the results accurate. You can use it for any purpose. Attibution is not required, but is appreciated.