IPinfo - Comprehensive IP address data, IP geolocation API and database

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"
    }
  }
}
FieldTypeDescriptionExample
citystringThe city where the IP address is located.Mountain View
regionstringThe region or state where the IP address is located.California
region_codestringThe two-letter region code in ISO 3166 format.CA
countrystringThe country where the IP address is located.United States
country_codestringThe ISO 3166-1 alpha-2 country code of the IP address.US
continentstringThe continent where the IP address is located.North America
continent_codestringThe two-letter continent code.NA
latitudenumberThe latitude coordinate of the IP address location.37.4056
longitudenumberThe longitude coordinate of the IP address location.-122.0775
timezonestringThe local timezone of the IP address location, formatted according to the IANA Time Zone Database.America/Los_Angeles
postal_codestringThe 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.

FieldTypeDescriptionExampleAvailability
dma_codestringThe Designated Market Area (DMA) code, representing a TV media market region.807Plus, Enterprise
geoname_idintegerThe unique numerical identifier for geographic locations from Geonames.org.5375480Plus, Enterprise
radiusintegerThe location accuracy radius in kilometers.5Plus, Enterprise
last_changedstring (date)The date when the IP address's location was last updated, in YYYY-MM-DD format (ISO-8601).2025-06-15Plus, 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

If you are using an IPv6 connection, please use the v6.ipinfo.io endpoint.

Was this page helpful?