What is the Best IP Geolocation API?
We analyse some of the most popular IP Geolocation APIs and provide code examples, cost, rate limits and everything else you need to make a decision.
In this article we compare several commercial IP Geolocation APIs based on a number of factors such as data quality, API infrastructure and latency, documentation and more.
We’ll focus only on commercial solutions given that free services tend to disappear and not to have a lot invested in their infrastructure. However every single one of these services has a free tier that you can get started with.
ipdata’s API is used by NASA, AMD, Comcast, Mckinsey and hundreds of other companies! Sign up for a free plan and checkout our documentation!
List of Contents
Click on any one of the following services to jump to its section.
Notes;
- We used a third party monitoring tool to monitor each API for 24 hrs. We sent a request every 30 seconds from 8 locations globally. Los Angeles - US, Miami - US, Montreal - Canada, Gravelines - France, Frankfurt - Germany, Singapore, Tokyo - Japan, Sydney - Australia.
Maxmind GeoIP2 Precision Services


Endpoint: https://{account_id}:{license_key}@geoip.maxmind.com/geoip/v2.1/city/{ip}
API Key: Required
API Latency: 44ms

Data Quality
Maxmind claim that their GeoIP2 web services have their most accurate data. Geolocating 9% more IPs to postal codes and 4% more IPs to cities in the United States than their GeoIP2 Databases.
Maxmind are one of the few data providers that collect their own data and distribute it in downloadable databases.
Data Sample
The GeoIP2 web services have 3 endpoints; Country, City and Insights. The Insights endpoint provides the most data fields with the highest accuracy of the three and is also the most expensive at $2000 per million requests.
Note that you can get the same data fields from other providers for a much lower cost per million with equal or lower accuracy.
{
"city": {
"confidence": 0,
"geoname_id": 2151718,
"names": {
"en": "Research"
}
},
"continent": {
"code": "OC",
"geoname_id": 6255151,
"names": {
"ja": "オセアニア",
"pt-BR": "Oceania",
"ru": "Океания",
"zh-CN": "大洋洲",
"de": "Ozeanien",
"en": "Oceania",
"es": "Oceanía",
"fr": "Océanie"
}
},
"country": {
"confidence": 99,
"iso_code": "AU",
"geoname_id": 2077456,
"names": {
"zh-CN": "澳大利亚",
"de": "Australien",
"en": "Australia",
"es": "Australia",
"fr": "Australie",
"ja": "オーストラリア",
"pt-BR": "Austrália",
"ru": "Австралия"
}
},
"location": {
"accuracy_radius": 1000,
"latitude": -37.7,
"longitude": 145.1833,
"time_zone": "Australia/Melbourne"
},
"maxmind": {
"queries_remaining": 2457
},
"postal": {
"confidence": 0,
"code": "3095"
},
"registered_country": {
"iso_code": "AU",
"geoname_id": 2077456,
"names": {
"en": "Australia",
"es": "Australia",
"fr": "Australie",
"ja": "オーストラリア",
"pt-BR": "Austrália",
"ru": "Австралия",
"zh-CN": "澳大利亚",
"de": "Australien"
}
},
"subdivisions": [{
"confidence": 0,
"iso_code": "VIC",
"geoname_id": 2145234,
"names": {
"ru": "Виктория",
"en": "Victoria",
"pt-BR": "Vitória"
}
}],
"traits": {
"user_type": "content_delivery_network",
"autonomous_system_number": 13335,
"autonomous_system_organization": "Cloudflare Inc",
"isp": "APNIC and Cloudflare DNS Resolver project",
"organization": "APNIC and Cloudflare DNS Resolver project",
"ip_address": "1.1.1.1"
}
}Infrastructure
The GeoIP2 web service is served from 4 endpoints hosted by Softlayer in;
- Virginia (US)
- San Jose, California (US)
- London (UK)
- Singapore
Maxmind use latency based routing to send your requests to the region they believe is closest to you so that your request are served with the lowest latency.
Their automatic routing is however iffy and on testing a call from a server in Africa my request is handled by one of their US endpoints, whereas I’d expect to be routed to their UK endpoint.
Also running dig on their endpoint returns a single A record which means they’re terminating all requests on a single server. This is probably not the most highly available setup.
Cost
For basic city level geolocation via the City endpoint, you’d pay $400 per million calls or $0.0004 per request.
The Insights endpoint would cost you $0.002 per request or $2000 per million calls.
They mention on their Pricing page that they have discounts for volumes above $2500/month.
Getting Started
Maxmind have good documentation and have libraries for multiple languages .
The API uses Basic Authorization and requires HTTPs as a result, to safely transmit the login details.
Sign up for a Free Trial account here where you’ll get a $5 credit, enough for 12,500 City endpoint requests.
Then try;
curl -u “{account_id}:{license_key}” \ “https://geoip.maxmind.com/geoip/v2.1/insights/me?pretty"And
curl -u “{account_id}:{license_key}” \
“https://geoip.maxmind.com/geoip/v2.1/insights/{ip_address}?pretty"IPData.co Geolocation and Threat Data API


