The evolution of internet has entirely changed the world we live in today. From a craze in the 1990s, it has emerged to shape our thoughts, societies, and future. Tons of multi-billion companies have been established around the idea of making lives easy through technology. And the fact of the matter is, that they have been quite successful.
With this whole evolution process, we have reached a point where data plays a key role in many critical decisions. No matter whether it’s finance, weather prediction, strategy making, or starting a new venture, you rely heavily on data from a day to day basis. That’s why it has become crucial to collect data for analysis and decision making.
Some time back, I worked with a client to help him build a platform where he wanted to offer a certain discount to the user according to his geographical location. This way he could generate more sales by offering a slashed price to the users who belong to a region with low purchasing power.
The problem was to fetch all the data regarding the geographical location of the user and analyze it against countries list to offer a discount. Further, he wanted to use the sales data to make future decisions. Though it was a difficult task, later on, I realized how much I learned from it and it was kind of fun project to do. 👌
While designing the solution, I encountered this incredible geolocation API called ipstack. It helps you track all nitty-gritty details about the geolocation of a user. You even get the country name along with its emoji. Also, you can find out whether or not the request is proxied and tons of more details. Which is super dope! 💯
I not only used this to design my client’s solution but am also using it since then for different purposes. I must stay results have been pretty promising — quite impressed. And today, I am super excited to share this API with you. I will be taking a plunge into its functionalities, performance, and how you can use it to design fun solutions like this one. So, let’s get started.
🌐 ipstack API
ipstack API is a leading geolocation API which utilizes a series of connected ISPs to provide accurate geographical data. Initially, it started off as an open source side project to help developers in 2009 with a different name — freegeoip.net. Through customers feedback and continuous improvements, it evolved into a full-fledged product called ipstack after 8 years.
During this time, it has managed to cater more than 100,000 satisfied customers. Also, it earned clients like Microsoft, Airbnb, Samsung, and HubSpot. It utilizes a highly dynamic setup which updates the database multiple times a day to ensure the results’ integrity. And for this purpose, they have partnered up with large ISPs throughout the world. 👌
ipstack performs all communication over 256-bit SSL encryption (HTTPS) to secure all the data transfers. You can get your results in both XML and JSON format according to your needs. The best part of ipstack API is it’s kind of modular. You can pass a parameter and fetch specific results super fast! 🚀
According to the latest stats, more than 2B+ requests are made to ipstack on daily basis. It covers 2M+ unique locations and 200,000+ cities around the world. Also, it provides both datagrams both in ipv4 and ipv6 format. Pretty dope!
🍭 Features of ipstack API
One of the best things about the ipstack is its modular nature. That is, it consists of modules of geographical information like security, timezone, currency, etc. By modifying the request parameters, you can easily grab the required module. Which doesn’t only make the response easier to handle, but also provides a performance boost.
Let’s quickly take a look on what modules ipstack has to offer. Also, I’ll show you what each module covers and sample response look like.
📌 Location Module
The location module of ipstack API covers specific details about the geographical location. Such as the capital of the country, the language being spoken in there, also it provides the emoji for the country flag. Which is quite helpful.
For example, in my case, I always enabled to location module to grab the flag emoji. Then used this information to display the flag to the visitors according to their location. Which helped in improving the user experience and added a personal touch to it. 🙈
Below is a sample gist of how the JSON response of location module looks like. You can get a fair amount of idea regarding how this can be useful in certain scenarios. Almost all of the attributes are self-explanatory, but you can also find the detailed documentation on their site for further help.
🤑 Currency Module
This module can be really handy if you’re planning to game up the user experience in a shopping site. Using the details provided by this module such as currency name, symbol, and plural name you can provide a tailored experience to the customers. For example, I combined this module with some currency converter to show the price in local currency.
Below is the sample response for the currency module of ipstack API. It contains information like the singular and plural name of the currency, its symbol, and code.
🔐 Security Module
An interesting thing about ipstack API is that for each module, there can be hundreds of use cases. For instance, take security module, it provides information like whether it’s a proxied request or not. Also, it contains data about tor, crawlers, crawler type, threat, and even threat level.
This information can be combined to build a small security tool. Alternatively, specific requests can be filtered using this information. Take a look at the sample response of a visitor using tor.
🤝 Connection Module
With the connection module of ipstack API, you can also find details of the user connection. For example, you can grab the unique autonomous system number (ASN) of the ISP and its name as well. It can be helpful to filter users based on their ISP and build up some analytics.
A sample response of the connection module is shown below. It contains only two fields — ASN number and ISP name.
⏰ Time Zone Module
Another useful module of the ipstack API is Time Zone which provides nitty-gritty details about the time zone of the user. Again, it can be quite useful to provide a tailored user experience. For example, if you have users from different regions and show some timestamp, you can show local time.
It provides information like GMT offset, current user time, time code, and time zone location. Below is a gist containing a sample response of the time zone module.
ipstack provides 3 endpoints with different parameters to make a request and get the results. You can have a Standard Lookup, Bulk Lookup, and even Requester Lookup. The first two are self-explanatory, while Requester Lookup allows you to grab the details of the IP address from which the API request is being made.
I believe having different endpoints can be quite useful when you have to deal with a variety of requests. For example, if there had not been a bulk lookup endpoint you might end up with multiple requests. Which is obviously not desired. Now, let’s jump into the details of each endpoint.
🙌 Standard Lookup
Using the standard lookup endpoint, you can get the details against a single IP address. To make a request you need to append the IP address to the endpoint and pass API key as a parameter. You can get the result against both IPv4 and IPv6 IP addresses. The standard lookup endpoint is given below:
The result for a standard by default lookup looks like below. However, you can play with the parameters to get the desired result. A detailed documentation on modifying the response is available on their site. By default, the response is a JSON object.
👊 Bulk and Requester Lookup
Bulk lookup endpoint allows you to request data against multiple IP addresses at one time. Like standard lookup endpoint, you can get results for both IPv4 and IPv6 addresses. The endpoint for bulk lookup is same as that of standard lookup. The only difference is that you have to insert multiple IP addresses separated by a comma.
In case of the bulk request, the response is an array of JSON objects and contains the same data as that of the standard lookup response. Like the standard lookup, you can also modify the bulk lookup response. Personally, I find it quite useful as it helps to get the only required data and reduces the response time.
Another endpoint offered by ipstack is Requester Lookup. It allows you to get the details of the IP address from which the current request is coming. To make a requester lookup call, all you need is to append the keyword
check with your access key to get the result. Below is the gist for the requester endpoint.
Most of the time APIs are integrated into the real-time systems. For example in my case, the location has to be detected as soon as the user opens the webpage and calculate the discount. That’s why the performance or in case of an API, we can say response time plays the key role. An API can be a complete disaster if it takes too long to respond and vice versa. 🎯
That’s why while choosing an API, it’s crucial to analyze its response time and see whether or not it would be a good pick. So, I took ipstack for a spin to see how intelligent the API was designed. And I was quite impressed with how it performed under different use cases. 👍
What I did was, first I made requests multiple times with different IP addresses to check the response time. Later on, I played with different parameters to see how it reacts. Note that for this purpose I used Postman and finding below indicates the average response time.
- ⏳ Response time was around ~100ms.
- 👉 The response time remained the same irrespective of the location.
- 🤞 Specifying the field argument or changing the output format had no or minimal effect on the response time.
This incredible response time allowed me to seamlessly integrate it into the product and the client was quite happy with the results. As it had an insignificant effect on the website speed. 💯
ipstack currently offers in total 3 plans which vary in terms of the number of calls and modules available. It starts from a Basic plan at $9.99 and 50,000 calls/month and goes up to Professional Plus plan $99.99 with 2,000,000 calls/month. The Professional Plus plan comes with all the modules while Professional plan lacks the security module and Basic plan lacks the bulk lookup and the security module.
I believe it makes sense to divide on the basis of the module. This way you get to pay for only the feature you need. Also, you can even signup for a customized plan according to your needs. Last but not least, there’s a free plan with 10,000 calls/month with limited modules is available to give ipstack a try before actually investing on it. Which is pretty cool!
📖 Documentation & Support
I always give due attention to the documentation and the support aspect of a product. Because they clearly predict how much the product developer cares about the customer. And it proves to be quite helpful in the long run. That’s why a product with great support and documentation always has great chances of picking up.
Talking about the documentation of the ipstack, it can definitely be weighed against the gold. The documentation page encapsulates almost all the info you might need to get started and integrate the API. From all the endpoints to customizing the response, it covers every piece. I must say, it’s done in the right way and I totally loved it!
About the support, after going through the documentation you’d hardly need it. However, they rock a profoundly active support team. It takes some time initially to get to them but after that, they’re pretty quick to assist you. 👍
🙌 Final Thoughts
ipstack is a well-thought and greatly-build product to help you locate and grab user information via IP addresses. Features like great documentation, amazing support, and incredible response time definitely add to its value. And the fact that it’s trusted by the names like Microsoft, Airbnb, and Samsung also makes a huge difference.
I have been using it for a while to integrate different modules in my products and I couldn’t be happier. If you’re looking for a solution to grab user data in your future projects, you should definitely give it a try. It worths every penny.
Have you ever used a solution to provide functionalities based on user data in your products? If yes, which solution did you use and how was your experience? And if you have used ipstack before do.
SUBSCRIBE TO WORDPRESS TAKEAWAY!
A Premium Bi-Monthly Newsletter by WPCouple! What is WPTakeaway?