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 paid plan to work.
To authenticate your API requests, you can either include your API key as bearer token or URL parameter.
Below is the command to perform the authenticated query:
# With API key as URL parameter
echo -e '1.1.1.1\n2.2.2.2' | curl -XPOST --data-binary @- "https://bulk.ip2location.io/?key={YOUR_API_KEY}&format=json"
# With API key as Bearer token
echo -e '1.1.1.1\n2.2.2.2' | curl -XPOST -H "Authorization: Bearer {YOUR_API_KEY}" --data-binary @- https://bulk.ip2location.io/?format=json
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 | as_info.as_name | as_info.as_number | as_info.as_domain | as_info.as_cidr | as_info.as_usage_type | isp | domain | net_speed | idd_code | area_code | weather_station_code | weather_station_name | mcc | mnc | mobile_brand | elevation | usage_type | ads_category | ads_category_name | district | continent.name | continent.code | continent.hemisphere | continent.translation | country.name | country.alpha3_code | country.numeric_code | country.demonym | country.flag | country.capital | country.total_area | country.population | country.currency | country.language | country.tld | country.translation | region.name | region.code | region.translation | city.name | city.translation | time_zone_info.olson | time_zone_info.current_time | time_zone_info.gmt_offset | time_zone_info.is_dst | time_zone_info.abbreviation | time_zone_info.dst_start_date | time_zone_info.dst_end_date | time_zone_info.sunrise | time_zone_info.sunset | geotargeting.metro | is_proxy | fraud_score | proxy.last_seen | proxy.proxy_type | proxy.threat | proxy.provider | proxy.is_vpn | proxy.is_tor | proxy.is_data_center | proxy.is_public_proxy | proxy.is_web_proxy | proxy.is_web_crawler | proxy.is_residential_proxy | proxy.is_spammer | proxy.is_scanner | proxy.is_botnet | proxy.is_bogon | proxy.is_consumer_privacy_network | proxy.is_enterprise_private_network 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. |
The IP2Location.io API supports json(default) and CSV response formats. Please find the sample response of all plans below.
echo -e '1.1.1.1\n2.2.2.2' | curl -XPOST --data-binary @- "bulk.ip2location.io/?key={YOUR_API_KEY}&format=json"
{
"1.1.1.1": {
"country_code": "AU",
"country_name": "Australia",
"region_name": "Queensland",
"city_name": "Brisbane",
"latitude": -27.46754,
"longitude": 153.02809,
"zip_code": "4000",
"time_zone": "+10:00",
"asn": "13335",
"as": "CloudFlare Inc",
"isp": "APNIC and CloudFlare DNS Resolver Project",
"domain": "cloudflare.com",
"net_speed": "T1",
"idd_code": "61",
"area_code": "07",
"weather_station_code": "ASXX0016",
"weather_station_name": "Brisbane",
"mcc": null,
"mnc": null,
"mobile_brand": null,
"elevation": 16,
"usage_type": "CDN",
"address_type": "A",
"continent": {
"name": "Oceania",
"code": "OC",
"hemisphere": [
"south",
"east"
],
"translation": {
"lang": "en",
"value": "Oceania"
}
},
"country": {
"name": "Australia",
"alpha3_code": "AUS",
"numeric_code": "36",
"demonym": "Australians",
"flag": "https://cdn.ip2location.io/assets/img/flags/au.png",
"capital": "Canberra",
"total_area": 7741220,
"population": 26461166,
"currency": {
"code": "AUD",
"name": "Australian Dollar",
"symbol": "$"
},
"language": {
"code": "EN",
"name": "English"
},
"tld": "au",
"translation": {
"lang": "en",
"value": "Australia"
}
},
"region": {
"name": "Queensland",
"code": "AU-QLD",
"translation": {
"lang": "en",
"value": "Queensland"
}
},
"city": {
"name": "Brisbane",
"translation": {
"lang": "en",
"value": "Brisbane"
}
},
"time_zone_info": {
"olson": "Australia/Brisbane",
"current_time": "2026-02-24T11:33:22+10:00",
"gmt_offset": 36000,
"is_dst": false,
"abbreviation": "AEST",
"dst_start_date": null,
"dst_end_date": null,
"sunrise": "05:36",
"sunset": "18:26"
},
"geotargeting": {
"metro": null
},
"is_proxy": false,
"fraud_score": 0,
"proxy": {
"last_seen": 1,
"proxy_type": "DCH",
"threat": null,
"provider": null,
"is_vpn": false,
"is_tor": false,
"is_data_center": true,
"is_public_proxy": false,
"is_web_proxy": false,
"is_web_crawler": false,
"is_residential_proxy": false,
"is_consumer_privacy_network": false,
"is_enterprise_private_network": false,
"is_spammer": false,
"is_scanner": false,
"is_botnet": false,
"is_bogon": false
}
},
"2.2.2.2": {
"country_code": "US",
"country_name": "United States of America",
"region_name": "Virginia",
"city_name": "Redwood",
"latitude": 37.005847,
"longitude": -79.770089,
"zip_code": "24146",
"time_zone": "-05:00",
"asn": "15519",
"as": "Oracle Svenska AB",
"isp": "Oracle Svenska AB",
"domain": "oracle.com",
"net_speed": "T1",
"idd_code": "1",
"area_code": "540",
"weather_station_code": "USVA0640",
"weather_station_name": "Redwood",
"mcc": null,
"mnc": null,
"mobile_brand": null,
"elevation": 325,
"usage_type": "DCH",
"address_type": "U",
"continent": {
"name": "North America",
"code": "NA",
"hemisphere": [
"north",
"west"
],
"translation": {
"lang": "en",
"value": "North America"
}
},
"country": {
"name": "United States of America",
"alpha3_code": "USA",
"numeric_code": "840",
"demonym": "Americans",
"flag": "https://cdn.ip2location.io/assets/img/flags/us.png",
"capital": "Washington, D.C.",
"total_area": 9826675,
"population": 339665118,
"currency": {
"code": "USD",
"name": "United States Dollar",
"symbol": "$"
},
"language": {
"code": "EN",
"name": "English"
},
"tld": "us",
"translation": {
"lang": "en",
"value": "United States of America"
}
},
"region": {
"name": "Virginia",
"code": "US-VA",
"translation": {
"lang": "en",
"value": "Virginia"
}
},
"city": {
"name": "Redwood",
"translation": {
"lang": "en",
"value": "Redwood"
}
},
"time_zone_info": {
"olson": "America/New_York",
"current_time": "2026-02-23T20:33:22-05:00",
"gmt_offset": -18000,
"is_dst": false,
"abbreviation": "EST",
"dst_start_date": null,
"dst_end_date": null,
"sunrise": "06:54",
"sunset": "18:09"
},
"geotargeting": {
"metro": "573"
},
"is_proxy": false,
"fraud_score": 3,
"proxy": {
"last_seen": 1,
"proxy_type": "DCH",
"threat": null,
"provider": null,
"is_vpn": false,
"is_tor": false,
"is_data_center": true,
"is_public_proxy": false,
"is_web_proxy": false,
"is_web_crawler": false,
"is_residential_proxy": false,
"is_consumer_privacy_network": false,
"is_enterprise_private_network": false,
"is_spammer": false,
"is_scanner": false,
"is_botnet": false,
"is_bogon": false
}
}
}
echo -e '1.1.1.1\n2.2.2.2' | curl -XPOST --data-binary @- "bulk.ip2location.io/?key={YOUR_API_KEY}&format=csv"
ip_address,country_code,country_name,region_name,city_name,latitude,longitude,zip_code,time_zone,asn,as,as_info.as_name,as_info.as_number,as_info.as_domain,as_info.as_cidr,as_info.as_usage_type,isp,domain,net_speed,idd_code,area_code,weather_station_code,weather_station_name,mcc,mnc,mobile_brand,elevation,usage_type,ads_category,ads_category_name,district,continent.name,continent.code,continent.hemisphere,continent.translation,country.name,country.alpha3_code,country.numeric_code,country.demonym,country.flag,country.capital,country.total_area,country.population,country.currency,country.language,country.tld,country.translation,region.name,region.code,region.translation,city.name,city.translation,time_zone_info.olson,time_zone_info.current_time,time_zone_info.gmt_offset,time_zone_info.is_dst,time_zone_info.abbreviation,time_zone_info.dst_start_date,time_zone_info.dst_end_date,time_zone_info.sunrise,time_zone_info.sunset,geotargeting.metro,is_proxy,fraud_score,proxy.last_seen,proxy.proxy_type,proxy.threat,proxy.provider,proxy.is_vpn,proxy.is_tor,proxy.is_data_center,proxy.is_public_proxy,proxy.is_web_proxy,proxy.is_web_crawler,proxy.is_residential_proxy,proxy.is_spammer,proxy.is_scanner,proxy.is_botnet,proxy.is_bogon,proxy.is_consumer_privacy_network,proxy.is_enterprise_private_network
1.1.1.1,AU,Australia,Queensland,Brisbane,-27.46754,153.02809,4000,+10:00,13335,"CloudFlare Inc","APNIC and CloudFlare DNS Resolver Project",cloudflare.com,T1,61,07,ASXX0016,Brisbane,,,,16,CDN,A,Oceania,OC,south,east,en,Oceania,Australia,AUS,36,Australians,https://cdn.ip2location.io/assets/img/flags/au.png,Canberra,7741220,26461166,AUD,"Australian Dollar",$,EN,English,au,en,Australia,Queensland,AU-QLD,en,Queensland,Brisbane,en,Brisbane,Australia/Brisbane,2026-02-24T11:34:09+10:00,36000,,AEST,,,05:36,18:26,,,0,1,DCH,,,,,1,,,,,,,,,,
2.2.2.2,US,"United States of America",Virginia,Redwood,37.005847,-79.770089,24146,-05:00,15519,"Oracle Svenska AB","Oracle Svenska AB",oracle.com,T1,1,540,USVA0640,Redwood,,,,325,DCH,U,"North America",NA,north,west,en,"North America","United States of America",USA,840,Americans,https://cdn.ip2location.io/assets/img/flags/us.png,"Washington, D.C.",9826675,339665118,USD,"United States Dollar",$,EN,English,us,en,"United States of America",Virginia,US-VA,en,Virginia,Redwood,en,Redwood,America/New_York,2026-02-23T20:34:09-05:00,-18000,,EST,,,06:54,18:09,573,,3,1,DCH,,,,,1,,,,,,,,,,
The REST API returns the following fields and values.
| Field | Description |
|---|---|
| ip | IP address |
| 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. |
| as_info.as_name | Autonomous system (AS) name. |
| as_info.as_number | Autonomous system number (ASN). |
| as_info.as_domain | Domain name of the AS registrant. |
| as_info.as_cidr | CIDR range for the whole AS. |
| as_info.as_usage_type | Usage type of the AS registrant. |
| isp | Internet Service Provider or company's name. |
| domain | Internet domain name associated with IP address range. |
| net_speed | Internet connection type. DIAL = dial-up, DSL = broadband/cable/fiber/mobile, COMP = corporate, T1 = data center/transit, SAT = satellite |
| idd_code | The IDD prefix to call the city from another country. |
| area_code | A varying length number assigned to geographic areas for calls between cities. |
| weather_station_code | The special code to identify the nearest weather observation station. |
| weather_station_name | The name of the nearest weather observation station. |
| mcc | Mobile Country Codes (MCC) as defined in ITU E.212 for use in identifying mobile stations in wireless telephone networks, particularly GSM and UMTS networks. |
| mnc | Mobile Network Code (MNC) is used in combination with a Mobile Country Code (MCC) to uniquely identify a mobile phone operator or carrier. |
| mobile_brand | Commercial brand associated with the mobile carrier. |
| elevation | Average height of city above sea level in meters (m). |
| usage_type | Usage type classification of ISP or company (COM) Commercial (ORG) Organization (GOV) Government (MIL) Military (EDU) University/College/School (LIB) Library (CDN) Content Delivery Network (ISP) Fixed Line ISP (MOB) Mobile ISP (DCH) Data Center/Web Hosting/Transit (SES) Search Engine Spider (RSV) Reserved Represents an ISP that offers both fixed-line and mobile internet services. These ranges are classified as “ISP/MOB”. |
| address_type | IP address types as defined in Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6). (A) Anycast - One to the closest (U) Unicast - One to one (M) Multicast - One to multiple (B) Broadcast - One to all |
| ads_category | The domain category code based on IAB Tech Lab Content Taxonomy. |
| ads_category_name | The domain category based on IAB Tech Lab Content Taxonomy. These categories are comprised of Tier-1 and Tier-2 (if available) level categories widely used in services like advertising, Internet security and filtering appliances. |
| district | District or county name. |
| continent.name | Continent name. |
| continent.code | Two-character continent code. |
| continent.hemisphere | The hemisphere of where the country located. The data in array format with first item indicates (north/south) hemisphere and second item indicates (east/west) hemisphere information. |
| continent.translation | Translation data based on the given lang code. |
| country.name | Country name based on ISO 3166. |
| country.alpha3_code | Three-character country code based on ISO 3166. |
| country.numeric_code | Three-character country numeric code based on ISO 3166. |
| country.demonym | Native of the country |
| country.flag | URL of the country flag image. |
| country.capital | Capital of the country. |
| country.total_area | Total area in km2. |
| country.population | Population of the country. |
| country.currency | Currency of the country |
| country.language | Language of the country |
| country.tld | Country-Code Top-Level Domain. |
| country.translation | Translation data based on the given lang code. |
| region.name | Region or state name. |
| region.code | ISO3166-2 code. |
| region.translation | Translation data based on the given lang code. |
| city.name | City name. |
| city.translation | Translation data based on the given lang code. |
| time_zone_info.olson | Time zone in Olson format. |
| time_zone_info.current_time | Current time in ISO 8601 format. |
| time_zone_info.gmt_offset | GMT offset value in seconds. |
| time_zone_info.is_dst | Indicate if the time zone value is in DST. |
| time_zone_info.abbreviation | The time zone abbreviation of the Olson time zone, for example EST and EEST. |
| time_zone_info.dst_start_date | The date (UTC) of Daylight Saving Time (DST) begins. |
| time_zone_info.dst_end_date | The date (UTC) of Daylight Saving Time (DST) ends. |
| time_zone_info.sunrise | Time of sunrise. (hh:mm format in local time, i.e, 07:47) |
| time_zone_info.sunset | Time of sunset. (hh:mm format in local time, i.e 19:50) |
| geotargeting.metro | Metro code based on zip/postal code. |
| is_proxy | Whether is a proxy or not |
| fraud_score | Potential risk score (0 - 99) associated with IP address. A higher IP2Proxy Fraud Score indicates a greater likelihood of fraudulent activity and a lower reputation. |
| proxy.last_seen | Proxy last seen in days. |
| proxy.proxy_type | Type of proxy. (VPN) Virtual Private Networks (TOR) Tor Exit Nodes (DCH) Hosting Providers, Data Centers or Content Delivery Networks (PUB) Public Proxies (WEB) Web Proxies (SES) Search Engine Robots (RES) Residential Proxies (CPN) Consumer Privacy Networks (EPN) Enterprise Private Networks |
| proxy.threat | Security threat reported. (SPAM) Email and forum spammers (SCANNER) Network security scanners (BOTNET) Malware infected devices (BOGON) Unassigned or illegitimate IP addresses announced via BGP. |
| proxy.provider | Name of VPN provider if available. |
| proxy.is_vpn | Anonymizing VPN services. |
| proxy.is_tor | Tor Exit Nodes. |
| proxy.is_data_center | Hosting Provider, Data Center or Content Delivery Network. |
| proxy.is_public_proxy | Public Proxies. |
| proxy.is_web_proxy | Web Proxies. |
| proxy.is_web_crawler | Search Engine Robots. |
| proxy.is_residential_proxy | Residential proxies. |
| proxy.is_spammer | Email and forum spammers. |
| proxy.is_scanner | Network security scanners. |
| proxy.is_botnet | Malware infected devices. |
| proxy.is_bogon | Unassigned or illegitimate IP addresses announced via BGP. |
| proxy.is_consumer_privacy_network | Consumer Privacy Networks. |
| proxy.is_enterprise_private_network | Enterprise Private Networks. |
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. |
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, '["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]');
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);
var_dump($response);
URL url = new URL ("https://bulk.ip2location.io/?key={YOUR_API_KEY}&format=json");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);
String jsonInputString = "[\"1.1.1.1\", \"2.2.2.2\", \"3.3.3.3\", \"4.4.4.4\"]";
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) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
Dim httpClient As New System.Net.Http.HttpClient
Dim buffer = Encoding.UTF8.GetBytes("""[1.1.1.1"", ""2.2.2.2"", ""3.3.3.3"", ""4.4.4.4""]""")
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)
Console.WriteLine($"{response}")
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 = "[\"1.1.1.1\", \"2.2.2.2\", \"3.3.3.3\", \"4.4.4.4\"]";
streamWriter.Write(json);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
import requests
data = '["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]'
x = requests.post('https://bulk.ip2location.io/?key={YOUR_API_KEY}&format=json', data = data)
print(x.text)
echo '["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]' | 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 => ["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"])
puts response
fetch("https://bulk.ip2location.io/?key={YOUR_API_KEY}&format=json",{
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: '["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]'
})
.then(function(res){ console.log(res) })
.catch(function(res){ console.log(res) })
package main
import (
"net/http"
"fmt"
"io"
)
func main() {
values := map[string]string["1.1.1.1","2.2.2.2","3.3.3.3","4.4.4.4"]
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[:])
fmt.Println(bodyStr)
}
extern crate curl;
use curl::http;
fn main(){
let resp = http::handle()
.post("https://bulk.ip2location.io/?key={YOUR_API_KEY}&format=json", '["1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]')
.exec().unwrap();
println!("code={}; headers={}; body={}",
resp.get_code(), resp.get_headers(), resp.get_body());
}
Empower your applications with accurate IP geolocation information now.
Try It for Free