IP2Location.io Bulk IP Geolocation API


IP2Location.io provides RESTful API allowing users to check IP address location in bulk. This API supports up to 1000 IPv4 and IPv6 addresses per query.

What data you can get:
Country, region, district, city, latitude & longitude, ZIP code, time zone, ASN, and proxy data.

This API endpoint requires a Starter, Plus or Security Plan to work.


The REST API calling syntax. Please see the table below for the description of each parameter.

Name Description
key (required) API key.
format (optional) Format of the response message.
Valid value: json | csv

If unspecified, json format will be used for the response message.
fields (optional) Custom fields returned by the API endpoint.
Valid value: country_code | country_name | region_name | city_name | latitude | longitude | zip_code | time_zone | asn | as | is_proxy

You can specify multiple fields by separating them with comma (,). If unspecified, all fields will be returned.
(POST Body) (required) A list of IP address separated by new line or JSON encoded IP list.

API Endpoint

The IP2Location.io API supports json(default) and CSV response formats. Please find the sample response of all plans below.

Query String
echo -e '\n2.2.2.2' | curl -XPOST --data-binary @- "bulk.ip2location.io/?key=YOUR_API_KEY&format=json"
    "": {
        "country_code": "US",
        "country_name": "United States of America",
        "region_name": "California",
        "city_name": "San Jose",
        "latitude": 37.33939,
        "longitude": -121.89496,
        "zip_code": "95101",
        "time_zone": "America/Los_Angeles",
        "asn": "13335",
        "as": "CloudFlare Inc.",
        "is_proxy": false
    "": {
        "country_code": "FR",
        "country_name": "France",
        "region_name": "Auvergne-Rhone-Alpes",
        "city_name": "Lyon",
        "latitude": 45.748313,
        "longitude": 4.846578,
        "zip_code": "69998",
        "time_zone": "Europe/Paris",
        "asn": "3215",
        "as": "Orange S.A.",
        "is_proxy": false
echo -e '\n2.2.2.2' | curl -XPOST --data-binary @- "bulk.ip2location.io/?key=YOUR_API_KEY&format=csv"
Response,US,"United States of America",California,"San Jose",37.33939,-121.89496,95101,America/Los_Angeles,13335,"CloudFlare Inc.",0,FR,France,Auvergne-Rhone-Alpes,Lyon,45.748313,4.846578,69998,Europe/Paris,3215,"Orange S.A.",0

Response Format

The REST API returns the following fields and values.

Field Description
country_code Two-character country code based on ISO 3166.
country_name Country name based on ISO 3166.
region_name Region or state name.
city_name City name.
latitude City latitude. Defaults to capital city latitude if city is unknown.
longitude City longitude. Defaults to capital city longitude if city is unknown.
zip_code ZIP/Postal code.
time_zone UTC time zone (with DST supported).
asn Autonomous system number (ASN).
as Autonomous system (AS) name.
is_proxy Whether is a proxy or not

Error Object & Codes

An Error object will be returned for any error encountered. For example:

    "error": {
		"error_code": 401,
		"error_message": "Invalid API key or insufficient query."

Below is the complete list of the error code and message returned by the IP2Location.io API.

Error Code Error Message
401 Invalid API key or insufficient query.
500 Internal server error.

Sample Codes

You can use the sample codes below for different applications.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://bulk.ip2location.io/?' . http_build_query([
	'key'     => 'YOUR_API_KEY',
	'format'  => 'json',

curl_setopt($ch, CURLOPT_POSTFIELDS, '["", "", "", ""]');
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

$response = curl_exec($ch);

URL url = new URL ("https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");

String jsonInputString = "[\"\", \"\", \"\", \"\"]";
try(OutputStream os = con.getOutputStream()) {
	byte[] input = jsonInputString.getBytes("utf-8");
	os.write(input, 0, input.length);

try(BufferedReader br = new BufferedReader(
	new InputStreamReader(con.getInputStream(), "utf-8"))) {
		StringBuilder response = new StringBuilder();
		String responseLine = null;

		while ((responseLine = br.readLine()) != null) {

Dim httpClient As New System.Net.Http.HttpClient

Dim buffer = Encoding.UTF8.GetBytes("""["", """", """", """"]""")
Dim bytes = New ByteArrayContent(buffer)
bytes.Headers.ContentType = New Headers.MediaTypeHeaderValue("application/json")
Dim response As String = Await httpClient.PostAsync("https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json", bytes)
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";

using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
	string json = "[\"\", \"\", \"\", \"\"]";

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    var result = streamReader.ReadToEnd();
import requests
data = '["", "", "", ""]'

x = requests.post('https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json', data = data)
echo '["", "", "", ""]' | curl -XPOST --data-binary @- "bulk.ip2location.io/?key=YOUR_API_KEY&format=json"
require "httpx"

response = HTTPX.post("https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json", :json => ["", "", "", ""])
puts response
	headers: {
		'Accept': 'application/json',
		'Content-Type': 'application/json'
	method: "POST",
	body: '["", "", "", ""]'
.then(function(res){ console.log(res) })
.catch(function(res){ console.log(res) })
package main

import (

func main() {
	values := map[string]string["","","",""]
	jsonValue, _ := json.Marshal(values)
	myUrl := "https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json"
	resp, _ := http.Post(myUrl, "application/json", bytes.NewBuffer(jsonValue))
	defer resp.Body.Close()

	bodyBytes, _ := io.ReadAll(resp.Body)
	bodyStr := string(bodyBytes[:])
extern crate curl;

use curl::http;

fn main(){
	let resp = http::handle()
		.post("https://bulk.ip2location.io/?key=YOUR_API_KEY&format=json", '["", "", "", ""]')

	println!("code={}; headers={}; body={}",
	resp.get_code(), resp.get_headers(), resp.get_body());

Unlock Location Insights For Free

Empower your applications with accurate IP geolocation information now.

Try It for Free
IP2Location.io IP Geolocation API
Dive in and experience accurate IP geolocation API for FREE!