Endpoint: https://api.ipdata.co?api-key=test
API Key: Required
API Latency: 65ms


Data Sample
The IPData API provides;
- Geolocation Data — Country, Region, City, Lat/Long, Postal Code, ISP and Organisation
- Carrier Detection — we’ll return the Carrier’s brand name for example Verizon, T-Mobile, their Mobile Country Code and Mobile Network Code
- Tor Detection — We return a flag that tells you whether an IP address is a Tor Exit node
- Proxy Detection — We aggregate multiple lists that track open proxies and return a flag telling you whether an IP address is a proxy or not
- Threat Data — This checks whether an IP address has recently been reported to be a source of malicious activity
- Currency Data — The major currency in the country the IP address belongs to. Including the symbol, code and name.
- Timezone Data — The timezone of the region the IP address belongs to
- Language Data — The major languages in the country the IP address belongs to
- EU Detection — whether an IP address belongs to a country in the European Union
{
"ip": "1.1.1.1",
"is_eu": false,
"city": "Research",
"region": "Victoria",
"region_code": "VIC",
"country_name": "Australia",
"country_code": "AU",
"continent_name": "Oceania",
"continent_code": "OC",
"latitude": -37.7,
"longitude": 145.1833,
"asn": "AS13335",
"organisation": "Cloudflare Inc",
"postal": "3095",
"calling_code": "61",
"flag": "https://ipdata.co/flags/au.png",
"emoji_flag": "🇦🇺",
"emoji_unicode": "U+1F1E6 U+1F1FA",
"languages": [
{
"name": "English",
"native": "English"
}
],
"currency": {
"name": "Australian Dollar",
"code": "AUD",
"symbol": "AU$",
"native": "$",
"plural": "Australian dollars"
},
"time_zone": {
"name": "Australia/Melbourne",
"abbr": "AEST",
"offset": "+1000",
"is_dst": false,
"current_time": "2018-07-05T05:22:19.138894+10:00"
},
"threat": {
"is_tor": false,
"is_proxy": false,
"is_anonymous": false,
"is_known_attacker": false,
"is_known_abuser": false,
"is_threat": false,
"is_bogon": false
}
}All the above data is available on the free tier as well as on all paid plans.
Carrier Data Sample
{
"name": "T-Mobile",
"mcc": "310",
"mnc": "160"
}Threat Data Sample
{
“is_tor”: true,
“is_proxy”: false,
“is_anonymous”: true,
“is_known_attacker”: false,
“is_known_abuser”: true,
“is_threat”: true,
“is_bogon”: false
}To test the threat data, randomly pick IP addresses from the Tor Exit Node List, is_tor and is_anonymous will be true.
Tor Exit nodes are also often used by malicious users and you may also see that a number of IPs will return is_known_abuser and is_known_attacker as true.
For more details see the Threat Data Documentation
Infrastructure
IPData provides a highly available API running on Amazon’s global infrastructure.
Read about our Infrastructure on the Highscalability Blog and on the AWS Startups Blog. The API is served from 11 endpoints globally with 4 in the US alone and 1 in Canada.
- Virginia (US)
- Ohio (US)
- North California (US)
- Oregon (US)
- Canada
- Frankfurt (Germany)
- London (UK)
- Seoul (S. Korea)
- Sydney (Australia)
- Mumbai (India)
- Sao Paulo (Brazil)
We use AWS Route53’s latency based routing to serve your requests from the region closest to you.
A dig of the API endpoint will return 2 random A records from the endpoint closest to you. Each APIGateway endpoint is infinitely scalable and able to handle 10,000+ requests a second and more!
Testing from my laptop, majority of my requests get routed to Mumbai, and the rest to Frankfurt. Which makes sense because those datacenters are geographically the closest to me.
Cost
Our smallest plan is $10 a month for 2500 requests daily or 75,000 requests a month. Our largest plan is $120 a month for 100,000 requests a day or 3,000,000 requests a month.
We have Enterprise pricing starting from 1,000,000 requests or more a day at $20 per million calls.
There are 4 pricing tiers;


