Batch JSON

Batch processing gives you the ability to query multiple IP addresses in one HTTP request.
This is significantly faster than submitting individual queries.

Usage

A batch request can be submitted as a POST request to

http://ip-api.com/batch

You should supply a valid JSON array, containing up to 100 objects.
HTTP Error 422 will be returned for requests containing more than the beforementioned amount.

Note: this mode does not support hostname/domain or rDNS lookups.

Request

A request needs to formatted as a JSON array, with objects containing the following:

{
    "query": "required, string IPv4/IPv6",
    "fields": "optional, string/int fields to return",
    "lang": "optional, string language for localization"
}

You can also supply default values for fields and lang in the GET parameters. Setting them individually, as shown above, will override the defaults.

Response

A successful request will return a JSON array, with each object containing, 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

You can supply up to 100 queries per batch request.

Our system will automatically ban any IP addresses doing over 150 HTTP 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.

Examples

HTML and jQuery

http://jsfiddle.net/k1x9p03v/

cURL

curl ip-api.com/batch --data '[{"query": "208.80.152.201"}, {"query": "91.198.174.192"}]'

[
    {
        "as": "AS14907 Wikimedia Foundation Inc.",
        "city": "San Francisco",
        "country": "United States",
        "countryCode": "US",
        "isp": "Wikimedia Foundation",
        "lat": 37.7898,
        "lon": -122.3942,
        "org": "Wikimedia Foundation",
        "query": "208.80.152.201",
        "region": "CA",
        "regionName": "California",
        "status": "success",
        "timezone": "America/Los_Angeles",
        "zip": "94105"
    },
    {
        "as": "AS43821 Wikimedia Foundation, Inc.",
        "city": "Middelburg",
        "country": "Netherlands",
        "countryCode": "NL",
        "isp": "Wikimedia Foundation",
        "lat": 51.4988,
        "lon": 3.611,
        "org": "Wikimedia Foundation",
        "query": "91.198.174.192",
        "region": "ZE",
        "regionName": "Provincie Zeeland",
        "status": "success",
        "timezone": "Europe/Amsterdam",
        "zip": ""
    }
]

Request country for 208.80.152.201, lat and lon for 91.198.174.192, and ISP (set via the GET parameter fields) for every other query:

curl ip-api.com/batch?fields=isp \
--data '[{"query": "208.80.152.201", "fields": "country"}, {"query": "91.198.174.192", "fields": "lat,lon"}, {"query": "8.8.8.8"}]'

[
    {
        "country": "United States"
    },
    {
        "lat": 51.4988,
        "lon": 3.611
    },
    {
        "isp": "Google"
    }
]