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. Our services are globally available with latency-based routing.
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.
{
"ip": "8.8.8.8",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"country_capital": "Washington, D.C.",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara County",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false,
"calling_code": "+1",
"country_tld": ".us",
"languages": "en-US,es-US,haw,fr",
"country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
"geoname_id": "6301403",
"country_emoji": "🇺🇸"
}
IP to Currency module provides currency information of the country such as currency name, currency symbol and currency code from an IP address.
"currency":{
"name": "US Dollar",
"code": "USD",
"symbol": "$"
}
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.
"time_zone":{
"name": "America/Los_Angeles",
"offset": -8,
"offset_with_dst": -7,
"current_time": "2024-10-02 00:06:41.301-0700",
"current_time_unix": 1727852801.301,
"is_dst": true,
"dst_savings": 1,
"dst_exists": true,
"dst_start": {
"utc_time": "2024-03-10 TIME 10",
"duration": "+1H",
"gap": true,
"dateTimeAfter": "2024-03-10 TIME 03",
"dateTimeBefore": "2024-03-10 TIME 02",
"overlap": false
},
"dst_end": {
"utc_time": "2024-11-03 TIME 09",
"duration": "-1H",
"gap": false,
"dateTimeAfter": "2024-11-03 TIME 01",
"dateTimeBefore": "2024-11-03 TIME 02",
"overlap": true
}
}
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, ASN and the connection type (wired or wireless).
{
"isp": "Level 3 Communications",
"connection_type": "wired",
"organization": "Google Inc.",
"asn": "AS15169"
}
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.
"security":{
"threat_score": 42,
"is_tor": false,
"is_proxy": true,
"proxy_type": "VPN",
"is_anonymous": true,
"is_known_attacker": true,
"is_spam": false,
"is_bot": false,
"is_cloud_provider": true
}
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.
"user_agent":{
"userAgentString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15",
"name": "Safari",
"type": "Browser",
"version": "13.0.5",
"versionMajor": "13",
"device": {
"name": "Apple Macintosh",
"type": "Desktop",
"brand": "Apple",
"cpu": "Intel"
},
"engine": {
"name": "AppleWebKit",
"type": "Browser",
"version": "605.1.15",
"versionMajor": "605"
},
"operatingSystem": {
"name": "Mac OS",
"type": "Desktop",
"version": "10.15.3",
"versionMajor": "10.15"
}
}
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.
curl 'https://api.ipgeolocation.io/ipgeo?include=hostname&ip=8.8.8.8&apiKey=API_KEY'
{
"ip":"8.8.8.8",
"hostname":"dns.google",
"..."
}
Enter the domain address in 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.
{
"domain": "ipgeolocation.io",
"ip": "104.20.61.122",
"isp": "Cloudflare, Inc.",
"asn": "AS13335",
"..."
}
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.
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"]
}'
You can retrieve the geolocation information for an IP address in the following languages:
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%.
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.
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.
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.
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 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:
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"country_capital": "Washington, D.C.",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false,
"calling_code": "+1",
"country_tld": ".us",
"languages": "en-US,es-US,haw,fr",
"country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
"geoname_id": "6301403",
"isp": "Google LLC",
"connection_type": "",
"organization": "Google LLC",
"country_emoji": "🇺🇸",
"asn": "AS15169",
"currency": {
"code": "USD",
"name": "US Dollar",
"symbol": "$"
},
"time_zone": {
"name": "America/Los_Angeles",
"offset": -8,
"offset_with_dst": -7,
"current_time": "2024-09-19 00:19:04.376-0700",
"current_time_unix": 1726730344.376,
"is_dst": true,
"dst_savings": 1,
"dst_exists": true,
"dst_start": {
"utc_time": "2024-03-10 TIME 10",
"duration": "+1H",
"gap": true,
"dateTimeAfter": "2024-03-10 TIME 03",
"dateTimeBefore": "2024-03-10 TIME 02",
"overlap": false
},
"dst_end": {
"utc_time": "2024-11-03 TIME 09",
"duration": "-1H",
"gap": false,
"dateTimeAfter": "2024-11-03 TIME 01",
"dateTimeBefore": "2024-11-03 TIME 02",
"overlap": true
}
}
}
In order to find geolocation information about an IP address or a domain name, pass
it as a query parameter
ip
like below.
Note that apiKey
is also needed to be passed as a query parameter for authorization. This endpoint is
meant to be called from the server side.
Here's an example to get the geolocation information for '8.8.8.8'.
Here's an example to get the geolocation information for '2001:4860:4860::1'.
Here's an example to get the geolocation information for 'dns.google.com'.
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.
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,000) 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 to query the geolocation data for multiple IPs at once.
The geolocation information for an IP address from the IP Geolocation API can be retrieved in the following languages
By default, the API responds in English. You can change the
response language by passing the language code as a query
parameter
lang
. Here
is an example to get the geolocation data for IP adderss
'1.1.1.1' in Chinese language:
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.
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:
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:
Response
{
"ip": "1.1.1.1",
"city": "Kecamatan Margorejo"
}
Response
{
"ip": "1.1.1.1",
"country_code2": "ID",
"country_name": "Indonesia",
"country_name_official": "Republic of Indonesia"
}
{
"ip": "8.8.8.8",
"time_zone": {
"name": "America/Los_Angeles",
"offset": -8,
"offset_with_dst": -7,
"current_time": "2024-09-19 06:18:47.854-0700",
"current_time_unix": 1726751927.854,
"is_dst": true,
"dst_savings": 1,
"dst_exists": true,
"dst_start": {
"utc_time": "2024-03-10 TIME 10",
"duration": "+1H",
"gap": true,
"dateTimeAfter": "2024-03-10 TIME 03",
"dateTimeBefore": "2024-03-10 TIME 02",
"overlap": false
},
"dst_end": {
"utc_time": "2024-11-03 TIME 09",
"duration": "-1H",
"gap": false,
"dateTimeAfter": "2024-11-03 TIME 01",
"dateTimeBefore": "2024-11-03 TIME 02",
"overlap": true
}
}
}
You can use our filters with Bulk IP Lookup as well. Here is an example:
[
{
"ip": "1.0.1.0",
"currency": {
"code": "CNY",
"name": "Yuan Renminbi",
"symbol": "¥"
}
},
{
"ip": "8.8.8.8",
"currency": {
"code": "USD",
"name": "US Dollar",
"symbol": "$"
}
}
]
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.
{
"ip": "8.8.8.8",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false
}
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:
{
"ip": "8.8.8.8",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"country_capital": "Washington, D.C.",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false,
"calling_code": "+1",
"country_tld": ".us",
"languages": "en-US,es-US,haw,fr",
"country_flag": "https://ipgeolocation.io/static/flags/us_64.png",
"geoname_id": "6301403",
"isp": "Google LLC",
"connection_type": "",
"organization": "Google LLC",
"country_emoji": "🇺🇸",
"asn": "AS15169"
}
Third, You can combine the
fields
and
excludes
query parameters for fully customized API queries. This
approach helps you retrieve only the necessary data while
reducing response latency. Here's a sample code to demonstrate
how to use both parameters effectively:
{
"ip": "8.8.8.8",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421"
}
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 the 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:
{
"ip": "8.8.8.8",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false,
"security": {
"threat_score": 80,
"is_tor": false,
"is_proxy": true,
"proxy_type": "VPN",
"is_anonymous": true,
"is_known_attacker": true,
"is_spam": false,
"is_bot": false,
"is_cloud_provider": true
}
}
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:
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false
}
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.
IP Geolocation API also provides User-Agent information of the
client 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:
{
"ip": "8.8.8.8",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_name_official": "United States of America",
"state_prov": "California",
"state_code": "US-CA",
"district": "Santa Clara",
"city": "Mountain View",
"zipcode": "94043-1351",
"latitude": "37.42240",
"longitude": "-122.08421",
"is_eu": false,
"user_agent": {
"userAgentString": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
"name": "Chrome",
"type": "Browser",
"version": "128",
"versionMajor": "128",
"device": {
"name": "Linux Desktop",
"type": "Desktop",
"brand": "Unknown",
"cpu": "Intel x86_64"
},
"engine": {
"name": "Blink",
"type": "Browser",
"version": "128",
"versionMajor": "128"
},
"operatingSystem": {
"name": "Linux",
"type": "Desktop",
"version": "??",
"versionMajor": "??"
}
}
}
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.
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_name_official | string | Official name (ISO 3166) of the country. | No |
country_capital | string | Name of the country’s capital. | No |
state_prov | string | Name of the state/province/region. | Yes |
state_code | string | Code 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/Postal code of the place | Yes |
latitude | string | Latitude of the place. | No |
longitude | string | 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 | Top Level Domain Name (TLD) of the country | 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 | string | Geoname ID of the place from geonames.org | Yes |
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 |
country_emoji | string | Emoji of the Country flag. | 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.offset_with_dst | number | Time zone with DST 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 |
time_zone.dst_exists | boolean | Whether Daylight Saving Time (DST) is observed in the region. | No |
time_zone.dst_start.utc_time | string | The date and time in UTC when DST begins. | No |
time_zone.dst_start.duration | string | The time change that occurs when DST starts. | No |
time_zone.dst_start.gap | boolean | Is there a gap when the clocks jump forward or not. | No |
time_zone.dst_start.dateTimeAfter | string | The local date and time that immediately follows the start of DST. | No |
time_zone.dst_start.dateTimeBefore | string | The local date and time immediately before DST begins. | No |
time_zone.dst_start.overlap | boolean | Whether there is an overlap of time due to clocks being set back when DST starts. | No |
time_zone.dst_end.utc_time | string | The date and time in UTC when DST ends. | No |
time_zone.dst_end.duration | string | The time change that occurs when DST ends. | No |
time_zone.dst_end.gap | boolean | Is there a gap when the clocks jump backward or not. | No |
time_zone.dst_end.dateTimeAfter | string | The local date and time that immediately follows the ends of DST. | No |
time_zone.dst_end.dateTimeBefore | string | The local date and time immediately before DST ends. | No |
time_zone.dst_end.overlap | boolean | Whether there is an overlap of time due to clocks being set back when DST ends. | 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_spam | boolean | Indicates if the IP address is enlisted as a spam IP address. | No |
security.is_bot | boolean | Indicates if the IP address is enlisted as a bot 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 | 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 |
IP Geolocation API returns HTTP status code 200 for a successful API request along with the response.
While, in case of a bad or invalid request, IP Geolocation API returns 4xx HTTP status code along with a descriptive message explaining the reason for the error.
Below is a detailed explanation of the specific HTTP status codes and their corresponding error conditions:
HTTP Status | Description |
---|---|
400 Bad Request |
It is returned for one of the following reasons:
|
401 Unauthorized |
It is returned for one of the following reasons:
|
403 Forbidden |
|
404 Not Found |
It is returned for one of the following reasons:
|
405 Method Not Allowed |
|
413 Content Too Large |
|
415 Unsupported Media Type |
|
423 Locked |
|
429 Too Many Requests |
It is returned for one of the following reasons:
|
499 Client Closed Request |
|
5XX Server Side Error |
|
To facilitate the developers, we have added some SDKs for various programming languages. The detailed documentation on how to use these SDKs is available in the respective SDK's documentation page linked below.
Our SDKs are also available on Github. Feel free to help us improve them. Following are the available SDKs: