IP Geolocation and Threat Intelligence API: ipdata
An IP address is a simple, numeric piece of information that gets passed to a server, but that IP address can provide a wealth of information with ipdata. With ipdata you can learn user location, language, currency, and much more!
Quick Hits
- ipdata is an IP Geolocation and Threat Intelligence API. It helps you locate users by IP Address and detect proxy, tor and malicious users.
- 100% uptime in the last year
- API Latency averages ~66ms
- Proxy/VPN Detection
Tor user detection - Highly scalable API - running in 11 datacenters, 4 in the US, 1 each in Canada, Sao Paulo, London, Mumbai, Sydney and Seoul, highly redundant and scalable setup
- Unique ASN data - allows you to look up the AS Number that an IP belongs to, its prefix, domain, usage type and the name of the AS owning company
- Trusted by NASA, Comcast, Disney, Deloitte, Udacity, Aircall, HTC and more!
- Featured on the AWS Startups Blog and Highscalability, Hackernoon, Software Engineering Daily
After signing up for ipdata and receiving your API key, you can make requests to a number of endpoints. The most basic is providing the IP as the endpoint:
https://api.ipdata.co/12.345.67.890?api-key=MY_KEY
{ "ip": "12.345.67.890", "is_eu": false, "city": "Madison", "region": "Wisconsin", "region_code": "WI", "country_name": "United States", "country_code": "US", "continent_name": "North America", "continent_code": "NA", "latitude": 43.0334, "longitude": -89.4512, "postal": "53711", "calling_code": "1", "flag": "https://ipdata.co/flags/us.png", "emoji_flag": "\ud83c\uddfa\ud83c\uddf8", "emoji_unicode": "U+1F1FA U+1F1F8", "asn": { "asn": "AS20115", "name": "Charter Communications", "domain": "spectrum.com", "route": "12.345.67.890", "type": "isp" }, "languages": [ { "name": "English", "native": "English" } ], "currency": { "name": "US Dollar", "code": "USD", "symbol": "$", "native": "$", "plural": "US dollars" }, "time_zone": { "name": "America/Chicago", "abbr": "CST", "offset": "-0600", "is_dst": false, "current_time": "2020-01-08T20:25:34.949221-06: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 }, "count": "0" }
There's also a /{ip}/carrier
endpoint to retrieve mobile connection information:
{ "name": "T-Mobile", "mcc": "310", "mnc": "160" }
You can also hit /{ip}/currency
get currency information for the IP's location:
{ "name": "Australian Dollar", "code": "AUD", "symbol": "AU$", "native": "$", "plural": "Australian dollars" }
You can even get timezone information:
{ "name": "America/Los_Angeles", "abbr": "PDT", "offset": "-0700", "is_dst": true, "current_time": "2019-03-27T01:13:48.930025-07:00" }
All of these valuable pieces of information can help to better target advertisements, validate required user information, and more!
Proxy, Tor and Threat Detection
One unique feature that's provided by ipdata is their ability to detect if the IP address is behind a proxy, the tor network, or is a known thread:
{ "is_tor": true, "is_proxy": false, "is_anonymous": true, "is_known_attacker": false, "is_known_abuser": false, "is_threat": false, "is_bogon": false }
Knowing if the user is behind a proxy or the tor network helps to qualify the location information provided to you. It's also good to know if the IP address is known as a qualified threat based on past actions from the IP address.
Libraries & Sample Code
Since developers enjoy wrapping APIs with programmatic code, ipdata has done the hard work for you, creating a number of official libraries including Python, JavaScript, Go, Ruby, Swift, and .NET. If you prefer to create your own library or abstraction, you can do so with the sample code provided by ipdata!
from ipdata import ipdata from pprint import pprint # Create an instance of an ipdata object. Replace `test` with your API Key ipdata = ipdata.IPData('test') response = ipdata.lookup('69.78.70.144') pprint(response)
Threat Intelligence
ipdata offers threat intelligence which lets you see if an IP is listed in any of 400+ blocklists with 600M bad IPs listed. This helps you detect malicious IPs like malware sources, spam sources, botnets and block traffic from them to your website!
Use Cases
There are lots of awesome use cases for a service like ipdata:
- Localizing content like nearby events, flights, weather, etc.
- URL Redirections based on location
- Blocking traffic from undesired locations or users
- Showing flights and other localized content like event
- Showing events near users, showing the weather near users
- As a fallback for when HTML5 and mobile geolocation fail
ipdata is a really useful, easy to use utility for attaining information based on IP address. Whether you're trying to increase security, conversion, or metrics, ipdata is an awesome option!
Want to see how ipdata stacks up? Read What is the Best Geolocation API?!
That’s looks great, thanks for sharing David :) this is less costly than https://ipapi.com/ which I currently use and good for FREE user’s too, as it is providing 45K requests per month, whereas ipapi provides only 10K requests per month. But sad that they do not have a direct PHP API library, but still good considering the requests limit etc.
Hi Prashant,
We added an official PHP library a few days ago https://github.com/ipdata/php.
Let me know what you think!
Thanks Jonathan, that’s very good. I am asking my client if they are ready to switch over to ipdata. Hopefully we will do that in next few days and having PHP library is a plus factor for ipdata now.