Batch Lookup Endpoint

Looks up to 100 IPv4 or IPv6 addresses in one request and returns the same data as the info endpoint for each, keyed by address.

Use it to enrich logs, sign-up lists or analytics exports without sending one request per address.


POST/v2/batch

Batch Lookup

Send the addresses as a JSON array in the request body. For quick tests the same lookup also works as GET /v2/batch?ips=1.1.1.1,8.8.8.8.

Required attributes

  • Name
    ips
    Type
    array
    Description

    1 to 100 IPv4 or IPv6 addresses. Any invalid address rejects the whole request with a 422 that names it (e.g. ips.1).

Optional attributes

  • Name
    language
    Type
    string
    Description

    Language for translated location names: de, en, es, fr, ja, pt, ru, zh (default: en).

  • Name
    fields
    Type
    string
    Description

    Comma-separated dot paths to return for every address instead of the full object, e.g. ip,location.country.alpha2,security.is_vpn.

Response

data maps every requested address to the same object /v2/info returns, limited to the data your plan includes. Private and reserved addresses (e.g. 10.0.0.1) do not fail the batch; they come back with their range_type and without location data.

Reverse DNS (hostname) is not available in batches, since a hundred PTR lookups would make the response slow. Use the info endpoint with hostname=1 for single addresses.

Request

POST
/v2/batch
curl https://api.ipbase.com/v2/batch \
    -H "apikey: YOUR-API-KEY" \
    -H "Content-Type: application/json" \
    -d '{"ips": ["1.1.1.1", "8.8.8.8"]}' \
    --url-query "fields=ip,location.country.alpha2,connection.asn"

Response

{
    "data": {
        "1.1.1.1": {
            "ip": "1.1.1.1",
            "connection": {
                "asn": 13335
            },
            "location": {
                "country": {
                    "alpha2": "US"
                }
            }
        },
        "8.8.8.8": {
            "ip": "8.8.8.8",
            "connection": {
                "asn": 15169
            },
            "location": {
                "country": {
                    "alpha2": "US"
                }
            }
        }
    }
}