What is the Best IP Geolocation API?

We analyse the most widely-used IP Geolocation APIs¹ their pros and cons including; data quality, cost, uptime and everything else you need to make a decision.

All of the services mentioned cost money. However every single one of them has a free tier that you can get started with and a few such as ipgeolocation.com, ipgeolocationapi.com and ipify.org are free public utilities.

ipdata’s API is used by NASA, Disney, Comcast, Mckinsey and hundreds of other companies! Sign up for a free plan and checkout our documentation!

Table of Contents

Click on any one of the following services to jump to its section.

  1. Maxmind GeoIP2 Precision Service
  2. IPData.co
  3. IPInfo.io
  4. IP2Location.com
  5. DP-IP.com
  6. IP-API.com
  7. IPGeolocation.io
  8. IPGeolocation.com
  9. ipapi.co
  10. ipstack.com
  11. ipify.org
  12. ipgeolocationapi.com

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 — Detect Online Fraud
and Locate Online Visitors

Endpoint: https://{account_id}:{license_key}@geoip.maxmind.com/geoip/v2.1/city/{ip}

API Key: Required

API Latency: 44ms

Image for post

Data Quality

Maxmind claim that their GeoIP2 web services have their most accurate location 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.

Update:

Maxmind now use Cloudflare as a CDN which should improve their uptime and global response time greatly.²

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 Fast Geolocation with Reliable Performance

Image for post
Image for post

Endpoint: https://api.ipdata.co?api-key=test

API Key: Required

API Latency: 65ms

Image for post
Image for post

Data Sample

The IPData API provides;

  • IP Address Location 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
  • ASN Detection — the ASN organization that the IP belongs to as well as the usage type of the organization eg. “hosting”, “isp”, “education” etc
{
"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",
"asn": {
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"route": "1.1.1.0/24",
"type": "hosting"
},
"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.

ASN Data Sample

{
"asn": "AS13335",
"name": "Cloudflare, Inc.",
"domain": "cloudflare.com",
"route": "1.1.1.0/24",
"type": "hosting"
}

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;

Image for post
Image for post
  1. Basic — 2500 requests daily or 75,000 requests a month at $10
  2. Lite — 10,000 requests daily or 300,000 requests a month at $30
  3. Startup — 50,000 requests daily or 1,500,000 requests a month at $50
  4. 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.

Reach out to sales@ipdata.co for Enterprise pricing.

Domain and IP Address Whitelisting

You have the option to restrict usage of your API Key to a list of domains or IP Addresses. To enable this for your API Key, send an email with your request to support@ipdata.co

Bulk Lookup

You can lookup up to a 100 IP addresses in one API call! This combined with the general speed of ipdata’s API means you can geolocate millions of IP addresses very quickly. More information in the Docs.

Getting Started

We have very simple documentation here with examples in multiple languages and a number of language specific libraries contributed by the community.

Image for post
Image for post

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

For IPv6

curl https://api.ipdata.co/2601:8:be00:cf20:ca60:ff:fe09:35b5?api-key=test

IPInfo.io Geolocation and Data Solutions

Image for post
Image for post

Endpoint: https://ipinfo.io/json

API Key: Not Required

API Latency: 165ms

Image for post
Image for post

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.

  1. Basic Plan — Provides basic Geolocation and ASN details
  2. 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.
  3. 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;

  1. California
  2. London
  3. 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

Image for post
Image for post

We mentioned IPInfo’s 3 plans earlier without the pricing and volumes. Remember that each tier comes with additional data.

Here it is;

  1. Basic Plan — 250,000 requests a month for a $49 monthly subscription
  2. Standard Plan — 2,000,000 requests a month for a $249 monthly subscription
  3. 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.io

With Bearer token

curl -H ‘Authorization: Bearer {api-key}’ ipinfo.io

With token query parameter

curl ipinfo.io?token={api-key}

IP2Location.com — Identify Geographical Location by IP Address

Image for post
Image for post

Endpoint: https://api.ip2location.com/v2/?ip=1.1.1.1&key={YOUR_API_KEY}&package=WS24&addon=continent,country,region,city,geotargeting,country_groupings,time_zone_info"

API Key: Required

Demo: https://www.ip2location.com/demo

HTTPS Support: Yes

Introduction

IP2Location is one of the oldest IP Geolocation services on the internet having been around for 18+ years. They publish about 24 IP Geolocation databases and provide a number of Proxy Detection Databases as well.

Here’s a sample of their Geolocation API response;

{
"country_code":"HK",
"country_name":"Hong Kong",
"region_name":"Hong Kong",
"city_name":"Hong Kong",
"latitude":"22.28552",
"longitude":"114.15769",
"zip_code":"-",
"time_zone":"+08:00",
"isp":"APNIC and CloudFlare DNS Resolver Project",
"domain":"cloudflare.com",
"net_speed":"T1",
"idd_code":"852",
"area_code":"02522",
"weather_station_code":"CHXX0049",
"weather_station_name":"Hong Kong",
"mcc":"-",
"mnc":"-",
"mobile_brand":"-",
"elevation":"4",
"usage_type":"CDN",
"credits_consumed":33,
"continent":{
"name":"Asia",
"code":"AS",
"hemisphere":[
"north",
"east"
],
"translations":[
]
},
"country":{
"name":"Hong Kong",
"alpha3_code":"HKG",
"numeric_code":"344",
"demonym":"Hong Kongese",
"flag":"https:\/\/cdn.ip2location.com\/assets\/img\/flags\/hk.png",
"capital":"-",
"total_area":"1104",
"population":"7428887",
"currency":{
"code":"HKD",
"name":"Hong Kong Dollar",
"symbol":"$"
},
"language":{
"code":"ZH",
"name":"Chinese"
},
"idd_code":"852",
"tld":"hk",
"translations":[
]
},
"region":{
"name":"Hong Kong",
"code":"HK",
"translations":[
]
},
"city":{
"name":"Hong Kong",
"translations":[
]
},
"geotargeting":{
"metro":"-"
},
"country_groupings":[
{
"acronym":"APAC",
"name":"Asia-Pacific"
},
{
"acronym":"APEC",
"name":"Asia-Pacific Economic Cooperation"
},
{
"acronym":"Four Asian Tigers",
"name":"Four Asian Tigers"
},
{
"acronym":"Greater China",
"name":"Greater China"
}
],
"time_zone_info":{
"olson":"Asia\/Hong_Kong",
"current_time":"2020-01-29T22:03:51+08:00",
"gmt_offset":28800,
"is_dst":"no"
}
}
}

