Skip to content

IP Geolocation API

Get comprehensive location data for any IP address, including timezone, currency, and network information.

Endpoint

http
GET /v1/geo/lookup

Parameters

ParameterTypeRequiredDescription
ipstringNoIP to look up. Defaults to caller's IP.

Request

bash
# Look up specific IP
curl -H "X-API-Key: hb_live_xxxxx" \
  "https://api.hummingbirdapi.com/v1/geo/lookup?ip=8.8.8.8"

# Look up caller's IP
curl -H "X-API-Key: hb_live_xxxxx" \
  "https://api.hummingbirdapi.com/v1/geo/lookup"
javascript
// Look up specific IP
const response = await fetch(
  'https://api.hummingbirdapi.com/v1/geo/lookup?ip=8.8.8.8',
  { headers: { 'X-API-Key': 'hb_live_xxxxx' } }
);
const { data } = await response.json();
console.log(data.location.city_name); // "Mountain View"
console.log(data.time.zone);          // "America/Los_Angeles"
console.log(data.currency.symbol);    // "$"
python
import requests

# Look up specific IP
response = requests.get(
    'https://api.hummingbirdapi.com/v1/geo/lookup',
    params={'ip': '8.8.8.8'},
    headers={'X-API-Key': 'hb_live_xxxxx'}
)
data = response.json()['data']
print(data['location']['city_name'])  # Mountain View
print(data['time']['zone'])           # America/Los_Angeles
print(data['currency']['symbol'])     # $
go
req, _ := http.NewRequest("GET",
    "https://api.hummingbirdapi.com/v1/geo/lookup?ip=8.8.8.8", nil)
req.Header.Set("X-API-Key", "hb_live_xxxxx")

resp, _ := client.Do(req)
defer resp.Body.Close()

var result GeoResponse
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result.Data.Location.CityName)
ruby
require 'httparty'

response = HTTParty.get(
  'https://api.hummingbirdapi.com/v1/geo/lookup',
  query: { ip: '8.8.8.8' },
  headers: { 'X-API-Key' => 'hb_live_xxxxx' }
)
data = response.parsed_response['data']
puts data['location']['city_name']
php
$response = Http::withHeaders([
    'X-API-Key' => 'hb_live_xxxxx'
])->get('https://api.hummingbirdapi.com/v1/geo/lookup', [
    'ip' => '8.8.8.8'
]);

$data = $response->json()['data'];
echo $data['location']['city_name'];

Response

All responses use the unified envelope format with fields in this order: success, data, error, error_code, error_message.

json
{
  "success": true,
  "data": {
    "ip": "8.8.8.8",
    "ip_type": "ipv4",

    "location": {
      "continent_code": "NA",
      "continent_name": "North America",
      "country_code": "US",
      "country_code_iso3": "USA",
      "country_name": "United States",
      "country_capital": "Washington",
      "country_tld": ".us",
      "country_calling_code": "+1",
      "country_flag_emoji": "🇺🇸",
      "country_languages": ["en", "es"],
      "country_area_km2": 9833520,
      "country_population": 331449281,
      "country_neighbors": ["CA", "MX"],
      "country_is_eu": false,
      "region_code": "CA",
      "region_name": "California",
      "city_name": "Mountain View",
      "postal_code": "94043",
      "latitude": 37.386,
      "longitude": -122.084,
      "weather_code": "USCA0746"
    },

    "time": {
      "zone": "America/Los_Angeles",
      "abbr": "PST",
      "utc_offset": "-08:00",
      "utc_offset_seconds": -28800,
      "current_time": "2026-01-26T10:30:00-08:00",
      "current_timestamp": 1737913800,
      "is_dst": false
    },

    "currency": {
      "code": "USD",
      "name": "US Dollar",
      "symbol": "$"
    },

    "network": {
      "asn": 15169,
      "asn_organization": "Google LLC",
      "isp": "Google LLC",
      "organization": "Google LLC",
      "connection_type": "Corporate",
      "user_type": "hosting"
    }
  },
  "error": false,
  "error_code": null,
  "error_message": null
}

Response Fields

Root Level

FieldTypeDescription
ipstringIP address looked up
ip_typestring"ipv4" or "ipv6"

location Object

FieldTypeDescription
continent_codestringTwo-letter continent code
continent_namestringContinent name
country_codestringISO 3166-1 alpha-2 country code
country_code_iso3stringISO 3166-1 alpha-3 country code
country_namestringCountry name
country_capitalstringCapital city
country_tldstringTop-level domain
country_calling_codestringInternational calling code
country_flag_emojistringFlag emoji
country_languagesstring[]Primary languages
country_area_km2numberArea in km²
country_populationnumberPopulation
country_neighborsstring[]Neighboring countries
country_is_eubooleanEU membership
region_codestringRegion/state code
region_namestringRegion/state name
city_namestringCity name
postal_codestringPostal/ZIP code
latitudenumberLatitude
longitudenumberLongitude
weather_codestringWeather station code

time Object

FieldTypeDescription
zonestringIANA timezone
abbrstringTimezone abbreviation
utc_offsetstringUTC offset (±HH:MM)
utc_offset_secondsnumberUTC offset in seconds
current_timestringCurrent local time (ISO 8601)
current_timestampnumberUnix timestamp
is_dstbooleanDaylight saving active

currency Object

FieldTypeDescription
codestringISO 4217 currency code
namestringCurrency name
symbolstringCurrency symbol

network Object

FieldTypeDescription
asnnumberAutonomous System Number (optional)
asn_organizationstringASN organization name
ispstringInternet Service Provider
organizationstringOrganization name
connection_typestringConnection type
user_typestringUser type

Supported Formats

  • IPv4: 192.168.1.1
  • IPv6: 2001:4860:4860::8888

Errors

CodeMessageFix
10001Invalid IP address formatCheck IP format
10002Cannot geolocate private IPUse public IP
20001Missing API keyAdd header
20002Invalid API keyCheck key
30001Rate limit exceededWait and retry
30002Quota exceededUpgrade plan

Use Cases

Localization

javascript
const { location, currency } = (await lookupIP(userIP)).data;

// Display prices in local currency
if (currency.code === 'EUR') {
  showEuroPricing();
} else if (currency.code === 'GBP') {
  showPoundPricing();
}

// Show country flag
document.getElementById('flag').textContent = location.country_flag_emoji;

GDPR Compliance

javascript
const { location } = (await lookupIP(userIP)).data;

if (location.country_is_eu) {
  showCookieConsent();
}

Time-Aware Features

javascript
const { time } = (await lookupIP(userIP)).data;

// Schedule messages based on user's local time
const userHour = new Date(time.current_time).getHours();
if (userHour >= 9 && userHour <= 17) {
  showLiveChat();
}

Analytics

javascript
const { location, network } = (await lookupIP(userIP)).data;

analytics.track('page_view', {
  country: location.country_code,
  region: location.region_name,
  city: location.city_name,
  isp: network.isp,
  connection_type: network.connection_type
});

Performance

MetricValue
Median latency<100ms
Edge locations300+
Uptime SLA99.99%

Built with VitePress