Advanced Usage
Bulk/Batch API
Our /batch
API endpoint allows you to group up to 1,000 IPinfo API requests into a single request. This can significantly speed up the processing of bulk IP lookups, and it is also useful if you want to look up information across our different APIs.
Batch URL endpoints
The /batch
API endpoint is available in both the legacy (ipinfo.io
) and updated (api.ipinfo.io
) API services.
For the updated API system the batch API endpoint is available at:
api.ipinfo.io/batch
The default API endpoint (api.ipinfo.io/batch
) inherently supports the /lookup
endpoint to query IP addresses, meaning that you do not have to prefix your IP address with /lookup
. If you want to use lite
, resproxy
, or another API endpoint, please use the URL patterns method described in the next section.
api.ipinfo.io/batch/lite
- Explicitly for the lite
API endpoint. When using this API endpoint, you do not need to prefix lite/
to IP addresses. Lite calls can be added to the legacy API ipinfo.io/batch
requests as well. Please note that the /lookup
API is dedicated to our paid tier API service. Therefore, if you are on the free tier and use the default bulk API endpoint (api.ipinfo.io/batch
), you will encounter an error. For this reason, we recommend our free tier users use: api.ipinfo.io/batch/lite
.
The Bulk or Batch API works identically with the legacy API endpoint (ipinfo.io
) at the following API endpoint:
https://ipinfo.io/batch?token=$TOKEN
Why URL patterns?
We provide different types of IP data services through various API endpoints like lite
, general IP information lookup (lookup
), resproxy
, etc. Additionally, users may not need the full API response payload; they might only need specific information from the API response, such as /country
, /city
, asn
, etc. To support a diverse set of inputs and outputs, our batch API endpoint supports URL patterns.
115.227.65.62
lookup/71.181.13.80
lite/157.47.66.225
lookup/74.75.228.56/anonymous
lite/23.1.118.150/country_code
resproxy/164.53.56.110
Usage
The /batch
endpoint accepts a list of IPs or URL patterns and returns a JSON object with the inputs as keys and the responses as values. The list of IPs can be provided as a newline-separated list of URLs, a space-separated list, or as a JSON array object. Below are examples of each approach, as well as the corresponding content-type headers required.
JSON Array
curl -XPOST --data '["lite/8.8.4.4", "lite/8.8.4.4/country", "8.8.4.4/anonymous", "1.1.1.1"]' \
"api.ipinfo.io/batch?token=$TOKEN"
{
"lite/8.8.4.4/country": "United States",
"lite/8.8.4.4": {
"ip": "8.8.4.4",
"asn": "AS15169",
"as_name": "Google LLC",
"as_domain": "google.com",
"country_code": "US",
"country": "United States",
"continent_code": "NA",
"continent": "North America"
},
"8.8.4.4/anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"1.1.1.1": {
"ip": "1.1.1.1",
"hostname": "one.one.one.one",
"geo": {
"city": "Brisbane",
"region": "Queensland",
"region_code": "QLD",
"country": "Australia",
"country_code": "AU",
"continent": "Oceania",
"continent_code": "OC",
"latitude": -27.48159,
"longitude": 153.0175,
"timezone": "Australia/Brisbane",
"postal_code": "4101",
"geoname_id": "2174003",
"radius": 10,
"last_changed": "2024-10-20"
},
"as": {
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"type": "hosting",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": true,
"is_hosting": true,
"is_mobile": false,
"is_satellite": false
}
}
Newline-separated list of IPs
echo -e "lite/8.8.4.4\nlite/8.8.4.4/country\n8.8.4.4/anonymous\n1.1.1.1" | \
curl -X POST \
--data-binary @- "https://api.ipinfo.io/batch?token=$TOKEN"
{
"lite/8.8.4.4/country": "United States",
"lite/8.8.4.4": {
"ip": "8.8.4.4",
"asn": "AS15169",
"as_name": "Google LLC",
"as_domain": "google.com",
"country_code": "US",
"country": "United States",
"continent_code": "NA",
"continent": "North America"
},
"1.1.1.1": {
"ip": "1.1.1.1",
"hostname": "one.one.one.one",
"geo": {
"city": "Brisbane",
"region": "Queensland",
"region_code": "QLD",
"country": "Australia",
"country_code": "AU",
"continent": "Oceania",
"continent_code": "OC",
"latitude": -27.48159,
"longitude": 153.0175,
"timezone": "Australia/Brisbane",
"postal_code": "4101",
"geoname_id": "2174003",
"radius": 10,
"last_changed": "2024-10-20"
},
"as": {
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"type": "hosting",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": true,
"is_hosting": true,
"is_mobile": false,
"is_satellite": false
},
"8.8.4.4/anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
}
}
Space-separated list of IPs
curl --request POST --url https://api.ipinfo.io/batch?token=$TOKEN \
--header 'Content-Type: text/plain' \
--data 'lite/8.8.4.4 lite/8.8.4.4/country 8.8.4.4/anonymous 1.1.1.1'
{
"lite/8.8.4.4": {
"ip": "8.8.4.4",
"asn": "AS15169",
"as_name": "Google LLC",
"as_domain": "google.com",
"country_code": "US",
"country": "United States",
"continent_code": "NA",
"continent": "North America"
},
"8.8.4.4/anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"1.1.1.1": {
"ip": "1.1.1.1",
"hostname": "one.one.one.one",
"geo": {
"city": "Brisbane",
"region": "Queensland",
"region_code": "QLD",
"country": "Australia",
"country_code": "AU",
"continent": "Oceania",
"continent_code": "OC",
"latitude": -27.48159,
"longitude": 153.0175,
"timezone": "Australia/Brisbane",
"postal_code": "4101",
"geoname_id": "2174003",
"radius": 10,
"last_changed": "2024-10-20"
},
"as": {
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"type": "hosting",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": true,
"is_hosting": true,
"is_mobile": false,
"is_satellite": false
},
"lite/8.8.4.4/country": "United States"
}
List of IP addresses
$ cat ips.txt
58.155.106.199
102.158.180.80
76.185.163.245
cat ips.txt | curl -XPOST --data-binary @- https://api.ipinfo.io/batch?token=$TOKEN
{
"58.155.106.199": {
"ip": "58.155.106.199",
"geo": {
"city": "Haidian",
"region": "Beijing",
"region_code": "BJ",
"country": "China",
"country_code": "CN",
"continent": "Asia",
"continent_code": "AS",
"latitude": 39.99064,
"longitude": 116.28868,
"timezone": "Asia/Shanghai",
"postal_code": "100000",
"geoname_id": "1809104",
"radius": 100,
"last_changed": "2025-08-03"
},
"as": {
"asn": "AS4538",
"name": "China Education and Research Network Center",
"domain": "cernet.edu.cn",
"type": "education",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": false,
"is_hosting": false,
"is_mobile": false,
"is_satellite": false
},
"102.158.180.80": {
"ip": "102.158.180.80",
"geo": {
"city": "Tunis",
"region": "Tunis Governorate",
"region_code": "11",
"country": "Tunisia",
"country_code": "TN",
"continent": "Africa",
"continent_code": "AF",
"latitude": 36.81897,
"longitude": 10.16579,
"timezone": "Africa/Tunis",
"geoname_id": "2464470",
"radius": 50
},
"as": {
"asn": "AS37705",
"name": "TOPNET",
"domain": "topnet.tn",
"type": "isp",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": false,
"is_hosting": false,
"is_mobile": false,
"is_satellite": false
},
"76.185.163.245": {
"ip": "76.185.163.245",
"hostname": "syn-076-185-163-245.res.spectrum.com",
"geo": {
"city": "San Antonio",
"region": "Texas",
"region_code": "TX",
"country": "United States",
"country_code": "US",
"continent": "North America",
"continent_code": "NA",
"latitude": 29.4275,
"longitude": -98.4601,
"timezone": "America/Chicago",
"postal_code": "78202",
"dma_code": "641",
"geoname_id": "4726206",
"radius": 10
},
"as": {
"asn": "AS11427",
"name": "Charter Communications Inc",
"domain": "charter.com",
"type": "isp",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": false,
"is_hosting": false,
"is_mobile": false,
"is_satellite": false
}
}
You can also use the Lite API-based bulk enrichment for all these applications.
cat ips.txt | curl -XPOST --data-binary @- https://api.ipinfo.io/batch/lite?token=$TOKEN
{
"76.185.163.245": {
"ip": "76.185.163.245",
"asn": "AS11427",
"as_name": "Charter Communications Inc",
"as_domain": "charter.com",
"country_code": "US",
"country": "United States",
"continent_code": "NA",
"continent": "North America"
},
"102.158.180.80": {
"ip": "102.158.180.80",
"asn": "AS37705",
"as_name": "TOPNET",
"as_domain": "topnet.tn",
"country_code": "TN",
"country": "Tunisia",
"continent_code": "AF",
"continent": "Africa"
},
"58.155.106.199": {
"ip": "58.155.106.199",
"asn": "AS4538",
"as_name": "China Education and Research Network Center",
"as_domain": "cernet.edu.cn",
"country_code": "CN",
"country": "China",
"continent_code": "AS",
"continent": "Asia"
}
}
URL Patterns
$ cat ip_urls.txt
8.8.4.4/anonymous
1.1.1.1
lite/8.8.4.4
lite/8.8.4.4/country
cat ip_urls.txt | curl -XPOST --data-binary @- https://api.ipinfo.io/batch?token=$TOKEN
{
"1.1.1.1": {
"ip": "1.1.1.1",
"hostname": "one.one.one.one",
"geo": {
"city": "Brisbane",
"region": "Queensland",
"region_code": "QLD",
"country": "Australia",
"country_code": "AU",
"continent": "Oceania",
"continent_code": "OC",
"latitude": -27.48159,
"longitude": 153.0175,
"timezone": "Australia/Brisbane",
"postal_code": "4101",
"geoname_id": "2174003",
"radius": 10,
"last_changed": "2024-10-20"
},
"as": {
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"type": "hosting",
"last_changed": "2025-03-09"
},
"mobile": {},
"anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"is_anonymous": false,
"is_anycast": true,
"is_hosting": true,
"is_mobile": false,
"is_satellite": false
},
"lite/8.8.4.4/country": "United States",
"8.8.4.4/anonymous": {
"is_proxy": false,
"is_relay": false,
"is_tor": false,
"is_vpn": false
},
"lite/8.8.4.4": {
"ip": "8.8.4.4",
"asn": "AS15169",
"as_name": "Google LLC",
"as_domain": "google.com",
"country_code": "US",
"country": "United States",
"continent_code": "NA",
"continent": "North America"
}
}
Filter Option
There is also an optional filter
parameter, which if set will result in any URLs for which there's no response being removed from the response. This can be useful for things like finding hostnames that exist for a range of IPs:
ipinfo → ~ $ echo -e '8.8.8.8/hostname\n8.8.8.9/hostname' | curl -XPOST --data-binary @- "api.ipinfo.io/batch?token=$TOKEN"
{
"8.8.8.9/hostname": null,
"8.8.8.8/hostname": "dns.google"
}
ipinfo → ~ $ echo -e '8.8.8.8/hostname\n8.8.8.9/hostname' | curl -XPOST --data-binary @- "api.ipinfo.io/batch?token=$TOKEN&filter=1"
{
"8.8.8.8/hostname": "dns.google"
}
Note that for the purposes of request volume tracking, the call to /batch
itself isn't counted, but all of the URLs within the call are. So the example above counts as 2 requests, and a single call to /batch
with 100 URLs would count as 100 requests.
The batch endpoint works across all of our APIs. So you can use it with our ASN, IP ranges, and hosted domains endpoints too.
Command Line Interface (CLI)
To help with wrangling with our data on the command line, including doing batch requests trivially, you can try out our IPinfo CLI.
The CLI allows you to look up IP details in bulk or one-by-one, summarize the details of up to 1,000 IPs at a time, open a map of IP locations for any set of IPs, filter IPv4 & IPv6 addresses from any input, print out IP lists for any CIDR or IP range, and much more.
See installation instructions for details on how to get set up.