JSON

Usage

To receive the response in JSON format, send a GET request to

http://ip-api.com/json

You can supply an IP address or domain to lookup, or none to use your current IP address.

Response

A successful request will return, by default, the following:

{
    "status": "success",
    "country": "COUNTRY",
    "countryCode": "COUNTRY CODE",
    "region": "REGION CODE",
    "regionName": "REGION NAME",
    "city": "CITY",
    "zip": "ZIP CODE",
    "lat": LATITUDE,
    "lon": LONGITUDE,
    "timezone": "TIME ZONE",
    "isp": "ISP NAME",
    "org": "ORGANIZATION NAME",
    "as": "AS NUMBER / NAME",
    "query": "IP ADDRESS USED FOR QUERY"
}

List of returned values

A failed request will return, by default, the following:

{
    "status": "fail",
    "message": "ERROR MESSAGE",
    "query": "IP ADDRESS USED FOR QUERY"
}

List of error messages

Selectable return values

Usage limits

Our system will automatically ban any IP addresses doing over 150 requests per minute. To unban your IP click here.

You are free to use ip-api.com for non-commercial use. We do not allow commercial use without prior approval.

For commercial, unlimited use see our pro service.

Callback (JSONP)

By default there is no callback function called, but you can supply your own with the GET parameter callback

Callback Example

Examples

http://ip-api.com/json/208.80.152.201

{
  "status": "success",
  "country": "United States",
  "countryCode": "US",
  "region": "CA",
  "regionName": "California",
  "city": "San Francisco",
  "zip": "94105",
  "lat": "37.7898",
  "lon": "-122.3942",
  "timezone": "America\/Los_Angeles",
  "isp": "Wikimedia Foundation",
  "org": "Wikimedia Foundation",
  "as": "AS14907 Wikimedia US network",
  "query": "208.80.152.201"
}

HTML and jQuery Example

JS Bin

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>IP-API.com Geo Location Demo</title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    </head>
    <body>
        <table id="GeoResults"></table>
        <script>
        $.getJSON("http://ip-api.com/json/?callback=?", function(data) {
            var table_body = "";
            $.each(data, function(k, v) {
                table_body += "<tr><td>" + k + "</td><td><b>" + v + "</b></td></tr>";
            });
            $("#GeoResults").html(table_body);
        });
        </script>
    </body>
</html>