Geolocation API Developer Resource
Available in: IPinfo Core, IPinfo Plus, and IPinfo Enterprise
The Geolocation API allows you to programmatically access detailed location data for any IP address, including city, region, country, geographic coordinates, timezone, and postal code. The Geolocation API is available at /{ip}/geo.
Quick Reference
API Schema
JSON
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "IPinfo Geolocation API Response",
"description": "Schema for IPinfo Geolocation API response",
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city where the IP address is located.",
"example": "Mountain View"
},
"region": {
"type": "string",
"description": "The region or state where the IP address is located.",
"example": "California"
},
"region_code": {
"type": "string",
"description": "The two-letter region code in ISO 3166 format.",
"example": "CA"
},
"country": {
"type": "string",
"description": "The country where the IP address is located.",
"example": "United States"
},
"country_code": {
"type": "string",
"description": "The ISO 3166-1 alpha-2 country code of the IP address.",
"example": "US"
},
"continent": {
"type": "string",
"description": "The continent where the IP address is located.",
"example": "North America"
},
"continent_code": {
"type": "string",
"description": "The two-letter continent code.",
"example": "NA"
},
"latitude": {
"type": "number",
"description": "The latitude coordinate of the IP address location.",
"example": 37.4056
},
"longitude": {
"type": "number",
"description": "The longitude coordinate of the IP address location.",
"example": -122.0775
},
"timezone": {
"type": "string",
"description": "The local timezone of the IP address location, formatted according to the IANA Time Zone Database.",
"example": "America/Los_Angeles"
},
"postal_code": {
"type": "string",
"description": "The postal or zip code associated with the IP address location.",
"example": "94043"
}
}
}
| Field | Type | Description | Example |
|---|---|---|---|
city | string | The city where the IP address is located. | Mountain View |
region | string | The region or state where the IP address is located. | California |
region_code | string | The two-letter region code in ISO 3166 format. | CA |
country | string | The country where the IP address is located. | United States |
country_code | string | The ISO 3166-1 alpha-2 country code of the IP address. | US |
continent | string | The continent where the IP address is located. | North America |
continent_code | string | The two-letter continent code. | NA |
latitude | number | The latitude coordinate of the IP address location. | 37.4056 |
longitude | number | The longitude coordinate of the IP address location. | -122.0775 |
timezone | string | The local timezone of the IP address location, formatted according to the IANA Time Zone Database. | America/Los_Angeles |
postal_code | string | The postal or zip code associated with the IP address location. | 94043 |
Lookup IP Address Geolocation
Bash
curl https://ipinfo.io/8.8.8.8/geo?token=$TOKEN
JSON
{
"city": "Mountain View",
"region": "California",
"region_code": "CA",
"country": "United States",
"country_code": "US",
"continent": "North America",
"continent_code": "NA",
"latitude": 37.4056,
"longitude": -122.0775,
"timezone": "America/Los_Angeles",
"postal_code": "94043"
}
Extended Geolocation Fields
IPinfo Plus and Enterprise plans include additional geolocation fields for enhanced location accuracy and metadata.
| Field | Type | Description | Example | Availability |
|---|---|---|---|---|
dma_code | string | The Designated Market Area (DMA) code, representing a TV media market region. | 807 | Plus, Enterprise |
geoname_id | integer | The unique numerical identifier for geographic locations from Geonames.org. | 5375480 | Plus, Enterprise |
radius | integer | The location accuracy radius in kilometers. | 5 | Plus, Enterprise |
last_changed | string (date) | The date when the IP address's location was last updated, in YYYY-MM-DD format (ISO-8601). | 2025-06-15 | Plus, Enterprise |
Extended Geolocation Response Example
Bash
curl https://ipinfo.io/8.8.8.8/geo?token=$TOKEN
JSON
{
"city": "Mountain View",
"region": "California",
"region_code": "CA",
"country": "United States",
"country_code": "US",
"continent": "North America",
"continent_code": "NA",
"latitude": 37.4056,
"longitude": -122.0775,
"timezone": "America/Los_Angeles",
"postal_code": "94043",
"dma_code": "807",
"geoname_id": 5375480,
"radius": 5,
"last_changed": "2025-06-15"
}
Querying Specific Geolocation Fields
You can query specific geolocation fields directly by appending the field name to the API endpoint.
Bash
# Get only the city
curl https://ipinfo.io/8.8.8.8/city?token=$TOKEN
# Response: Mountain View
# Get only the country
curl https://ipinfo.io/8.8.8.8/country?token=$TOKEN
# Response: US
# Get only the coordinates (loc)
curl https://ipinfo.io/8.8.8.8/loc?token=$TOKEN
# Response: 37.4056,-122.0775
# Get only the timezone
curl https://ipinfo.io/8.8.8.8/timezone?token=$TOKEN
# Response: America/Los_Angeles
# Get only the postal code
curl https://ipinfo.io/8.8.8.8/postal?token=$TOKEN
# Response: 94043
Related Resources
- IP to Geolocation Database: Download the complete geolocation database for offline use.
- IP to Geolocation Extended Database: Extended geolocation data with additional fields and metadata.
- IPinfo Core API: Full IP lookup including geolocation, ASN, and network flags.
- IPinfo Plus API: Comprehensive IP data with extended geolocation and privacy detection.
If you are using an IPv6 connection, please use the v6.ipinfo.io endpoint.
Was this page helpful?