Important information
The public API was permanently shut down on November 15, 2015. More information can be found here.
To continue using Telize after this date, please spin up your own instance or subscribe to a paid plan.
IP geolocation API
This service offers a REST API allowing you to get a visitor IP address and query location information for any IP address.
It returns JSON-encoded IP geolocation data and supports both Cross-Origin Resource Sharing (CORS) and JSONP.
The public API was permanently shut down on November 15, 2015. More information can be found here.
To continue using Telize after this date, please spin up your own instance or subscribe to a paid plan.
For updates, follow Frederic on.
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 environment, the following endpoints are available:
#!/bin/sh
ip=$(curl -s https://www.telize.com/ip)
echo "My IP address is: $ip"IPv4 address:
46.19.37.108
IPv6 address:
2a02:2770::21a:4aff:feb3:2eeReturns the visitor IP address (IPv4 or IPv6) in a JSON object.
<script type="application/javascript">
function getip(json){
document.write("My IP address is: ", json.ip);
}
</script>
<script type="application/javascript" src="https://www.telize.com/jsonip?callback=getip"></script><script type="application/javascript">
$(document).ready(function() {
$.getJSON("https://www.telize.com/jsonip?callback=?",
function(json) {
document.write("My IP address is: ", json.ip);
}
);
});
</script>Calling the API endpoint without any parameter will return location information for the visitor IP address:
Appending an IP address as a parameter will return location information for this IP address:
Example (JSON): https://www.telize.com/geoip/46.19.37.108
Example (JSONP): https://www.telize.com/geoip/46.19.37.108?callback=getgeoip
Example (JSON): https://www.telize.com/geoip/2a02:2770::21a:4aff:feb3:2ee
Example (JSONP): https://www.telize.com/geoip/2a02:2770::21a:4aff:feb3:2ee?callback=getgeoip
<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="https://www.telize.com/geoip?callback=getgeoip"></script><script type="application/javascript">
$(document).ready(function() {
$.getJSON("https://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>The output is a JSON object containing the following elements:
{
"ip": "193.0.6.139",
"continent_code": "EU",
"country": "Netherlands",
"country_code": "NL",
"country_code3": "NLD",
"is_in_european_union": true,
"region": "North Holland",
"region_code": "NH",
"city": "Amsterdam",
"postal_code": "1012",
"latitude": 52.3735,
"longitude": 4.8951,
"timezone": "Europe/Amsterdam",
"offset": 3600,
"asn": 3333,
"organization": "Reseaux IP Europeens Network Coordination Centre (RIPE NCC)"
}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 |