IP Geolocation API
Blazing fast, free IP address lookup powered by MaxMind GeoLite2-City
Resolve any IPv4 or IPv6 address into city, region, country, coordinates, timezone, and more. Returns HTML, JSON, XML, YAML, CSV, INI, or plain text.
API Endpoints
Returns geolocation data for your current IP address.
Returns geolocation data for the specified IPv4 or IPv6 address.
Response Schema
| Field | Type | Description |
|---|---|---|
| ip | string | Queried IP address |
| hostname | string | Reverse DNS (PTR) name, empty if unavailable |
| city | string | City name (e.g. Madrid, New York) |
| region | string | Region, state, or subdivision |
| country | string | Country name |
| country_code | string | ISO 3166-1 alpha-2 country code |
| postal_code | string | Postal or ZIP code |
| latitude | number | Approximate latitude coordinate |
| longitude | number | Approximate longitude coordinate |
| timezone | string | IANA timezone (e.g. Europe/Madrid) |
| continent | string | Continent name |
Response Formats
The output format is resolved using the following priority:
- URL file extension — append
.json,.xml,.yaml,.csv,.ini,.txt, or.htmlto any endpoint (e.g./me.yaml,/8.8.8.8.html). Acceptheader (orContent-Type) — the first recognized MIME type wins.- Default — JSON when nothing else matches.
Accept: text/html by default, so opening any lookup URL in a browser returns a styled HTML page. Use the file extension to override this (e.g. /me.json).
Usage Examples
# Look up your own IP address
curl https://ipinfo.javiervalencia.net/me
# Look up a specific IP address
curl https://ipinfo.javiervalencia.net/8.8.8.8
# Get response in JSON (default)
curl -H "Accept: application/json" \
https://ipinfo.javiervalencia.net/1.1.1.1
# Get response in XML
curl -H "Accept: application/xml" \
https://ipinfo.javiervalencia.net/1.1.1.1
# Get response in YAML
curl -H "Accept: application/x-yaml" \
https://ipinfo.javiervalencia.net/1.1.1.1
# Get response in plain text
curl -H "Accept: text/plain" \
https://ipinfo.javiervalencia.net/me
# Get response in CSV
curl -H "Accept: text/csv" \
https://ipinfo.javiervalencia.net/me
# Get response in INI
curl -H "Accept: text/ini" \
https://ipinfo.javiervalencia.net/me
# Force format via URL extension
curl https://ipinfo.javiervalencia.net/me.json
curl https://ipinfo.javiervalencia.net/8.8.8.8.yaml
curl https://ipinfo.javiervalencia.net/1.1.1.1.xml
curl https://ipinfo.javiervalencia.net/me.csv
curl https://ipinfo.javiervalencia.net/me.txt
curl https://ipinfo.javiervalencia.net/me.ini
# Open in browser (returns HTML)
# https://ipinfo.javiervalencia.net/me
# https://ipinfo.javiervalencia.net/8.8.8.8
Response Examples
JSON
{
"ip": "8.8.8.8",
"hostname": "dns.google",
"city": "Mountain View",
"region": "California",
"country": "United States",
"country_code": "US",
"postal_code": "94035",
"latitude": 37.386,
"longitude": -122.0838,
"timezone": "America/Los_Angeles",
"continent": "North America"
}
XML
<?xml version="1.0" encoding="UTF-8"?>
<ipinfo>
<ip>8.8.8.8</ip>
<hostname>dns.google</hostname>
<city>Mountain View</city>
<region>California</region>
<country>United States</country>
<country_code>US</country_code>
<postal_code>94035</postal_code>
<latitude>37.386</latitude>
<longitude>-122.0838</longitude>
<timezone>America/Los_Angeles</timezone>
<continent>North America</continent>
</ipinfo>
YAML
ip: 8.8.8.8
hostname: dns.google
city: Mountain View
region: California
country: United States
country_code: US
postal_code: "94035"
latitude: 37.386
longitude: -122.0838
timezone: America/Los_Angeles
continent: North America
Plain text
ip: 8.8.8.8
hostname: dns.google
city: Mountain View
region: California
country: United States
country_code: US
postal_code: 94035
latitude: 37.386000
longitude: -122.083800
timezone: America/Los_Angeles
continent: North America
CSV
ip,hostname,city,region,country,country_code,postal_code,latitude,longitude,timezone,continent
8.8.8.8,dns.google,Mountain View,California,United States,US,94035,37.386000,-122.083800,America/Los_Angeles,North America
INI
[ipinfo]
ip=8.8.8.8
hostname=dns.google
city=Mountain View
region=California
country=United States
country_code=US
postal_code=94035
latitude=37.386000
longitude=-122.083800
timezone=America/Los_Angeles
continent=North America
Frequently Asked Questions
How do I find my IP address location?
Send a request to /me and the API will return the geolocation of your public IP address, including city, region, country, and coordinates.
Does it support IPv6?
Yes. Both IPv4 and IPv6 addresses are fully supported. Example: /2001:4860:4860::8888
What is the rate limit?
30 requests per minute per source IP. If exceeded, the API returns 429 Too Many Requests with a Retry-After: 60 header.
How do I choose the response format?
The easiest way is to append a file extension: /me.json, /8.8.8.8.xml, /me.yaml, etc. The extension always takes priority. Alternatively, set the Accept header to the desired MIME type. If neither is specified, the default is JSON. Browsers receive HTML automatically since they send Accept: text/html.
Where does the geolocation data come from?
The data is sourced from the MaxMind GeoLite2-City database, which is updated regularly.