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

GET POST /me

Returns geolocation data for your current IP address.

GET POST /{ip}

Returns geolocation data for the specified IPv4 or IPv6 address.

All lookup requests are rate-limited to 30 requests per minute per source IP.

Response Schema

FieldTypeDescription
ipstringQueried IP address
hostnamestringReverse DNS (PTR) name, empty if unavailable
citystringCity name (e.g. Madrid, New York)
regionstringRegion, state, or subdivision
countrystringCountry name
country_codestringISO 3166-1 alpha-2 country code
postal_codestringPostal or ZIP code
latitudenumberApproximate latitude coordinate
longitudenumberApproximate longitude coordinate
timezonestringIANA timezone (e.g. Europe/Madrid)
continentstringContinent name

Response Formats

The output format is resolved using the following priority:

  1. URL file extension — append .json, .xml, .yaml, .csv, .ini, .txt, or .html to any endpoint (e.g. /me.yaml, /8.8.8.8.html).
  2. Accept header (or Content-Type) — the first recognized MIME type wins.
  3. Default — JSON when nothing else matches.
text/html application/json application/xml application/x-yaml text/plain text/csv text/ini
Browsers send 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.