- Basic — 2500 requests daily or 75,000 requests a month at $10
- Lite — 10,000 requests daily or 300,000 requests a month at $30
- Startup — 50,000 requests daily or 1,500,000 requests a month at $50
- Business — 100,000 requests daily or 3,000,000 requests a month at $120
We have a low cost per million and we pass those savings onto our users.
All plans are 20% off on Annual subscription.
You can contact us for Enterprise pricing.
Getting Started
We have very simple documentation here with examples in multiple languages and a number of language specific libraries contributed by the community.
The API is served only via HTTPs and handles authentication via API keys passed in as a query string parameter called “api-key” or a header of the same name.
Signup for a Free API key here. The free tier allows 1500 requests a day or 45,000 requests a month.
Examples;
To get the calling ip addresses’ data
curl https://api.ipdata.co?api-key=test
To lookup a specific ip address
curl https://api.ipdata.co/1.1.1.1?api-key=test
You can also select a specific field, for example the country_name alone
curl https://api.ipdata.co/1.1.1.1/country_name?api-key=test
Or the is_eu field
curl https://api.ipdata.co/1.1.1.1/is_eu?api-key=test
IPInfo.io Geolocation and Data Solutions


Endpoint: https://ipinfo.io/json
API Key: Not Required
API Latency: 165ms


Data Sample
The IPInfo.io API returns basic geolocation data on their Free Tier and on their cheapest plan.
Each successive pricing tier comes with more data.
- Basic Plan — Provides basic Geolocation and ASN details
- Standard Plan — Basic plus the ASN type, that is whether the ASN is business, hosting or ISP. You also get to do lookups by ASN and get Priority support.
- Pro Plan — Everything in Standard plus Company and Carrier details. You also get the IP type, that is whether an IP address belongs to a business, hosting provider or ISP.
The API also returns the hostname associated with an IP address.
{
"ip": "1.1.1.1",
"hostname": "1dot1dot1dot1.cloudflare-dns.com",
"city": "Research",
"region": "Victoria",
"country": "AU",
"loc": "-37.7000,145.1830",
"postal": "3095",
"org": "AS13335 Cloudflare, Inc."
}This is the data provided on the free API.
Their Company data looks like this;
{
“ip”: “38.104.128.99”,
“name”: “American Heart Association”,
“domain”: “americanheart.org”
}The Carrier data looks like this;
{
“ip”: “201.144.87.19”,
“carrier”: “Telcel”,
“country”: “MX”,
“mcc”: “334”,
“mnc”: “20”
}Infrastructure
IPInfo have 3 endpoints running on Google Cloud in;
- California
- London
- Frankfurt
You can read about IPInfo.io’s infrastructure on their blog.
Running dig on the ipinfo.io endpoints returns 4 A records all belonging to Google. Showing a highly available setup with loadbalancing. IPInfo also use latency based routing to serve your requests from the endpoint closest to you.
Their routing also seems to route all my requests to a server in California, whereas I’d expect my requests to be served from their European endpoints.
Cost


