What is ipstack, and how can it increase your security?
ipstack offers a powerful, real-time IP to geolocation API capable of looking up accurate location data and assessing security threats originating from risky IP addresses. Results are delivered within milliseconds in JSON or XML format. Using the ipstack API you will be able to locate website visitors automatically and adjust your user experience and application accordingly.
The ipstack API is a product built and maintained by apilayer, an Austrian technology company aiming to build a variety of reliable programming interfaces (APIs) and make them affordable for developers and startups. Browse all available products here.
ipstack offers one of the leading IP to geolocation APIs and global IP database services worldwide. This article outlines in detail diverse API endpoints, available options, and integration guides for a scripting language (Python), interactive web-based dashboard (Jupyter Notebook), and desktop applications (Delphi).
Why should you use ipstack for Developing a Website Visitors Tracking and Monitoring System?
- Very high accuracy:
Since the ipstack database and API is integrated with a series of large ISPs who constantly provide information about new and existing IP ranges, we are proud to offer a very high level of accuracy in IP data.
- Real-time update:
ipstack is integrated with multiple channels delivering real-time IP data, which is why the database used by the ipstack API is updated regularly, with up to 24 database updates per day.
- Handling between 2 to 3 billion API requests per day:
With 9 years of constant optimization, the infrastructure behind ipstack and the ipstack API has grown to become highly scalable and efficient, currently handling between 2 to 3 billion API requests per day.
- Supporting global network:
Data coverage is growing by the day, with ipstack currently supporting more than 2 million unique locations in over 200.000 cities across the globe.
What Real-Time IP to Geolocation Endpoints are Available via the API?
In total the ipstack API is offering 3 API endpoints, each with different functionalities. Here are their short summaries:
- Standard IP Lookup: The ipstack’s primary endpoint is called Standard Lookup and is used to look up single IPv4 or IPv6 addresses. To call this endpoint, simply attach any IPv4 or IPv6 address to the API’s base URL.
- Bulk IP Lookup: The ipstack API also offers the ability to request data for multiple IPv4 or IPv6 addresses at the same time. To process IP addresses in bulk, simply append multiple comma-separated IP addresses to the API’s base URL.
- Requester IP Lookup: The ipstack API also offers a separate API endpoint capable of detecting the IP address from which the current API request is coming. To use this endpoint, simply append check to the API’s base URL and specify your preferred optional parameters.
How can I Access ipstack API?
First, get your API Credentials here, and set up your subscription plan:
And you can monitor your usage via this dashboard.
API Access Key & Authentication
Next, to check if everything is working properly, just simply run this URL in your favorite web browser:
You will get this API response inside your browser:
Each API response consists of 49 different response objects:
|ip||Returns the requested IP address.|
|hostname||Returns the hostname the requested IP resolves to, only returned if Hostname Lookup is enabled.|
|type||Returns the IP address type IPv4 or IPv6.|
|continent_code||Returns the 2-letter continent code associated with the IP.|
|continent_name||Returns the name of the continent associated with the IP.|
|country_code||Returns the 2-letter country code associated with the IP.|
|country_name||Returns the name of the country associated with the IP.|
|region_code||Returns the region code of the region associated with the IP (e.g. CA for California).|
|region_name||Returns the name of the region associated with the IP.|
|city||Returns the name of the city associated with the IP.|
|zip||Returns the ZIP code associated with the IP.|
|latitude||Returns the latitude value associated with the IP.|
|longitude||Returns the longitude value associated with the IP.|
|location||[Object] Returns multiple location-related objects|
|location > geoname_id||Returns the unique geoname identifier in accordance with the Geonames Registry.|
|location > capital||Returns the capital city of the country associated with the IP.|
|location > languages||[Object] Returns an object containing one or multiple sub-objects per language spoken in the country associated with the IP.|
|location > languages > code||Returns the 2-letter language code for the given language.|
|location > languages > name||Returns the name (in the API request’s main language) of the given language. (e.g. Portuguese)|
|location > languages > native||Returns the native name of the given language. (e.g. Português)|
|location > country_flag||Returns an HTTP URL leading to an SVG-flag icon for the country associated with the IP.|
|location > country_flag_emoji||Returns the emoji icon for the flag of the country associated with the IP.|
|location > country_flag_emoji_unicode||Returns the unicode value of the emoji icon for the flag of the country associated with the IP. (e.g. U+1F1F5 U+1F1F9 for the Portuguese flag)|
|location > calling_code||Returns the calling/dial code of the country associated with the IP. (e.g. 351) for Portugal.|
|location > is_eu||Returns true or false depending on whether or not the county associated with the IP is in the European Union.|
|time_zone||[Object] Returns an object containing timezone-related data.|
|time_zone > id||Returns the ID of the time zone associated with the IP. (e.g. America/Los_Angeles for PST)|
|time_zone > current_time||Returns the current date and time in the location associated with the IP. (e.g. 2018-03-29T22:31:27-07:00)|
|time_zone > gmt_offset||Returns the GMT offset of the given time zone in seconds. (e.g. -25200 for PST’s -7h GMT offset)|
|time_zone > code||Returns the universal code of the given time zone.|
|time_zone > is_daylight_saving||Returns true or false depending on whether or not the given time zone is considered daylight saving time.|
|currency||[Object] Returns an object containing currency-related data.|
|currency > code||Returns the 3-letter code of the main currency associated with the IP.|
|currency > name||Returns the name of the given currency.|
|currency > plural||Returns the plural name of the given currency.|
|currency > symbol||Returns the symbol letter of the given currency.|
|currency > symbol_native||Returns the native symbol letter of the given currency.|
|connection||[Object] Returns an object containing connection-related data.|
|connection > asn||Returns the Autonomous System Number associated with the IP.|
|connection > isp||Returns the name of the ISP associated with the IP.|
|security||[Object] Returns an object containing security-related data.|
|security > is_proxy||Returns true or false depending on whether or not the given IP is associated with a proxy.|
|security > proxy_type||Returns the type of proxy the IP is associated with.|
|security > is_crawler||Returns true or false depending on whether or not the given IP is associated with a crawler.|
|security > crawler_name||Returns the name of the crawler the IP is associated with.|
|security > crawler_type||Returns the type of crawler the IP is associated with.|
|security > is_tor||Returns true or false depending on whether or not the given IP is associated with the anonymous Tor system.|
|security > threat_level||Returns the type of threat level the IP is associated with.|
|security > threat_types||[object] Returns an object containing all threat types associated with the IP.|
How can I Track and Monitor any IP Address with Python?
Use the following code to make an API request using Python, you can change the “126.96.36.199” value to any IP address you want to verify:
# -*- coding: utf-8 -*-
r = requests.get("http://api.ipstack.com/188.8.131.52?access_key=YOUR_ACCESS_KEY")
responses = r.json()
Here is the API response inside your Python interpreter:
You also can print out each parameter individually, or choose any parameter you like, like this:
Here is the API response inside your Python interpreter:
How can I Develop Interactive Web-Based IP Address Tracking and Monitoring Systems With Jupyter Notebook?
You can easily build an interactive web-based IP Address Tracking and Monitoring dashboard using Python scripts in the previous section, just by running them inside Jupyter Notebook. If you have never used Jupyter Notebook before, visit this link for an installation guide.
Here is the result:
How can I Make an API Request the using Delphi REST Debugger?
Download Delphi REST Debugger here.
Choose the GET method, and send the request to the following URL:
After getting the API responses you need, and you want to create Windows, macOS, and Linux Desktop apps based on it using Delphi, visit this blog post to get started:
How can I get started with automated visitor tracking today?
As you can see there are many real-time IP to geolocation endpoints provided by ipstack REST API which can be connected to any platform and any programming language. In this article, we show the basic demo of how you can use ipstack REST API for scripting, web, and desktop-based applications.
Take advantage of the free tier on ipstack and we recommend you to upgrade your subscription plan if you need more powerful features to grow your business and enhance your security (SSL Encryption, Currency Module, Time Zone Module, and many more). We can’t wait to see what you build with our REST API!