geolocation ip address ipstack API location services

Free website visitors geolocation with the ipstack API (Review)

Since its humble beginnings over 25 years ago, the world extensive net has advanced in ways that even the greatest analysts might have by no means predicted. Type what was primarily a software to assist researchers share info, it has advanced right into a shopper software that many people simply can’t reside without. It has changed many points of our lives and we’ve come to depend on it, maybe greater than we should always. It has turn into so commonplace that it’s altering the retail business. From massive chains of brick-and-mortar stores, the prime retailers at the moment are web-based marketplaces.

To achieve success, online retailers needn’t solely to be present on the net, but additionally they need to completely make the most of its options. One such function is geolocation. This know-how can permit a retailer to know the location of its website’s visitor, a helpful function to allow them to show estimated delivery fees or to current location-specific presents. Considered one of the easiest ways to profit from geolocation is to make use of a devoted API that can be fed with an IP handle and that may return any pertinent information about that tackle. The ipstack API is one such product and we’re about to find the way it does its magic and what it could do for you. We’ll take a look at the device’s primary performance in addition to how it to use it. We’ll see how it performs, what sort of documentation and help is out there for the product and take a look at its moderately simple pricing construction.

Introducing ipstack

At its core, ipstack is a geolocation API which makes use of a number of interconnected ISPs to offer accurate geographical knowledge. You call the API out of your website’s code and it will return a plethora of geographical knowledge about your website’s users. You will, in fact, get the consumer’s geographical location (isn’t that the most important level?) however that’s not all. As an example, the device will return a link to an image of the consumer’s country flag or an emoji version of it. Moreover, you’ll get information about whether the consumer is accessing your website by way of a proxy. We’ll go in deeper details on all this as we glance in deeper particulars at the out there modules.

The venture, initially referred to as freegeoip.internet, saw the mild again in 2009 as an open source initiative to assist developers. By means of steady enchancment based mostly on consumer feedback, it advanced some eight years later into the full-fledged product that we’re taking a look at. During this time, the product’s consumer base grew as much as over 100 thousand glad clients. They usually’re not just any clients. Giants like Microsoft or Samsung are utilizing the API. So are Airbnb and HubSpot.

The ipstack API makes use of a extremely dynamic scheme which updates its database multiple occasions a day, making certain the integrity of the returned results. For this objective, ipstack has partnered up with several giant ISPs throughout the world. The device performs all communication over 256-bit SSL-encrypted channel—using HTTPS—to secure all knowledge transfers. Results could be returned by the API in both XML or JSON format, relying on your specific wants.

One in every of the greatest elements of ipstack API is its modularity. Numerous obtainable module return increasingly extra knowledge about the consumer’s location. That makes for a really flexible device. Velocity can also be certainly one of the product’s forte. You name the API with the applicable parameter(s) and get the requested outcomes super fast. At present, ipstack API handles greater than two billion requests every day and it’s still responding virtually immediately. By way of a partnership with numerous ISPs, the product can cover some 2 million places and over 2 hundred thousand cities worldwide. It also supports each IPv4 and IPv6 addresses.

How Geolocation Works

Earlier than we go any further, let’s briefly pause and have a quick take a look at how geolocation seems to be. As you’d guess from ipstack’s identify, it has to do with IP addresses. IP addresses could be in contrast—to a sure extent—to postal addresses. Each Web-connected gadget has a singular IP tackle. But these IP addresses aren’t just randomly assigned to every system. There’s some sense into it. A part of an IP tackle identifies the particular person related system and part of it identifies the community it is related to. And the network part itself is hierarchically organized, considerably like a pc disk directory tree. (I hope the engineers among our readers will forgive me for this oversimplification.)

That is just like a postal tackle with a road quantity, a road identify, a city, and, ultimately, a country. And identical to the British submit has no concept where any US tackle is situated, it is going to ship US-bound mail to the USPS which can care for routing the mail to the right location. And identical to you may enter just about any postal handle in a device corresponding to Google map and get the actual corresponding location, you possibly can question a software reminiscent of the ipstack API with an IP tackle to get its location.

This has some limitations, though. As an example, you gained’t get the actual location from the IP tackle. What you’ll get is no matter the ISP supplying the IP tackle can provide. That is typically not rather more precise than the city or basic neighbourhood although some suppliers return more info than others. Also, if the consumer is suing a VPN to access your website, what you’d get from such a lookup is the location of the VPN server they’re using.

Primary Options Of The ipstack API

The developers of the ipstack API chose to use a modular strategy with this product. It consists of varied modules, each returning a special sort of data. There are, as an example, modules of timezone, foreign money, or even safety. You choose what module to use through the use of the applicable parameters when sending the request to the ipstack API.

There are a number of advantages to this strategy. First, it makes the response easier to handle. If there was only one sort of request returning all obtainable knowledge about an IP handle, your website’s code would have to parse the entire reply to fetch no matter info it needs. Additionally, sending smaller requests—with smaller responses—can enhance efficiency.

