IP Geolocation API
IP Geolocation API, also known Geo IP Lookup Service offers a robust and reliable way to pinpoint the geographical location of your visitors. This free service provides detailed information, including the country, city, latitude, longitude, postal code, and time zone, along with browser details directly from their IP addresses.
It comes generous usage quotas suitable for most projects under the fair use policy.
API Usage
free under the fair use policyJavaScriptcURLPythonJavaGocurl -H "Referer: your domain" "https://data.handyapi.com/geoip/"
$url = "https://data.handyapi.com/geoip/"; $options = [ "http" => [ "method" => "GET", "header" => "Referer: your_domain\r\n" ] ]; $context = stream_context_create($options); $response = @file_get_contents($url, false, $context); $data = @json_decode($response,true); print_r($data);
fetch('https://data.handyapi.com/geoip/') .then(response => response.json()) .then(data => { // use JSON data here }) .catch();
import requests response = requests.get('https://data.handyapi.com/geoip/', headers={'Referer': 'your-domain'}) if response.status_code == 200: data = response.json() print(data) else: print('Error:', response.status_code)
String url = "https://data.handyapi.com/geoip/"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Referer", "your domain") .build(); HttpResponse
response = client.send(request, HttpResponse.BodyHandlers.ofString()); String jsonString = response.body(); System.out.println(jsonString); url := "https://data.handyapi.com/geoip/" req, _ := http.NewRequest("GET", url, nil) req.Header.Set("Referer", "your_domain") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() fmt.Println(resp.Body)
Please note that this API does not accept an IP address as a parameter, so you can use this API from browser or mobile app (frontent ajax request). If you call it from your server, this will look up your server IP.
IP Address Lookup & Geolocation API
Geolocation is a powerful tool for customizing user experiences and ensuring regulatory compliance, but directly accessing a visitor's IP address or country from the frontend poses significant technical and privacy challenges. Browsers and mobile apps are restricted from directly retrieving this sensitive information to protect user privacy, necessitating an external solution.
This IP Address Lookup & Geolocation API addresses these challenges by providing an external server that can safely determine the user's location based on the request IP. This setup not only bypasses frontend limitations but also ensures compliance with stringent privacy standards. Being a free service developed by developers for developers, we prioritize privacy — no mapping of users to specific websites, no long-term logging, and strict adherence to user privacy.
By integrating our API, developers can implement features like geo-redirection and location-specific content customization without privacy concerns.
For instance, this API can automatically identify a user’s region, allowing your application to display relevant legal notices like GDPR cookie policies accurately. This capability is crucial for businesses aiming to provide a personalized experience while respecting user privacy and adhering to local laws.