Delphae - Python & Open Data
Contact
  • Home
  • Blog
  • IP Geo
  • Publications
  • Education
  • Contact
  • ADS-B

Inventory of IP geo location services - API & JSON

Introduction
After a long search and trying the APIs on the Internet, an overview of useful public sources has been created.
I am particularly interested in an API that returns JSON-formatted data so that I can use it in Python programs.

API key
Most are free to use, some needs an API key. This is available after a free registration.
These services have a limit to the number of calls per day or hour.

The table below is optimized to view with Firefox.
If you have installed a JSON plugin for Firefox, the data will be displayed as a clickable page.

In some cases the url needs to hold the IP address and/or the API-key. All the sources have their api documented.
Feel free to try them all.
Usage examples
  1. Linux commandline
    curl -s https://tools.keycdn.com/geo.json | python -m json.tool

  2. Python
    import requests
    url="https://tools.keycdn.com/geo.json"
    response=requests.get(url)
    jsdata = response.json()

On my GitHub page you will find some useful examples of Linux bash scripts, which all need an API key.
These will only work with your own API key.
More geo ip scripts are available at GitHub.
Resource
API key
required
IP address
required
Remarks
ripe.net 
no
yes
Hard to read the JSON-formatted data, but the only reliable and official resource for IP address information.
Provides you only country related information.
Please take a look at my GitHub page to find some Python classes for RIPE and AirVPN.

I also recommend to take a look at the ip-netblocks API at whoisxmlapi.com
geobytes.com
no
no
 
ip-api.com
no
no
colored and formatted output with just
curl -s http://ip-api.com
try also
http://ip-api.com/csv?fields=query

ipapi.co
no
no
 
ifconfig.co
no
no
my favorite api call just to retreive the public IP address to use it in various bash scripts as described below
curl -s "http://ifconfig.co" (without json)
ipv6-test.com
no
no
 
db-ip.com
no
yes
ipaddress=$(curl -s http://ifconfig.co)
url=http://api.db-ip.com/v2/free/$ipaddress

ipinfodb.com
yes
yes
apikey="YOUR-APIKEY"
ipaddress=$(curl -s "http://ifconfig.co")
url="http://api.ipinfodb.com/v3/ip-country/?key=$apikey&ip=$ipaddress&format=json"

ip2location.com
no
yes
ipaddress=$(curl -s "http://ifconfig.co")
url="http://api.ip2location.com/?key=demo&package=WS12&format=json&ip=$ipaddress"

ipfind.com
no
yes
 
ipinfo.io
no
no
A very useful resource, it's shows the JSON formatted data without the need for a plugin (mobile device). And very accurate too.
For exampe: I live in a small town nearby a city. Most of the sources point to this larger city.
But ipinfo.io is aware of the small town I live in, with accurate latitude&longitude details.
ipstack.com
yes
no
apikey="YOUR-APIKEY"
url=http://api.ipstack.com/check?access_key=$apikey

keycdn.com
no
no
Value
whoisxmlapi.com
yes
yes
ipaddress=$(curl -s "http://ifconfig.co")
apikey="YOUR-APIKEY"
url="https://geoipify.whoisxmlapi.com/api/v1?apiKey=$apikey&    ipAddress=$ipaddress"


more APIs available like:
  • Domain Reputation API
  • Email Verification API
  • Reverse MX API
whatismyipaddress.com
no
no
 
ipgeolocation.io
yes
no
apikey="YOUR-APIKEY"
url="https://api.ipgeolocation.io/ipgeo?apiKey=$apikey"

api.ip.sb/geoip
no
no
 
api.myip.com
no
no
 
ipapi.com
yes
yes

IPv6
These sites show the IPv6 address, only when IPv6 is enabled, otherwise an error will follow.
  • whatismyipaddress.com
  • ipv6-test.com
  • api-ipv6.ip.sb/ip
  • api6.ipify.org?format=json
  • v6.ident.me/
  • ip.seeip.org

On StackExchange you can find an great overview with a lot of tips and tricks for IPv4 and IPv6.

update: 2020-03-02
Powered by Create your own unique website with customizable templates.