Infrastructure

IP2Location run their service on AWS’ Cloudfront CDN.

Cost

Their API pricing can be found here.

They sell credits not subscriptions in the following tiers;

a. WS — $49 for 100,000 credits per year

b. WS10X — $441 for 1M credits per year

c. WS50X — $1960 for 5M credits per year

Note that one request does not necessarily translate to 1 credit. To lookup the country and city of an IP Address costs 2 credits. To get the country, region, city, longitude and latitude costs 5 credits. More on that here.

Getting Started

You need to sign up for a free API Key here which should allow you access to their free downloadable databases.

To lookup the IP Address 1.1.1.1 run

curl https://api.ip2location.com/v2/?ip=1.1.1.1&key={YOUR_API_KEY}&package=WS24&addon=continent,country,region,city,geotargeting,country_groupings,time_zone_info"

IP-API.com — IP Geolocation API

Image for post
Image for post

Endpoint: http://ip-api.com

API Key: Not Required

API Latency: 97ms

HTTPS Support: Only on Pro

Image for post
Image for post

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. Also, they are one of the few providers that support XML and CSV.

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;

  1. Romania
  2. Germany
  3. Missouri (US)

Running dig on the ip-api.com endpoint returns 2 A records 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

ipgeolocation.io — Free IP Geolocation API and IP Location Lookup Database

Image for post
Image for post

Endpoint: https://api.ipgeolocation.io/ipgeo

API Key: Required

API Latency: 51ms

HTTPS Support: Yes

Image for post
Image for post

Data Sample

The ipgeolocation.io provides you the current time, date, year, time zone and geolocation information from either timezone, lat/lang, country, city or IP Address information.

It support both JSON and XML. They also have 2 interesting complementary APIs in addition to their IP Geolocation API. A Timezone API and an Astronomy API.

Here’s a sample of their API response;

