IP2Location IP Geolocation
ip2location · Location
IP2Location web service providing a service to do a reverse lookup of an IP address to an ISO3166 country code, region or state, city, latitude and longitude, ZIP/Postal code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, usage type, address type and IAB category. There are also 7 categories of additional add-on response f
Authentication
Sample Requests
Get geolocation information via IP address
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/?ip=8.8.8.8&key=YOUR_API_KEY&lang=ar&addon=continent%2Ccountry&format=json&package=WS1"
import requests
params = {
"ip": "8.8.8.8",
"key": "YOUR_API_KEY",
"lang": "ar",
"addon": "continent,country",
"format": "json",
"package": "WS1"
}
response = requests.get(
"https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/');
url.searchParams.set('ip', '8.8.8.8');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('lang', 'ar');
url.searchParams.set('addon', 'continent,country');
url.searchParams.set('format', 'json');
url.searchParams.set('package', 'WS1');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/")
q := baseURL.Query()
q.Set("ip", "8.8.8.8")
q.Set("key", "YOUR_API_KEY")
q.Set("lang", "ar")
q.Set("addon", "continent,country")
q.Set("format", "json")
q.Set("package", "WS1")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/")
uri.query = URI.encode_www_form({
"ip" => "8.8.8.8",
"key" => "YOUR_API_KEY",
"lang" => "ar",
"addon" => "continent,country",
"format" => "json",
"package" => "WS1"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/ip2location.com/geolocation/1.0/?" . http_build_query([
"ip" => "8.8.8.8",
"key" => "YOUR_API_KEY",
"lang" => "ar",
"addon" => "continent,country",
"format" => "json",
"package" => "WS1"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with IP2Location IP Geolocation?
IP2Location IP Geolocation is a Location API. Developers commonly use location APIs for:
- tracking assets and vehicles in real time
- building delivery and logistics apps
- finding nearby businesses or services
- geo-fencing and location-based notifications
- address validation and autocomplete
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. IP2Location IP Geolocation is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide · Learn about API keys · What is REST?