API Reference
Geolocate IPv4/IPv6 addresses with JSON or XML responses.
Base URL:
https://ip-geo-api.com/api/v1
Endpoint
- GET /ip/{ip?}
- If {ip} omitted, uses requester IP.
- Supports IPv6.
Query
- format: json (default) or xml
- key: API key (alternative to header)
Headers
- X-API-Key: <token> (recommended)
- Accept: application/xml (optional; selects XML)
Examples
# curl
curl "https://ip-geo-api.com/api/v1/ip?format=json"
# JavaScript
fetch("https://ip-geo-api.com/api/v1/ip?format=json").then(r => r.json())
# Python
import requests
print(requests.get("https://ip-geo-api.com/api/v1/ip", params={"format":"json"}).json())
# PHP
echo file_get_contents("https://ip-geo-api.com/api/v1/ip?format=xml");
# Go
http.Get("https://ip-geo-api.com/api/v1/ip?format=json")
Response
{
"success": true,
"ip": "8.8.8.8",
"asn": 15169,
"isp": "Google LLC",
"continent_code": "NA",
"continent_names": {
"de": "Nordamerika",
"en": "North America",
"es": "Norteamérica",
"fa": " امریکای شمالی",
"fr": "Amérique Du Nord",
"ja": "北アメリカ大陸",
"ko": "북아메리카",
"pt-BR": "América Do Norte",
"ru": "Северная Америка",
"zh-CN": "北美洲"
},
"country_code": "US",
"is_eu_country": false,
"country_names": {
"de": "Vereinigte Staaten von Amerika",
"en": "United States",
"es": "Estados Unidos de América (los)",
"fa": "ایالات متحدهٔ امریکا",
"fr": "États-Unis",
"ja": "アメリカ合衆国",
"ko": "미국",
"pt-BR": "Estados Unidos",
"ru": "США",
"zh-CN": "美国"
},
"city_names": {
"en": "Mountain View"
},
"subdivisions": [
{
"names": {
"en": "California"
}
}
],
"lat": 37.4223,
"lon": -122.085
}
Errors & Limits
- 422 Invalid IP address
- 429 Too Many Requests (includes retry_after seconds)
Limits:
- Public (no key): 50 req/min per IP
- With key: at least 200 req/min (plan can increase)