Let’s have a deeper take a look at each of the obtainable module, learn how to name them and what their typical response seems to be like. That offers you a quite clear overview of what to expect from this highly effective software.

The Location Module

ipstack API - Location Module

The ipstack API’s most elementary module is the Location Module. It returns particulars about the bodily location of the IP handle offered in the query. You’ll get the IP tackle’ country, its major or official language as well as an emoji for the nation’s flag which you need to use to personalize your consumer’s expertise.

Right here’s a typical response to a question to the ipstack API. The first part is included with any question, regardless of the module requested:

ip: “”
hostname: “”
sort: “ipv4”
continent_code: “NA”
continent_name: “North America”
country_code: “CA”
country_name: “Canada”
region_code: “QC”
region_name: “Quebec”
city: “Montreal”
zip: H2V
latitude: 45.5178
longitude: -73.6046

Most of the returned attributes are self-explanatory but you have got detailed documentation on ipstack’s website do you have to need further assist.

But since we’re talking about the location module, let’s have a look at what additional info is returned when using it:

location: Object
geoname_id: null
capital: “Ottawa”
languages: Object
code: “en”
identify: “English”
native: “”English””
code: “fr”
identify: “French”
native: “”Français””
country_flag: “”
country_flag_emoji: “??”
country_flag_emoji_unicode: “U+1F1E8 U+1F1E6”
calling_code: “1”
is_eu: false

As you possibly can see, the additional info you get is especially the country’s capital, the numerous languages in use in that location, a hyperlink to a picture of the country’s flag and the unicode of the nation’s emoji.

The Foreign money Module

ipstack API - Currency Module

The Foreign money module can be utilized to additional enhance your website consumer expertise. That is notably true of a purchasing website as it should help you display prices in your consumer’s foreign money. The small print offered embrace the native foreign money identify and symbol as well as its plural identify. The API gained’t convert prices to the proper foreign money, in fact, but it’s going to assist you to use one other API to convert your prices into the proper foreign money in your visitors. Let’s have a look at what the output from the foreign money module seems like:

foreign money: Object
code: “CAD”
identify: “Canadian Dollar”
plural: “Canadian dollars”
symbol: “CA$”
symbol_native: “$”

The Security Module

ipstack API - Security Module

In all probability not as in style—or helpful—as the previous modules, the Security Module continues to be fascinating. It returns information about several safety elements of the incoming connection. For example, it is going to inform you whether the website is accessed by way of a proxy and, in that case, the sort of proxy or whether the request came in via the tor community. It may possibly additionally inform you that a request is from a crawler relatively than an actual consumer. Any such info can be utilized to stop scraping. The module also returns the menace degree associated with the IP tackle offered, probably allowing for crude safety towards malicious requests. Here’s a take a look at the typical response from the Security Module:

security: Object
is_proxy: false
proxy_type: null
is_crawler: false
crawler_name: null
crawler_type: null
is_tor: false
threat_level: “low”
threat_types: null

The Time Zone Module

ipstack API - Time Zone Module

Another module which may come in useful to personalize your website visitors consumer experience is the Time Zone module. It returns some additional details about—you guessed it—your website visitors. One in every of the locations the place you would use such a function in sites that deal with time-sensitive info. It lets you display the right time based mostly in your users’ location.

The module offers info like GMT offset, current consumer time, time code, and time zone location as you’ll be able to see from this pattern response:

time_zone: Object
id: “America/Montreal”
current_time: “2019-07-09T12:39:22-04:00”
gmt_offset: -14400
code: “EDT”
is_daylight_saving: true

The Connection Module

ipstack API - Connection Module

Final but not least is the Connection Module. This one is quite simplistic. All it returns is the autonomous system (AS) number related with the supply IP tackle as well as the ISP identify. Nicely, it’s truly the identify of the AS proprietor somewhat the ISP. Some organizations register their own autonomous system, as is the case in the example under:

connection: Object
asn: 395399
isp: “City of Montreal”

That is in all probability the least useful of all the modules but some will find it useful for numerous analytic functions.

Working With the ipstack API

We’ve had a take a look at what info may be returned by the ipstack API, now’s the time to have a look at how it’s referred to as. The ipstack API provides three several types of queries each with totally different parameters. There’s the Normal Lookup, the Bulk Lookup and the Requester Lookup. Let’s see how they differ. This can be a nice function as, as an example, the bulk request allows one to combine several requests into one, thereby decreasing the complete overhead and permitting for quicker outcomes. Let’s have a deeper take a look at every sort of request.

Normal Lookup

As you may need guessed, the Commonplace Lookup is the most elementary one. It returns the details a few single IP tackle that you simply provide when calling the ipstack API. It’s fairly easy to use and it will work with both IPv4 or IPv6 addresses. To make issues even easier, the product’s documentation offers sample code for the normal request in each PHP (cURL) and JavaScript (Jquery.ajax). In case your website is build utilizing either of those, utilizing the API is mostly a no-brainer. Here’s a pattern of a typical name to the API using simple HTML code:

