You can use our batch API to lookup detailed for up to 100 IPs in a single request. If you want to lookup thousands of IPs rather than hundreds of thousands it's probably simpler to just call our normal API for each of the IPs using some common unix command line tools you're able to do bulk lookups.

First you need a file that contains all of the IP address you want to lookup, with each IP on a single line. So something like this:

8.8.8.8
8.8.4.4
1.2.3.4

You can then use xargs to do a lookup for every IP in the file. Here's an example where we lookup the country for each IP:

cat ips.txt | xargs -I% curl http://ipinfo.io/%/country
US
US
US

The same thing works with other field, such as region:

cat ips.txt | xargs -I% curl http://ipinfo.io/%/region
California
Colorado
Washington

If you want to combine the API output with the IP addresses we can use paste for that, and this time we're looking up the organization:

cat ips.txt | xargs -I% curl -s http://ipinfo.io/%/org | paste -d"," ips.txt -
8.8.8.8,AS15169 Google Inc.
8.8.4.4,AS15169 Google Inc.
1.2.3.4,AS15169 Google Inc.

If you do need to lookup hundreds of thousands of IPs or more then you'll likely want to use our batch API, where xargs can also help:

# List of IPs -> JSON arrays of 100 IPs
$ cat huge_list_of_ips | xargs -n100 | sed 's/ /","/g' | sed 's/^/["/g' | sed 's/$/"]/g' > grouped.ips
$ cat grouped.ips | sed 's/"/\\"/g' | xargs -P20  -n1 -J% curl -s -XPOST  -H "Content-Type: application/json" --data % ipinfo.io/batch?token=$TOKEN > grouped.results

By using this approach you can expect to lookup around 100k IPs per minute.


IPinfo is a comprehensive IP data and API provider with flexible pricing plans to meet your business needs. We handle billions of API requests per month, serving data like IP geolocation, ASN, VPN detection, and more. Sign up for a free account or contact our data experts to learn more.