IP geolocation APIs play a critical part in enabling functionality and security for many websites that you visit routinely. When you go to an e-commerce website it may offer to take you to the local site or change to your local currency – this functionality is provided by IP geolocation. The API has used IP lookup to match your IP address to a geographical location based on data provided by ISPs (Internet Service Providers).
However, IP geolocation services can also play a vital role in defending your website. In DDoS (Distributed Denial of Service) a website comes under widespread attack. Then, being able to detect IP addresses, will enable you to take that data back to the relevant ISP. They can then block those IP addresses themselves to slow or block the attack.
Also, some geolocation APIs have threat detection capabilities that allow them to detect attempts to obscure a user’s location. These can include proxies, TOR (anonymizers), and VPNs (Virtual Private Networks).
Here are some of the best IP geolocation APIs whose functionality could solve such problems for you.
Abstract IP Geolocation API
Abstract’s geolocation API is compatible with both IPv4 and IPv6 IP address data. Their IP geolocation database is updated daily via their ongoing relationship with ISPs. This is important because IP addresses are reallocated periodically, so this data can become out of date.
This is a REST API that’s quick and easy to implement and the API key can be sourced in seconds simply by registering on the Abstract website. Then, it’s just a matter of following the clear documentation available. There’s a free plan available that can support one API request per second to a maximum of 20,000 per month in total. All of the API’s lookup functionality is available at all pricing tiers as well. Higher tiers offer the capability to supply more API requests per second and per month in total, as well as some richer data.
Once implemented, you’ll be able to source location data such as country name and country flag, region, city, time zone, and latitude and longitude in real-time. This data can be acquired using PHP and output in JSON format. Bulk uploads can be handled using CSV.
This is also paired with threat detection data such as the capability to detect proxies, TOR and VPNs.
DB-IP’s geolocation API can lookup IPv4 and IPv6 addresses. Paired with their collaboration with ISPs, this API can detect more than 215,000 cities. It can also detect location information including ZIP or postal code and local currency.
The three product tiers (Basic, Core, and Extended) are segmented three times to accommodate more API calls per month. The number of calls ranges from 50,000 per day to unlimited. While there isn’t a separate free version, there are free trial options available.
While it does offer threat detection capabilities and analysis, this functionality is only available in the top tier (Extended).
Maxmind’s geolocation service is GeoIP2 Precision Services. This is segmented into three tiers. It can supply geolocation information such as time zone, postal code, and city, but this level of accuracy only becomes available in the second tier (City). It can also detect what type of anonymizer a website visitor might be using.
However, the full threat detection functionality is split off into a different product: minFraud Web Services. This can track threat data including the reputation of IP addresses, email addresses, and more, but it would mean acquiring two products.
The ipgeolocation.io API can source a wide spectrum of geolocation data. This includes local currency, calling code, ASN (ISP), and country code. This functionality is also available at all six pricing tiers. The first, Database, is free for non-commercial use while supporting a maximum of 1,000 requests per day for a total of 30,000 per month.
The included security can detect VPNs, proxies, TOR, or a cloud provider. It then takes this data to create a threat score which you can use to set a threshold for blocking access.
This geolocation service can source geolocation data such as region name, city, ZIP or postal code, and ASN. The product itself is split into a free and pro version. The free endpoint is limited to 45 HTTP requests per minute from an IP address. The free version also doesn’t even require an API key.
The Pro tier adds functionality and features such as unlimited API returns, SSL, and usage statistics. The Enterprise tier also offers custom terms or agreements.
The ipinfo IP geolocation API sources geolocation data such as ASN, time zone, and country-code to support a wide range of location-centric use cases. There’s a free API capable of supporting up to 50,000 requests per month. The four paid tiers offer increasing levels of functionality and monthly requests.
Threat detection such as VPN and TOR detection becomes available in the second paid tier: Business. However, the full spectrum of functionality is only available in the Privacy Detection API.
The location data gathering capabilities of ipdata include calling code, latitude/longitude, country flag, and more. There’s a free IP geolocation tier available for non-commercial use cases which supports 1,500 free daily requests. Above this are five paid tiers that support increasing amounts of daily requests, reaching 100,000 with the Business tier.
ipdata currently has over 600 million malicious IP addresses in its database. This database is referred to in threat analysis in addition to detecting VPNs, TOR, and proxies.
As you can see, many of the IP geolocation APIs have similar capabilities in terms of the data they can extract from IP addresses. What distinguishes them from each other is:
- Whether all functionality is available at all levels
- Whether threat detection is split into a separate product
- The number of API calls supported
These points of differentiation will be important to understand as you work up your use cases. Pay particular attention to threat detection capabilities. You don’t want to acquire what seems to be the right product only to discover the functionality you need is in a higher tier or separate product altogether.