This service allows free 100 request per API key each day. If your requests exceed 100 in a given day, API will return error message unless you purchase one of the matching plans below. Free plan is considered for development phase and we recommend all users to upgrade to a paid plan for production website.
Use right side guide on how to build your query and send to our server. We accept IP and Key paramters for geographic API and UA parameter for user-agent decoder API. Response returned will be JSON format. If there is an error (API limit exceed, API key invalid, ...) status field will be "Error" and msg field will provide error details, otherwise status will return "OK" and msg will be empty.
When a response contain status "OK", you may gather your information from it by decoding json string. Decoding json is supported natively in most programming languages. As example:
//Set a default country name $country="Unknown"; //Request from geolocation API if ($response=@file_get_contents("https://ip.city/api.php?ip=[IP]&key=[YOUR_API_KEY]")&&$response){ //Convert json to array $response_result=(array) json_decode($response,true); //check if response status is OK if ($response_result['status']=='OK'){ //Get country name $country=$response_result['countryName']; } }
This API receive IP address and return country name, country code, city name, longitude and latitude related by that IP address. IP database is updated on monthly basis. We support both IPv4 and IPv6.
https://ip.city/api.php?ip=[IP]&key=[YOUR_API_KEY]
{ status: "OK", countryName: "United States", countryCode: "US", city: "Columbus", region: "Ohio", organisation: "Amazon.com", lat: "39.9625", long: "-83.0061", msg: "" }
This API receive user-agent string and give you specification of the device which uses that user-agent string. This service is being updated and maintained regularly as new browser or OS version is released.
https://ip.city/api.php?ua=[UA]&key=[YOUR_API_KEY]
{
status: "OK",
os: "",
browser: "Safari",
browserv: "53",
device: "pc", //pc,tablet,phone
os_icon: "https://ip.city/img/pc/na.png",
browser_icon: "https://ip.city/img/pc/safari14.png",
msg: ""
}