IPGu.net

Developer API

IPGu.net provides a free, no-auth API for developers who need to look up IP data programmatically. No signup and no API key required. Two response formats are available — plain text for simple scripts, and JSON for applications that need geolocation details.

Geolocation data is served from a local MaxMind GeoLite2 database. Your IP address is not forwarded to any third party.

Available Endpoints

GET /ip — Plain Text

Returns your public IP address as a single line of plain text. The simplest option — ideal for shell scripts and automation pipelines.

curl https://ipgu.net/ip

Example response:

203.150.12.45

GET /json — JSON

Returns your IP address along with geolocation data as JSON. Includes country, city, region, timezone, ISP, and ASN where available.

curl https://ipgu.net/json

Example response:

{
  "ip": "203.150.12.45",
  "country_code": "TH",
  "country": "Thailand",
  "region": "Bangkok",
  "city": "Bangkok",
  "timezone": "Asia/Bangkok",
  "asn": "AS7470",
  "isp": "True Internet Co., Ltd."
}

Fields with no data are omitted from the response. The asn value is formatted as AS + the number, e.g. AS7470.

Usage Examples

Shell / Bash

# Store IP in a variable
MY_IP=$(curl -s https://ipgu.net/ip)
echo "Your IP: $MY_IP"

# Fetch JSON and parse with jq
curl -s https://ipgu.net/json | jq '.country'

JavaScript (Fetch API)

// Get IP as plain text
const ip = await fetch('https://ipgu.net/ip').then(r => r.text());
console.log('IP:', ip.trim());

// Get JSON data
const data = await fetch('https://ipgu.net/json').then(r => r.json());
console.log(data.country, data.city);

Python

import requests

# Plain text
ip = requests.get('https://ipgu.net/ip').text.strip()
print('IP:', ip)

# JSON
data = requests.get('https://ipgu.net/json').json()
print(data['country'], data.get('city', ''))

Fair Use Policy

This API is provided free of charge with no authentication. To keep it available for everyone, please use it reasonably — avoid polling or scraping at unnecessarily high rates. For high-volume production use cases, consider using MaxMind GeoIP2 directly.

Both endpoints send Access-Control-Allow-Origin: *, so they can be called from browser-side JavaScript without CORS issues.

Further Reading

For background on how geolocation works and its accuracy limits, see What is an IP?. For more curl and terminal commands, see CLI Commands.