An IP geolocation API enables websites and services to discover a visitor's location. IP geolocation services achieve this by using iplookup to detect their IP address. This is particularly important where there's potential for fraud. A classic example is online stores. Here, if a user's IP address doesn't correspond with the country they've entered, then that could indicate fraud. Banking is another important use case for obvious reasons. The catch is, there are ways of bypassing this geolocation. If the user is using a VPN or a proxy, then it'll create a spoof IP address that could belong to any country.
So if you're in the market for an IP geolocation API, what are the leading players out there? Where do they excel? This list covers a range of vendors, some of whom are API only while others offer database options as well. That said, this resource is focused on APIs, so it won't be exploring databases or other products in the vendor's ecosystem.
Many of the APIs on this list use IP data to offer similar geolocation features such as continent/country and city etc. However, there can still be important distinctions between each product. Some go much further in geolocation information. Others offer features such as VPN, proxy, or anonymizer detection.
Let's take a closer look at some interesting options.
Abstract
Abstract's IP geolocation API is REST making it easy to use and maintain. This ease of use combined with multiple libraries, documentation and tutorials means you'll be extracting value from IP geolocation quickly.
Abstract maintains long-standing relationships with ISPs to source authoritative IP data and now covers more than 250,000 cities around the world. This is updated daily to maintain accuracy with reliable uptime. It covers IPv4 and IPv6 and is also encrypted using 256 bit SSL encryption via HTTPS. IP geolocation can provide highly accurate location information including latitude and longitude, time zone, and can even output the country as a flag or emoji. The two top tier plans can also serve up to 500 requests per second. It's also capable of VPN, anonymizer, proxy, and crawler detection. It's also available in a wide range of programming languages/libraries including cURL, JavaScript, jQuery, Node, JS, Python, Ruby, Java, PHP, Go, and Postman. All you need to do is select the right option for you and the API key will be made available
Abstract's IP geolocation API can be tried for free. This non-commercial version allows up to 20,000 API calls per month. All location features are available at all product levels with the only difference being the number of API calls and support available. There's also an enterprise-level option if SLAs are needed.
ip2location
ip2location is an easy to integrate, unintrusive geolocation tool that supports IPv4 and IPv6.
It can offer a lot of geolocation data spanning not just country and city, latitude and longitude and time zone, but elevation and the local weather station.
However, the package is highly segmented. To use ip2location you need to buy credits with additional levels of location detail requiring additional credits. So whereas a simple country, region, city pack costs two credits, the top of the line pack costs 20. Add-ons could also increase costs and proxy detection requires a separate package.
ipstack
ipstack's geolocation API was designed to be both scalable and easy to use. It covers IPv4 and IPv6 address IP data, and can be implemented in under 10 minutes. It's divided into a series of modules: location, currency, time zone, connection, and security.
All the modules except security are in all the paid packages, with the security module only becoming available with the top end 'Professional Plus' package. There's a free option for light users (up to 5,000 API returns per month). The 'Professional Plus' package tops out at two million requests per month, but there's an additional package for enterprises if you have heavier needs.
ipapi
A REST API, ipapi claims set-up times of under 10 minutes. ipapi can provide geolocation data including country flag, postal code, time zone, currency, and threat data. It also offers anonymizing (TOR) and proxy detection.
ipapi's homepage does a great job of visually illustrating different applications for their API. One example is sourcing geolocation to enable the targeting of marketing campaigns to specific regions.
There's a free option to serve light needs and even the cheapest commercial package includes all location capabilities. The higher two packages offer more API calls and high priority support, along with bulk lookups and security data.
MaxMind
MaxMind's GeoIP2 Precision Services API is available in a wide range of different programming languages including .NET, Java, Python, and PHP. Its geolocation capabilities include accuracy radius information to provide a confidence level.
There's a free plan with commercial versions segmented by available features. Unfortunately, this means that the cheapest commercial package never gets more accurate than country level. Also, the pricing is per API call, not flat rate packages, so you'll need up-to-date data on how many calls you're going to be making.
ip-api
ip-api offers a free version of their geolocation service capable of delivering geolocation information as detailed as latitude and longitude, and internet service provider. It's capable of providing responses in JSON, XML, CSV, Newline, and PHP. ip-api has servers across the world, claiming response times of no more than 50 ms in most locations.
Like other vendors, ip-api offers a free option for non-commercial/limited use. Unlike other vendors, there are only two priced versions for commercial use with little difference between the two. Even the cheaper of the two packages offers unlimited requests.
DB-IP
DB-IP are focused on using geolocation to enable the provision of country-specific experiences in an easy to integrate product.
DB-IP offers both API and database options. It's a RESTful API using JSON encoding supporting calls either by PHP client library or direct API calls by HTTP or HTTPS. It also offers a dashboard complete with analytics.
DB-IP offers one free plan and three paid products. The free version is limited to 1,000 requests per day and its location information stops at city level. Features scale up across the paid packages. Each package is also split into three pricing levels which scale the number of API requests and level of support to serve a wider range of use cases.
ipgeolocation
ipgeolocation's IP Location API has SDKs in Java, C#, Typescript, JavaScript, PHP, and JQuery. It outputs in JSON or XML format, and nine different languages. It also boasts response times of under 40 ms. Geographical location data is detailed including latitude and longitude, ISO 3166-1 compliant country codes, calling code, time, and currency. It also provides anonymizer/proxy detection.
The free option can serve up to 1,000 requests per day or 30,000 per month. It also uses HTTPS which most other products reserve for paid packages. All that separates the paid packages is the number of API requests each supports. Should you need more than 50 million per month, there's an enterprise option.
ip-info
ip-info does a great job on their website at showing how their geolocation API can be used in different sectors. Their use cases span e-commerce, financial services, gaming, and more.
It uses 256 bit SSL encryption and is available in 10 different programming languages. It can provide country name and country code, latitude and longitude, and ISP data, alongside anonymizer/proxy detection.
The free option handles up to 50,000 API requests per month. The paid options scale the features and the number of monthly API requests. The pricing and package options, such as an account manager to aid implementation, indicate that ip-info is targeting corporate clients.
ip location finder
ip location finder's website is strange, making it difficult to source simple information, while making it easy to understand how to integrate it with a wide range of CDNs. It's a RESTful API available in PHP, C#, Python, and Node.
Geolocation information uses IP data to go to latitude and longitude level. Also available is ISP detection, ISP data, anonymizer/proxy detection, and more.
Pricing is structured per GB of data up to one of four monthly limits. So you'll need to be clear about how much data you're likely to use.
Geolocation API
Developed by the W3C internet standards organization, Geolocation API is a free API based on JavaScript binding and requires browser support using HTTPS. As you'd expect from W3C, it's intended to be agnostic.
Given this, you won't be surprised to learn that it's focused on offering minimal functionality in a standardized manner. However, documentation is present and it's been integrated into the W3C School environment for you to practice. So if you don't need anything other than latitude and longitude, this could be worth a look.
Summary
Almost all the products offer the same core geolocation features, typically going down to city level. Beyond that, differences can be significant with differing levels of capability available in detecting attempts to circumvent geolocation by creating a spoof IP address, for example.
Most products are priced at flat monthly rates. However, a few are priced per API call or per GB of data. The per call/GB model means costs will drop if usage does. However, it also means that if you experience rapid growth, you could end up paying more than you would with flat-rate pricing.
Assess your likely usage carefully allowing for growth when you write up your use cases. Then, with so many free options available, you can test them to determine which does the best job of meeting your feature, security and cost needs.