When to use this API
When you need to turn an IP address into geographical context — country, coordinates, timezone, or ISP details. This is useful for regional content targeting, timezone detection, fraud prevention, or network diagnostics. GeoJS is a rare free IP geolocation service that requires no signup and no API key, and it returns structured JSON rather than forcing you to parse HTML tables.
Getting the caller's IP address
"What's my IP address?" The simplest starting point is /ip.json, which returns your own IP in a parseable format. No parameters needed.
curl "https://get.geojs.io/v1/ip.json" | head -c 10000
{
"ip": "178.198.44.186"
}
The response is a clean object with a single field. The IP can be IPv4 or IPv6 depending on how the client connected — the API returns what it sees from the network layer, so you'll need to handle both formats if you're passing this downstream.
Your IP address is 178.198.44.186.
Getting full geolocation for an IP
"Where is 8.8.8.8 located?" The /ip/geo.json endpoint returns the full geolocation record including coordinates, timezone, and ISP information. Pass the IP as a query parameter.
curl "https://get.geojs.io/v1/ip/geo.json?ip=8.8.8.8" | head -c 10000
[{
"ip": "8.8.8.8",
"country": "United States",
"country_code": "US",
"country_code3": "USA",
"continent_code": "NA",
"latitude": "37.751",
"longitude": "-97.822",
"timezone": "America/Chicago",
"asn": 15169,
"organization": "AS15169 Google LLC",
"organization_name": "Google LLC",
"accuracy": 1000,
"area_code": "0"
}]
8.8.8.8 is Google's public DNS server, and the coordinates (37.751, -97.822) point to Wichita, Kansas — which is not where Google is headquartered but is a common datacenter location for anycast services. The accuracy field of 1000 means the location is approximate within a kilometer. Notice the response is an array even for a single IP — this is because the endpoint can accept multiple IPs in one call.
8.8.8.8 is located in the United States (Kansas area) with coordinates approximately 37.751, -97.822. It's operated by Google LLC (AS15169) and uses the America/Chicago timezone.
Getting just the country for an IP
"What country is this IP from?" Use /ip/country.json when you only need the country information and want a smaller response.
curl "https://get.geojs.io/v1/ip/country.json?ip=8.8.8.8" | head -c 10000
[{
"ip": "8.8.8.8",
"name": "United States",
"country": "US",
"country_3": "USA"
}]
This returns the same compact fields you saw in the full geolocation response: two-letter code (US), three-letter code (USA), and the full country name. The field naming is slightly inconsistent with the geo endpoint — here it's name and country, there it was country and country_code.
That IP (8.8.8.8) is from the United States (US).
Pitfalls
- Response is always an array for geo and country endpoints — even for a single IP. Don't expect a bare object; you'll get
[{...}]not{...}. - Field naming differs between endpoints —
/ip/geo.jsonusescountry_code,/ip/country.jsonusescountry. Same data, different keys. - Accuracy is in meters — the
accuracyfield represents the radius of uncertainty in meters, not a percentage. 1000 means "within 1km", not "99.9% accurate". - IP location is approximate — 8.8.8.8 shows Kansas because that's where Google's anycast routing lands, not because Google HQ is there. Datacenter IPs especially will show the hosting location, not the company headquarters.
One-line summary for the user
I can look up the country, coordinates, timezone, and ISP for any IP address via get.geojs.io in a single unauthenticated GET — no key required.