IP Geolocation

The IP Geolocation API provides a simple and efficient way to retrieve geolocation information about an IP address.
25ms

About

The IP Geolocation API provides a simple and efficient way to retrieve geolocation information about an IP address. This service can be used to obtain information such as the country, region, city, latitude, and longitude associated with a given IP address.
by GLOBUS.studio

Endpoint

				
					/**
 * GeoIP API
 * GET https://api.globus.studio/v2/geo?ip=8.8.8.8&format=json
 * GET https://api.globus.studio/v2/geo?ip=8.8.8.8&full=true&format=json
 * Response: { country } or { country, city, region, latitude, longitude, region_name }
 */

async function getGeo(ip, full = false) {
    const url = new URL('https://api.globus.studio/v2/geo');
    url.searchParams.set('ip', ip);
    url.searchParams.set('format', 'json');
    if (full) url.searchParams.set('full', 'true');

    const res = await fetch(url);
    return res.json();
}

// Country only
getGeo('8.8.8.8').then(d => console.log(d.country));

// Full geo info
getGeo('8.8.8.8', true).then(d => console.log(d.city, d.region_name, d.latitude, d.longitude));