How to use the api

Basic

The API provides up-to-date and accurate geolocation as well as security information by detecting or resolving a specific IP.

http://0.0.0.0:8080/YOUR_API_KEY/detect?include=city
http://0.0.0.0:8080/YOUR_API_KEY/161.185.160.93?include=city

Example API Response (default format is Json)

http://0.0.0.0:8080/YOUR_API_KEY/161.185.160.93?include=country_eu_member,country_emoji
{
   country_emoji: "🇺🇸",
   country_eu_member: true,
}

Available data via include parameter

Parameter & Example
capital: "Washington D.C." (string)
city: "Brooklyn" (string)
continent_code: "NA" (string)
continent_name: "North America" (string)
country_alpha_2: "US" (string)
country_alpha_3: "USA" (string)
country_dialing_code: ["1"] (string[])
country_emoji: "🇺🇸" (string)
country_eu_member: false (bool)
country_name: "United States" (string)
country_subdivision: "New York" (string)
country_subdivision_id: "NY" (string)
country_zip_code: "11205" (string)
currency_code: ["USD","USN","USS"] (string[])
ip: "161.185.160.93" (string)
ip_version: 4 (int)
is_proxy: false (bool)
is_tor: false (bool)
location_latitude: 40.6955 (float)
location_longitude: -73.9667 (float)
proxy_type: null (string|null)
success: true (bool)//successful or failed
time_zone: "America/New_York" (string)

Code Snippets

React example
fetch("http://0.0.0.0:8080/YOUR_API_KEY/detect?include=country_eu_member")
    .then(response => response.json())
    .then(response => {
        if (response.success) {
            if (response.country_eu_member) {
                showGdpr()
            }
        }
    });

Ajax example
$.getJSON("http://0.0.0.0:8080/YOUR_API_KEY/detect?include=country_eu_member,ip", function(result){
  if(result.country_eu_member){
    $("div").append(result.ip);
  }
});

PHP example
$ch = curl_init('http://0.0.0.0:8080/YOUR_API_KEY/detect?include=country_eu_member');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result, true);
echo $response['country_eu_member'];

curl example
curl http://0.0.0.0:8080/YOUR_API_KEY/detect?include=country_eu_member

Example full Response

http://0.0.0.0:8080/YOUR_API_KEY/161.185.160.93
{
   connection: {
       ip: "161.185.160.93",
       ip_version: "4"
   },
   currency: {
       code: [
           "USD",
           "USN",
           "USS"
       ]
   },
   location: {
       capital: "Washington D.C.",
       city: "New York",
       continent: {
           code: "NA",
           name: "North America"
       },
       country: {
           alpha_2: "US",
           alpha_3: "USA",
           dialing_code: [
               "1"
           ],
           emoji: "🇺🇸",
           eu_member: false,
           name: "United States",
           subdivision: "New York",
           subdivision_id: "NY",
           zip_code: "10003"
       },
       latitude: 40.7359,
       longitude: -73.9904
   },
   security: {
       is_proxy: false,
       is_tor: false,
       proxy_type: null
   },
   success: true,
   time: {
       zone: "America/New_York"
   }
}