This service offers a REST API allowing to get a visitor IP address and to query location information from any IP address. It outputs JSON-encoded IP geolocation data, and supports both JSON and JSONP.

There is no rate limit of any sort at the moment, and the service is free for everyone to use.

For updates, follow us on Twitter

The API powering this site is open source, and can be downloaded here or on GitHub

API Endpoints

IP (Get IP address in plain text format) :

Returns the visitor IP address (IPv4 or IPv6) in plain text, useful for shell scripts or to find the external Internet routable address.

Alternatively, for more granularity when querying from a dual-stack environments, the following endpoints are available :

Usage example (Shell script) :
#!/bin/sh

ip=$(curl -s http://www.telize.com/ip)
echo "My IP address is : $ip"
Output example :
IPv4 address :
46.19.37.108
IPv6 address :
2a02:2770::21a:4aff:feb3:2ee

JSON IP (Get IP address in JSON format) :

Returns the visitor IP address (IPv4 or IPv6) in a JSON object.

Usage example :
<script type="application/javascript">
	function getip(json){
	 	document.write("My IP address is : ", json.ip);
    }
</script>

<script type="application/javascript" src="http://www.telize.com/jsonip?callback=getip"></script>
Usage example (jQuery) :
<script type="application/javascript">
	$(document).ready(function() {
	$.getJSON("http://www.telize.com/jsonip?callback=?",
		function(json) {
			document.write("My IP address is : ", json.ip);
		}
	);
});
</script>

GeoIP (Get IP address location in JSON format) :

Calling the API endpoint without any parameter will return location information for the visitor IP address :

Appending an IP address as parameter will return location information for this IP address :

Usage example :
<script type="application/javascript">
    function getgeoip(json){
    	document.write("Geolocation information for IP address : ", json.ip);
    	document.write("Country : ", json.country);
    	document.write("Latitude : ", json.latitude);
    	document.write("Longitude : ", json.longitude);
    }
</script>

<script type="application/javascript" src="http://www.telize.com/geoip?callback=getgeoip"></script>
Usage example (jQuery) :
<script type="application/javascript">
	$(document).ready(function() {
	$.getJSON("http://www.telize.com/geoip?callback=?",
		function(json) {
    		document.write("Geolocation information for IP address : ", json.ip);
    		document.write("Country : ", json.country);
    		document.write("Latitude : ", json.latitude);
	    	document.write("Longitude : ", json.longitude);
		}
	);
});
</script>

JSON Output Schema

The output is a JSON object containing the following elements :

Please note that the IP location database may not contain all information about a given IP. In this case, only the available data is displayed.

Output example :

The following example use Telize server IP : city, region, and postal code information is not available and thus not present in the output JSON object :

{
    "ip": "46.19.37.108",
    "country_code": "NL",
    "country_code3": "NLD",
    "country": "Netherlands",
    "continent_code": "EU",
    "latitude": 52.5,
    "longitude": 5.75,
    "dma_code": "0",
    "area_code": "0",
    "asn": "AS196752",
    "isp": "Tilaa V.O.F.",
    "timezone":"Europe/Amsterdam"
}

Errors

Client Errors

When incorrect user input is entered, the server returns an HTTP 400 Error (Bad Request), along with a JSON-encoded error message.

HTTP Error Code Message
400 401 Input string is not a valid IP address

Support and Donations

If you use Telize and find the service useful, please consider making a donation, thank you.

Acknowledgment

This service includes GeoLite data created by MaxMind, available from maxmind.com.

This site is valid HTML5 and CSS3