{
"ip": "8.8.8.8",
"hostname": "google-public-dns-a.google.com",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
"country_code3": "USA",
"country_name": "United States",
"country_capital": "Washington",
"state_prov": "California",
"district": "",
"city": "Mountain View",
"zipcode": "94043",
"latitude": "37.4229",
"longitude": "-122.085",
"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",
"isp": "Level 3 Communications",
"connection_type": "",
"organization": "Google Inc.",
"geoname_id": "5375480",
"currency": {
"code": "USD",
"name": "US Dollar",
"symbol": "$"
},
"time_zone": {
"name": "America/Los_Angeles",
"offset": -8,
"current_time": "2019-01-14 03:30:00.135-0800",
"current_time_unix": 1547465400.135,
"is_dst": false,
"dst_savings": 1
}
}

Infrastructure

ipgeolocation uses the Cloudflare CDN which means their global latency is good.

Cost

The Pro version of ipgeolocation.io has the following tiers;

Bronze — $15 for 150,000 requests per month

Silver — $65 for 1M requests per month

Silver+ — $130 for 3M requests per month

Gold — $200 for 6M requests per month

Platinum — $500 for 20M requests per month

Getting Started

You need to sign up for a free API Key here which allows you 1000 requests daily.

To lookup the IP Address 1.1.1.1 run

curl 'https://api.ipgeolocation.io/ipgeo?apiKey=API_KEY&ip=1.1.1.1'

To lookup an IPv6 Address

curl 'https://api.ipgeolocation.io/ipgeo?apiKey=API_KEY&ip=2001:4860:4860::1'

ipgeolocation.com

Image for post
Image for post

Endpoint: ipgeolocation.com

API Key: Not Required

API Latency: 30ms

Data Sample

ipgeolocation.com is a free IP Geolocation API utility. It returns city-level geolocation and the AS Number and Organization.

{
“ip”: “138.68.161.60”,
“city”: “London”,
“region”: “England”,
“country”: “United Kingdom”,
“coords”: “51.535300,-0.665800”,
“asn”: “AS14061, DigitalOcean, LLC”,
“postal”: “SL1”,
“timezone”: “Europe/London”
}

Getting Started

Lookup your own IP address

curl ipgeolocation.com

Lookup a specific ip address

curl ipgeolocation.com/1.1.1.1

Force a JSON response

curl ipgeolocation.com?json=1

ipapi.co

Image for post
Image for post

Endpoint: https://ipapi.co/json

API Key: Not Required

API Latency: 270ms

Image for post
Image for post

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

Image for post
Image for post

Endpoint: http://api.ipstack.com

API Key: Required

API Latency: 144ms

Image for post
Image for post

Data Sample

IPStack.com give you more data on larger plans. They currently have 4 plans;

  1. Free — Only Geolocation data. No SSL support. Commercial use is not allowed.
  2. Basic — SSL support. Location, Currency, Timezone and Connection data.
  3. Professional — Everything in Basic and access to a Bulk Lookup endpoint.
  4. 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

Image for post
Image for post
  1. Basic — 50,000 requests a month for $10
  2. Professional — 500,000 requests a month for $50
  3. 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

Image for post
Image for post

Endpoint: https://api.db-ip.com/v2/{api-key}/1.1.1.1

API Key: Required

API Latency: 225ms

Image for post
Image for post

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

Image for post
Image for post
  • 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

ipgeolocationapi.com

Image for post
Image for post

Endpoint: https://api.ipgeolocationapi.com/geolocate/91.213.103.0

API Key: No

API Latency: 50ms

Getting Started

ipgeolocationapi.com is an interesting open-source project that seems to be running exclusively off Cloudflare workers and using Cloudflare’s Geolocation headers.

As a result it is extremely fast with responses under 80ms. It however only seems to have country level data and does not geolocate IPs to the city level.

And! You can deploy your own hosted ip location API with their Heroku button on their API Documentation!

Get your Public IP Address in Javascript with ipify.org

If all you need is a simple API IP lookup API 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'

Footnotes

[1] IP Geolocation involves locating your website visitors in real-time to customize your website content eg. show them events near them, the weather, local news and many other use cases.

[2]https://status.maxmind.com/pages/maintenance/53fcfbb2ac0c957972000235/5c8a82fe9281be655a31d43f

Written by

Build location aware applications on the most reliable IP Geolocation service https://ipdata.co

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store