We mentioned IPInfo’s 3 plans earlier without the pricing and volumes. Remember that each tier comes with additional data.
Here it is;
- Basic Plan — 250,000 requests a month for a $49 monthly subscription
- Standard Plan — 2,000,000 requests a month for a $249 monthly subscription
- Pro Plan — 6,000,000 requests a month for a $999 monthly subscription
They have custom pricing for volumes above 6M calls a month.
You get 2 months free or 16% off when you purchase an annual subscription.
Getting Started
You don’t need an API key to make requests to the ipinfo API.
The Documentation is mostly CLI examples. With a couple of links to language specific libraries here.
Sign up for a free API key here.
To get your own ip information
curl ipinfo.io
To lookup a specific ip address
curl ipinfo.io/8.8.8.8
Example with Authentication;
With Basic Auth
curl -u {api-key}: ipinfo.ioWith Bearer token
curl -H ‘Authorization: Bearer {api-key}’ ipinfo.ioWith token query parameter
curl ipinfo.io?token={api-key}IP-API.com


Endpoint: http://ip-api.com
API Key: Not Required
API Latency: 97ms
HTTPS Support: Only on Pro


Data Sample
IP-API.com only return geolocation data and has none of the enriched data that other providers offer. They are however the only provider to offer an unlimited plan for as little as EUR 45 for 3 months.
The API is unlimited only so long as you make less than 150 requests a minute or about 2 requests/second.
From the testing I did the API seems stable and fast and is supposed to serve hundreds of millions of calls day.
Infrastructure
I wasn’t able to find a list of ip-api.com’s servers. However from running tests off of a few servers, I was able to find endpoints in;
- Romania
- Germany
- Missouri (US)
Running dig on the ip-api.com endpoint returns 2 A record from the endpoint closest to you.
Their latency based routing seems to work just fine, and my requests are served from Romania and Germany. Testing from a server in the US the requests are served within the US.
I expect there are more endpoints around the world, for the API to give the kind of consistently high performance I found on testing.
Cost
The Pro version of ip-api.com offers 3 plans all with unlimited requests.
- 3 months access at €45
- 6 months access for €85
- 12 months access for €160 or €13 per month
Getting Started
You can sign up for a paid plan here. You however don’t need an API key to start using the service.
Note that the free tier only allows requests over plain HTTP. Commercial use is also not allowed on the free tier.
Lookup your own ip data
curl http://ip-api.com/json
Lookup a specific ip address
curl http://ip-api.com/json/1.1.1.1


Endpoint: https://ipapi.co/json
API Key: Not Required
API Latency: 270ms


Data Sample
ipapi.co return the basic Geolocation data and a single field each for currency, timezone, languages and UTC offset.
{
"ip": "1.1.1.1",
"city": "Research",
"region": "Victoria",
"region_code": "VIC",
"country": "AU",
"country_name": "Australia",
"continent_code": "OC",
"in_eu": false,
"postal": "3095",
"latitude": -37.7,
"longitude": 145.1833,
"timezone": "Australia/Melbourne",
"utc_offset": "+1000",
"country_calling_code": "+61",
"currency": "AUD",
"languages": "en-AU",
"asn": "AS13335",
"org": "Cloudflare Inc"
}Infrastructure
There’s not much documented about ipapi.co’s infrastructure other than the fact that it’s auto scaling.
On running dig on the ipapi.co endpoint, 2 A records are returned, however both belong to Cloudflare, which implies that requests pass through Cloudflare’s edge locations before being routed to their backend.
Which would explain the APIs low apdex. From the updown data the majority of requests (861) are served in 500ms with only 178 being served in under 125ms
Cost
- Free 1000 requests a day
- 2000 requests daily for $15 monthly
- 5000 requests daily for $25 monthly
- 15,000 requests daily for $49 monthly
- 50,000 requests daily for $99 monthly
- 200,000 requests daily for $199 monthly
- 500,000 requests daily for $399 monthly
There’s also a 20% discount for Annual signups.
Getting Started
You don’t need to sign up to use the ipapi.co API.
The API is documented here
ipstack.com