In this example, YOUR_ACCESS_KEY would be replaced by the precise access key you got once you signed up for the service. You’d additionally embrace the actual IP tackle you want details about somewhat than the dummy one in this instance.

The outcomes for a standard lookup embrace all the modules by default however additional parameters let you tune the request to your actual needs. All the details on the obtainable parameters are clearly explained in the product documentation. Likewise, the default response is a JSON object however parameters can change that to an XML format.

Bulk And Requester Lookups

The Bulk lookup enables you to request knowledge towards a number of IP addresses within a single request. Identical to the Commonplace Lookup, you will get knowledge on both IPv4 and IPv6 addresses. You possibly can even mix both kinds of addresses in a single request. The format of the request is the similar as that of Normal Lookup except that you simply specify a number of IP addresses separated by commas.,,,

The final sort of request provided by the ipstack API is the Requester Lookup. It should return info on the IP tackle from which the request is coming. It’s the sort of request you’d run from withing a client-side script. To make a Requester Lookup call, all you do is use the key phrase “check” in lieu of an IP handle. The other out there request parameters are the similar as for other request varieties.

How Does The ipstack API Carry out?

The ipstack API is, more than probably, something you’d integrate into a real-time website. For instance, you may need to serve totally different content material based mostly on the shopper’s location. So as to accomplish that, you need the API to perform blazingly quick. Any delay in the API response will translate into delays displaying the page to your shopper, something you’d greater than doubtless need to avoid. The same is true no matter what you employ the location knowledge for. This is the reason the response time of the device you’re utilizing is of the utmost significance. Whereas a geolocation API can present a much-needed performance, its failure to carry out can have a disastrous influence.

For these causes, it’s essential to select an API with good response time. We’ve completed much of the onerous work of testing numerous situations and ran exams with single or a number of IP addresses, some with more elective parameters, some with less. We have been quite happy with the outcomes and obtained a moderately constant response time of round 100 ms, regardless of the request. Response was additionally consistent over time with no obvious “rush hours” when performance would endure and it was additionally comparable regardless of the place we launched the requests from. It looks like the ipstack servers are built to handle the load they get. General, it looks like utilizing the ipstack API had barely any impact on website response seen from a consumer’s perspective.

Product Documentation And Help

It’s typically stated that a product is simply nearly as good as its documentation. If that’s true, the ipstack API has nothing to worry as its documentation is straightforward to seek out, use, and perceive. The quality of the documentation also provides a measure of how much a software program writer cares about its users. Right here again, there’s nothing to fret about.

ipstack API - Documentation Home

Certainly one of the neatest thing about this product’s documentation is, oddly sufficient, how little there’s. Every part matches on a single, properly laid out net web page where you’ll simply discover all you want. And to make factor even simpler, a menu pane makes accessing any given section a breeze. The documentation covers all the things from utilizing the numerous forms of requests to customizing the response.

In the highly unlikely case once you wouldn’t discover what you need in the documentation, help can also be obtainable. It may take a while to initially reach the tech help but, once you do, they do reply relatively shortly.


A number of pricing plans can be found for the ipstack API. At the lowest degree, there the free plan. As its identify implies, this one is free. It’s also somewhat limited. For starters, you’ll be able to solely run as much as 10 000 queries per thirty days. It also only consists of the Location Module and entry to help is restricted. It will possibly, nevertheless, be a good way to test the product and see how it can integrate into your setting.

The subsequent degree is the primary plan. This one sells for $9.99/month or $95.90/yr (a 20% low cost) and brings the requests limit as much as 50 000/month. It additionally enables you to use the Foreign money, Time Zone and Connection modules. Moreover, enhanced help can also be included with the plan as well as enhanced security via the use of SSL encryption.

The preferred plan is the skilled one which sells for $49.99/month or $479.90/yr. It provides you every thing that’s included in the primary plan but raises the monthly requests restrict to 500 000 and in addition consists of the capacity to do bulk requests.

At the prime is the skilled plus plan. It prices $99.99/month or $959.90/yr. It’s equivalent to the skilled plan nevertheless it allows as much as 2 million requests per 30 days and it’s the only plan to incorporate the safety module.

If that ain’t enough, there’s also a customizable enterprise plan that may be arranged by contacting ipstack. It might embrace as many monthly requests as you may want as nicely numerous custom options based mostly on a shopper’s specific needs.

In Conclusion

The ipstack API is a wonderful product that may allow you to grab as much of the knowledge you will get from an IP tackle shortly and easily. It has superb response time, wonderful documentation and good help which mix to make this a terrific value for the money. Also, the very fact that a number of Internet giants use it is in all probability a superb testomony to the product’s worth.

That is undoubtedly a product I’d advocate should you’re taking a look at exploiting the knowledge that can be gathered on your website visitor’s IP tackle. And since a free—albeit limited—plan is obtainable, there isn’t any purpose why you shouldn’t at the very least give it a attempt is see for yourself what it might do for you.

About the author