Free IP Geolocation API and Accurate IP Lookup Database
Our IP API provides geographical information about website visitors with any IPv4 or IPv6 address in JSON and XML format over a secure HTTPS connection even in our free plan. We provide data such as country name, country code, city, state, local currency, time zone, ISP, ASN, Company Details, device data from User Agent String, VPN, Proxy, Tor and threat intelligence data served globally with latency based routing.
ip:"",
hostname:"",
continent_code:"",
continent_name:"",
country_code2:"",
country_code3:"",
country_name:"",
country_capital:"",
state_prov:"",
district:"",
city:"",
zipcode:"",
latitude:"",
longitude:"",
is_eu:"",
calling_code:"",
country_tld:"",
languages:"",
country_flag:
isp:"",
connection_type:"",
organization:"",
asn:"",
geoname_id:"",
currency:Object,
name:"",
code:"",
symbol:"",
time_zone:Object,
name:"",
offset:"",
current_time:"",
current_time_unix:"",
is_dst:"",
dst_savings:"",
security:Object,
threat_score:"",
is_tor:"",
is_proxy:"",
proxy_type:"",
is_anonymous:"",
is_known_attacker:"",
is_spam:"",
is_bot:"",
is_cloud_provider:"",
user_agent:Object,
userAgentString:"",
name:"",
type:"",
version:"",
versionMajor:"",
device:Object,
name:"",
type:"",
brand:"",
CPU:"",
engine:Object,
name:"",
type:"",
version:"",
versionMajor:"",
operatingSystem:Object,
name:"",
type:"",
version:"",
versionMajor:"",
IP Location Module
IP to Location module provides geolocation information related to an IP address such as continent, country, country capital, country calling code, country top level domain, city, state/province, zip code, local languages, country flag, latitude and longitude information.
Response
1 {
2 "ip": "8.8.8.8",
3 "continent_name": "North America",
4 "country_name": "United States",
5 "country_capital": "Washington",
6 "state_prov": "California",
7 "district": "Santa Clara County",
8 "city": "Mountain View",
9 "zipcode": "94043",
10 "latitude": "37.4229",
11 "longitude": "-122.085",
12 "is_eu": "false",
13 "calling_code": "+1",
14 "country_tld": ".us",
15 "languages": "en-US,es-US,haw,fr",
16 "country_flag": "images/flags/us.svg"
17 }Currency Module
IP to Currency module provides currency information of the country such as currency name, currency symbol and currency code from and IP address.
Response
1{
2 "currency": {
3 "name": "US Dollar",
4 "code": "USD",
5 "symbol": "$"
6 }
7}Time Zone Module
IP to Time Zone module provides time and timezone related information such as timezone name, UTC/GMT offset, current date and time string, is daylight saving time active and daylight saving in hours.
Response
1"time_zone":{
2 "name":"Australia/Brisbane",
3 "offset":"-8",
4 "current_time":"2018-12-06 00:28:40.339-0800",
5 "current_time_unix":"1544084920.339",
6 "is_dst":"false",
7 "dst_savings":"1"
8}Connection Information Module
Connection information module provides connection related information such as name of the ISP which owns this IP address, name of the organization/company to whom this IP address is further licensed by the ISP, ANS and the connection (wired or wireless).
Response
1"isp": "Level 3 Communications",
2"connection_type": "wired",
3"organization": "Google Inc.",
4"asn": "AS15169"Security Module
The security module provides threat intelligence data such as threat score, is tor, vpn or proxy, is known attacker and if the IP address belongs to one of the cloud providers.
Response
1 "security": {
2 "threat_score": "42",
3 "is_tor": "false",
4 "is_proxy": "true",
5 "proxy_type": "HTTP",
6 "is_anonymous": "true",
7 "is_known_attacker": "true",
8 "is_cloud_provider": "false"
9 }User Agent Parser Module
User Agent module parses the browser user agent string and provides detailed device information such as device name, device version, device type, device operating system, device browser, browser engine and browser version. It can identify robots, crawlers and attackers.
Response
1"user_agent": {
2 "userAgentString": "Mozilla/5.0
3 (Macintosh; Intel Mac OS X 10_15_3)
4 AppleWebKit/605.1.15 (KHTML, like Gecko)
5 Version/13.0.5 Safari/605.1.15",
6 "name": "Safari",
7 "type": "Browser",
8 "version": "13.0.5",
9 "versionMajor": "13",
10 "device": {
11 "name": "Apple Macintosh",
12 "type": "Desktop",
13 "brand": "Apple",
14 "CPU": "Intel"
15 },
16 "engine": {
17 "name": "AppleWebKit",
18 "type": "Browser",
19 "version": "605.1.15",
20 "versionMajor": "605"
21 },
22 "operatingSystem": {
23 "name": "Mac OS X",
24 "type": "Desktop",
25 "version": "10.15.3",
26 "versionMajor": "10"
27 }
28 }Reverse IP Lookup Module
With reverse IP Lookup, you can resolve the host name or domain or router dns address. This gives you detailed information about the original source of traffic.
Request
curl 'https://api.ipgeolocation.io/ipgeo-bulk?include=hostname&ip=8.8.8.8&apiKey=API_KEY'Response
1{
2 "ip":"8.8.8.8",
3 "hostname":"dns.google",
4 "..."
5}Domain IP Lookup
Enter the domain address for the place of IP address and our API will perform a DNS Lookup to give you the information about the web hosting provider and the geographical location of the website.
Response
1"domain": "ipgeolocation.io",
2"ip":"104.20.61.122",
3"isp": "Cloudflare, Inc.",
4"asn": "AS13335",
5"..."Bulk IP Address Lookup Support
Use our Bulk IP Lookup endpoint to perform batch lookup of multiple IPs in one go. One request can have up to 50,000 IPs. Both IPv4 and IPv6 are supported.
Request
curl -X POST 'https://api.ipgeolocation.io/ipgeo-bulk?apiKey=API_KEY'
-H 'Content-Type: application/json'
-d '{
"ips": ["1.1.1.1", "1.2.3.4", "1.2.3.5", "1.2.3.6", "1.2.3.7"]
}'Response in Multiple Languages
You can retrieve the geolocation information for an IP address in the following languages:
Use Cases
Website content localization
Adapt the content of your website to the destination of your visitors. Make your visitors feel right at home by "talking" to them in their local language and connect with them instantly. with IP geolocation, redirect your users to their region-specific websites and increase the possibility of increasing conversions up to 70%.
Non-intrusive geolocation
Do you have an awesome content localization strategy in place? IP geolocation is a non-intrusive way to know where your visitors are coming from. Don't ruin your visitor's website experience by showing annoying pop-ups asking for their location. Our geolocation API will detect their location from their IP address and show them the relevant message.
Digital Rights Protection
Enforce digital rights of your content using IP location API. Build a virtual fence around your content and make sure that only the people inside the fence can see it.
Prevent Threats and Scams
With our security and user agent module, you can identify anonymous traffic sources, known attackers, suspicious devices and tor nodes to prevent online fraud, trial abusers, forum spams and botnet attackers.
Ready to get started?Get Started with IP Intelligence API Today
IP Geolocation API
IP Geolocation API provides real-time and accurate geolocation, and security information for any IPv4 or IPv6 address and domain name along with the user-agent detail for the provided user-agent string. You can geolocate your online visitors and provide them the customized user-experience accordingly.
We provide the two endpoints in our IP Lookup API to get geolocation information.
Single IP Geolocation Lookup API
Single IP Location API can be used in two ways to lookup any IP address or domain name with JSON or XML response. The URL for this endpoint is https://api.ipgeolocation.io/ipgeo and its full JSON response is below:
Response
1{
2 "ip": "8.8.8.8",
3 "hostname": "dns.google",
4 "continent_code": "NA",
5 "continent_name": "North America",
6 "country_code2": "US",
7 "country_code3": "USA",
8 "country_name": "United States",
9 "country_capital": "Washington, D.C.",
10 "state_prov": "California",
11 "district": "Santa Clara",
12 "city": "Mountain View",
13 "zipcode": "94043-1351",
14 "latitude": "37.42240",
15 "longitude": "-122.08421",
16 "is_eu": false,
17 "calling_code": "+1",
18 "country_tld": ".us",
19 "languages": "en-US,es-US,haw,fr",
20 "country_flag": "images/flags/us.svg",
21 "geoname_id": "6301403",
22 "isp": "Google LLC",
23 "connection_type": "",
24 "organization": "Google LLC",
25 "asn": "AS15169",
26 "currency": {
27 "code": "USD",
28 "name": "US Dollar",
29 "symbol": "$"
30 },
31 "time_zone": {
32 "name": "America/Los_Angeles",
33 "offset": -8,
34 "current_time": "2020-12-17 07:49:45.872-0800",
35 "current_time_unix": 1608220185.872,
36 "is_dst": false,
37 "dst_savings": 1
38 }
39}Passing an IPv4, IPv6 Address or a domain
In order to find geolocation information about an IP address or a domain name, pass it as a query parameter like below. Note that apiKey is also passed as a query parameter for authorization. This endpoint is meant to be called from the server side.
Without Passing an IP Address
When this endpoint is queried without an IP address, it returns the geolocation information of the device/client which is calling it. This endpoint is meant to be called from client side.
Note: apiKey parameter can also be ommitted from your API request when this endpoint is called from client side using Request Origin.
Bulk IP Geolocation Lookup AP
This feature is available only on the paid API subscriptions. This endpoint allows you to perform the geolocation lookup for multiple IPv4, IPv6 addresses or domain names (maximum 50) at the same time. The requests count per lookup is equal to total IP addresses or domain names passed.
To perform bulk IP Geolocation Lookup, send a POST request and pass the "ips" array as JSON data along with it. Here is an example.
Response in Multiple Languages
The geolocation information for an IP address from the IP Geolocation API can be retrieved in the following languages
- English (en)
- German (de)
- Russian (ru)
- Japanese (ja)
- French (fr)
- Chinese Simplified (cn)
- Spanish (es)
- Czech (cs)
- Italian (it)
By default, the API responds in English. You can change the response language by passing the language code as a query parameter lang. Here are a few curl examples:
# Get geolocation for an IPv4 IP Address = 1.1.1.1 in Chinese language
$ curl 'https://api.ipgeolocation.io/ipgeo?apiKey=API_KEY&ip=1.1.1.1&lang=cn'
# Get details for an IPv6 IP Address = 2001:4860:4860::1 in Russian
$ curl 'https://api.ipgeolocation.io/ipgeo?apiKey=API_KEY&ip=2001:4860:4860::1&lang=ru'Only the paid plan subscriptions can get the response in languages other than English. All the other subscriptions will only get the response in English.
Filter Responses
We've built our API to give you fine granularity. Specify what you want in query parameter and get only those fields. This will save you processing time, bandwidth and improve the API response time.
You can filter the API response in two ways:
Get the Required Fields Only
First, you can filter the API response by specifying names of the fields that you want instead of getting the full response. Names of the required fields must be passed as a query parameter fields in the request. Here are a few examples to get only the required fields:
Get City Information Only
Response
Response
1{
2 "ip": "1.1.1.1",
3 "city": "South Brisbane"
4}Get Country Name and Country Code (ISO2) Only
Get the Time Zone Information Only
Response
Response
1{
2 "ip": "1.1.1.1",
3 "time_zone": {
4 "name": "America/Los_Angeles",
5 "offset": -8,
6 "current_time": "2018-12-06 00:28:40.339-0800",
7 "current_time_unix": 1544084920.339,
8 "is_dst": false,
9 "dst_savings": 1
10 }
11}Get Only the Local Currency Information of Multiple IP Addresses
You can use our filters with Bulk IP Lookup as well. Here is an example:
Response
1[
2 {
3 "ip": "1.1.1.1",
4 "currency": {
5 "name": "Australian Dollar",
6 "code": "AUD"
7 }
8 },
9 {
10 "ip": "1.2.3.4",
11 "currency": {
12 "name": "Australian Dollar",
13 "code": "AUD"
14 }
15 }
16]Get Geo Location Only
We know, most of the times, users are interested in geolocation information only. So, we have added a shortcut for you. You can specify just fields=geo in your query parameter.
Response
1{
2 "ip": "1.1.1.1",
3 "country_code2": "AU",
4 "country_code3": "AUS",
5 "country_name": "Australia",
6 "state_prov": "Queensland",
7 "district": "Brisbane",
8 "city": "South Brisbane",
9 "zipcode": "4101",
10 "latitude": "-27.4748",
11 "longitude": "153.017"
12}Remove the Unnecessary Fields
Second, you can also filter the API response by specifying the names of fields (except IP address) that you want to remove from the API response. Names of the fields must be passed as a query parameter excludes in the request. Here are a few examples to exclude the unnecessary fields:
Exclude Continent Code, Currency and, Time zone Objects
Response
1{
2 "ip": "1.1.1.1",
3 "continent_name": "Oceania",
4 "country_code2": "AU",
5 "country_code3": "AUS",
6 "country_name": "Australia",
7 "country_capital": "Canberra",
8 "state_prov": "Queensland",
9 "district": "Brisbane",
10 "city": "South Brisbane",
11 "zipcode": "4101",
12 "latitude": "-27.4748",
13 "longitude": "153.017",
14 "is_eu": false,
15 "calling_code": "+61",
16 "country_tld": ".au",
17 "languages": "en-AU",
18 "country_flag": "images/flags/au.svg",
19 "isp": "Cloudflare Inc.",
20 "connection_type": "",
21 "organization": "",
22 "geoname_id": "2207259"
23}Get the Geo Field and Exclude Continent Information
Response
1{
2 "ip": "1.1.1.1",
3 "country_code2": "AU",
4 "country_code3": "AUS",
5 "country_name": "Australia",
6 "state_prov": "Queensland",
7 "district": "Brisbane",
8 "city": "South Brisbane",
9 "zipcode": "4101",
10 "latitude": "-27.4748",
11 "longitude": "153.017"
12}IP-Security Information for an IP Address
IP Geolocation API also provides IP-Security information on all the paid subscriptions, but doesn't respond it by default. To get IP-Security information along with geolocation information, you must pass the include=security as a query parameter in the URL.
Here is an example to IP Geolocation lookup that includes IP security information for the IP address:
Response
1{
2 "ip": "198.90.78.238",
3 "country_code2": "CA",
4 "country_code3": "CAN",
5 "country_name": "Canada",
6 "state_prov": "Quebec",
7 "district": "Sainte-Rose",
8 "city": "Laval",
9 "zipcode": "H7P 4W5",
10 "latitude": "45.58160",
11 "longitude": "-73.76980",
12 "security": {
13 "threat_score": 7,
14 "is_tor": false,
15 "is_proxy": true,
16 "proxy_type": "VPN",
17 "is_anonymous": true,
18 "is_known_attacker": false,
19 "is_cloud_provider": false
20}
21}Hostname Lookup for an IP Address
IPGeolocation API also provide hostname lookup for an IP address on all the paid subscriptions, but doesn't respond it by default. To get the hostname for an IP address, you can pass one of the three values (hostname, liveHostname, hostnameFallbackLive) as a URL parameter (include).
Here is an example to IP Geolocation lookup that includes hostname for the IP address:
Response
1{
2 "ip": "1.1.1.1",
3 "hostname": "one.one.one.one",
4 "country_code2": "AU",
5 "country_code3": "AUS",
6 "country_name": "Australia",
7 "state_prov": "Queensland",
8 "district": "Brisbane",
9 "city": "South Brisbane",
10 "zipcode": "4101",
11 "latitude": "-27.4748",
12 "longitude": "153.017"
13}include=hostname URL Parameter
This URL parameter enables the IPGeolocation API to lookup hostname from our IP-Hostname database and returns the same IP address if there is no hostname found for the queried IP address. Lookup thru IP-Hostname database is faster than other options but is experimental and under process and can produce unwanted output.
include=liveHostname URL Parameter
This URL parameter enables the IPGeolocation API to lookup hostname from live sources. Lookup thru live sources is accurate but can introduce more latency to your query to IPGeolocation API
include=hostnameFallbackLive URL Parameter
This URL parameter enables the IPGeolocation API to lookup hostname from our IP-Hostname database and if there is no hostname found for the queried IP address, then lookup thru the live sources. This option has been introduced for faster and accurate lookup.
User-Agent Information for a Device
IP Geolocation API also provides User-Agent information on all the paid subscriptions, but doesn't respond it by default. To get User-Agent information along with the geolocation information, you must pass the include=useragent as a query parameter in the URL.
Here is an example to IP Geolocation lookup that includes User-Agent information for a device from which the query originated:
Response
1{
2 "ip": "1.1.1.1",
3 "country_code2": "AU",
4 "country_code3": "AUS",
5 "country_name": "Australia",
6 "state_prov": "Queensland",
7 "district": "South Brisbane",
8 "city": "Brisbane",
9 "zipcode": "4101",
10 "latitude": "-27.47561",
11 "longitude": "153.01537",
12 "user_agent": {
13 "userAgentString": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
14 "name": "Chrome",
15 "type": "Browser",
16 "version": "51.0.2704.103",
17 "versionMajor": "51",
18 "device": {
19 "name": "Linux Desktop",
20 "type": "Desktop",
21 "brand": "Unknown",
22 "CPU": "Intel x86_64"
23 },
24 "engine": {
25 "name": "Blink",
26 "type": "Browser",
27 "version": "51.0",
28 "versionMajor": "51"
29 },
30 "operatingSystem": {
31 "name": "Linux",
32 "type": "Desktop",
33 "version": "Intel x86_64",
34 "versionMajor": "Intel x86"
35 }
36 }
37}Note: To get hostname, IP-Security information, and user-agent information together for an IP address and the device, you can pass include=hostname,security,useragent as a query parameter in the URL.
Reference to IPGeolocation API Response
| Field | Type | Description | Can be empty? |
|---|---|---|---|
| domain | string | Domain name that is used to lookup geolocation information. It is not returned if an IP address is used to query IP Geolocation API. | Yes |
| ip | string | IP address that is used to lookup geolocation information. | No |
| hostname | string | Hostname of the IP address used to query IP Geolocation API. | No |
| continent_code | string | 2-letter code of the continent. | No |
| continent_name | string | Name of the continent. | No |
| country_code2 | string | Country code (ISO 3166-1 alpha-2) of the country. | No |
| country_code3 | string | Country code (ISO 3166-1 alpha-3) of the country. | No |
| country_name | string | Name of the country. | No |
| country_capital | string | Name of the country’s capital. | No |
| state_prov | string | Name of the state/province/region. | Yes |
| district | string | Name of the district or county. | Yes |
| city | string | Name of the city. | Yes |
| zipcode | string | ZIP code of the place | Yes |
| latitude | float | Latitude of the place. | YNo |
| longitude | float | Longitude of the place. | No |
| is_eu | boolean | Is the country belong to European Union? | No |
| calling_code | string | Calling code of the country. | No |
| country_tld | string | country_tld | No |
| languages | string | Comma-separated list of the languages’ codes, spoken in the country. | No |
| country_flag | string | URL to get the country flag. | No |
| geoname_id | number | Geoname ID of the place from geonames.org | No |
| isp | string | Name of the ISP holding the IP address. | No |
| connection_type | string | Type of the connection, consuming the IP address. | Yes |
| organization | string | Name of AS organization holding the IP address. | Yes |
| asn | string | Autonomous system number of the autonomous system, to which IP address belongs to. | Yes |
| currency.code | string | Currency code (ISO 4217). | No |
| currency.name | string | Currency name (ISO 4217). | No |
| currency.symbol | string | Currency symbol. | No |
| time_zone.name | string | Name (ISO 8601) of the time zone. | No |
| time_zone.offset | number | Time zone offset from UTC. | No |
| time_zone.current_time | string | Current time in ‘yyyy-MM-dd HH:mm:ss.SSS+ZZZ’ format. | No |
| time_zone.current_time_unix | float | Current time in seconds since 1970. | No |
| time_zone.is_dst | boolean | Is the time zone in daylight savings? | No |
| time_zone.dst_savings | number | Total daylight savings. | No |
| security.threat_score | number | IP address’ threat score. It ranges from 0 to 100. 100 indicates highest threat and vice versa for lower score. | No |
| security.is_tor | boolean | Indicates if the IP address is being consumed on a Tor endpoint. | No |
| security.is_proxy | boolean | Indicates if the IP address belongs to a proxy networ | No |
| security.proxy_type | string | Type of the proxy network if the IP address belongs to a proxy network.. | Yes |
| security.is_anonymous | boolean | Indicates if the IP address is being used anonymously. | No |
| security.is_known_attacker | boolean | Indicates if the IP address is enlisted as an attacking IP address. | No |
| security.is_cloud_provider | boolean | Indicates if the IP address belongs to a cloud provider (computing infrastructure providers). | No |
| user_agent.userAgentString | string | User-Agent string passed along with the query in the User-Agent header. | No |
| user_agent.name | string | User-Agent Name. | No |
| user_agent.type | string | User-Agent Class | No |
| user_agent.version | string | User-Agent Version. | No |
| user_agent.versionMajor | string | User-Agent Version Major. | No |
| user_agent.device.name | string | Device Name. | No |
| user_agent.device.type | string | Device Type. | No |
| user_agent.device.brand | string | Device Brand. | No |
| user_agent.device.CPU | string | Device CPU Model. | No |
| user_agent.engine.name | string | Layout Engine Name.t | No |
| user_agent.engine.type | string | Layout Engine Class | No |
| user_agent.engine.version | string | Layout Engine Version. | No |
| user_agent.engine.versionMajor | string | Layout Engine Version Major. | No |
| user_agent.operatingSystem.name | string | Operating System Name. | No |
| user_agent.operatingSystem.type | string | Operating System Class | No |
| user_agent.operatingSystem.version | string | Operating System Version. | No |
| user_agent.operatingSystem.versionMajor | string | Operating System Version Major. | No |
Error Codes
IP Geolocation API returns 200 HTTP status for a successful API request along with the response.
While, in case of a bad or illegal request, IP Geolocation API returns 4xx HTTP code along with a descriptive message as why the error occured.
Here is the description of why a specific HTTP code is returned:
| HTTP Status | Description |
|---|---|
| 401 | It is returned for one of the following reasons:
|
| 403 | It is returned for one of the following reasons:
|
| 404 | If the queried IP address is a [bogon]() (bogus IP address from the bogon space) IP address. |
| 429 | It is returned for one of the following reasons:
|