Endpoint: http://api.ipstack.com
API Key: Required
API Latency: 144ms


Data Sample
IPStack.com give you more data on larger plans. They currently have 4 plans;
- Free — Only Geolocation data. No SSL support. Commercial use is not allowed.
- Basic — SSL support. Location, Currency, Timezone and Connection data.
- Professional — Everything in Basic and access to a Bulk Lookup endpoint.
- Professional Plus — Everything in Professional plus access to security data including; proxy, crawler and tor detection.
Their Free plan returns only Geolocation data. Like below;
{
"ip": "134.201.250.155",
"type": "ipv4",
"continent_code": "NA",
"continent_name": "North America",
"country_code": "US",
"country_name": "United States",
"region_code": "CA",
"region_name": "California",
"city": "Huntington Beach",
"zip": "92648",
"latitude": 33.6746,
"longitude": -118.0086,
"location": {
"geoname_id": 5358705,
"capital": "Washington D.C.",
"languages": [{
"code": "en",
"name": "English",
"native": "English"
}],
"country_flag": "http:\/\/assets.ipstack.com\/flags\/us.svg",
"country_flag_emoji": "\ud83c\uddfa\ud83c\uddf8",
"country_flag_emoji_unicode": "U+1F1FA U+1F1F8",
"calling_code": "1",
"is_eu": false
}
}Infrastructure
IPStack currently have only one endpoint in San Jose (US) hosted by Softlayer.
Running dig on the api.ipstack.com endpoint returns a CNAME record for apilayer.net. Apilayer is the company behind ipstack.com and a number of other APIs.
Running dig again on apilayer.net returns 2 A records for 2 servers, one in Dallas (US) and another in San Jose (US). This means both US coasts are covered, however it means European users and other users outside the US will experience high latency.
Cost


- Basic — 50,000 requests a month for $10
- Professional — 500,000 requests a month for $50
- Profressional Plus — 2,000,000 requests a month for $100
There’s a 20% annual discount.
Getting Started
Check out ipstack’s documentation here.
You can sign up for an API key here. You need to sign up for the free tier.
Then lookup your own ip address data
curl http://api.ipstack.com/check?access_key={api-key}
Or lookup any other ip address
curl http://api.ipstack.com/134.201.250.155?access_key={api-key}
db-ip.com


Endpoint: https://api.db-ip.com/v2/{api-key}/1.1.1.1
API Key: Required
API Latency: 225ms


Data Sample
db-ip.com are the only other provider in this list that offer a downloadable version of their data.
{
"ipAddress": "1.1.1.1",
"continentCode": "OC",
"continentName": "Oceania",
"countryCode": "AU",
"countryName": "Australia",
"stateProv": "Queensland",
"city": "South Brisbane"
}Infrastructure
Their website mentions that they use Anycast to ensure your requests are served from the endpoint closest to you. They also mention that their infrastructure is global, however I haven’t found a list of endpoints on their site.
Cost


- Starter — 50,000 requests daily for 15.90 Euros
- Premium — 1,000,000 requests daily for 99.90 Euros
- Enterprise — Unlimited requests for 499.90
Getting Started
Their documentation seems straighforward however the examples are only in PHP and Javascript.
You need an API key to access their free tier. The free tier allows 1000 requests a day, cannot be accessed over HTTPS and returns limited data as mentioned in their Docs
Get your Public IP Address in Javascript with ipify.org
If all you need is a simple API to determine the IP Address of a host in Javascript then we recommend ipify.org.
Randall Degges, ipify.org’s creator wrote a very interesting story about how ipify.org started and grew to serving 30 Billion calls a month on Heroku.
You can read the article on his blog — To 30 Billion and Beyond.
Ipify is free to use without limit, and to quote their homepage “even if you’re doing millions of requests per minute”!
Examples
curl ‘https://api.ipify.org'
Or to get the response in JSON
curl ‘https://api.ipify.org?format=json'