IPv4 Lookup API

Country, region, city, approximate coordinates, timezone, the autonomous system and the organisation that announces it, and whether the address belongs to a datacentre or a known proxy. Leave the ip parameter out and you get the caller's own address, which is the common case for websites.

GEThttps://api.mygeocode.com/v1/ipv4?ip=...

Try it in the demo Full reference

Example

Request
$ curl "https://api.mygeocode.com/v1/ipv4?ip=8.8.8.8"

# The caller's own address
$ curl "https://api.mygeocode.com/v1/ipv4"

City-level geolocation of an IP address is an estimate and always will be; the address belongs to a network, not a person. Country is right for well over 99% of addresses. City is most reliable for consumer ISPs and least reliable for mobile carriers and datacentres, which is why those are flagged.

Response
{
  "status": "ok",
  "ip": "8.8.8.8",
  "version": 4,
  "country": "United States",
  "country_code": "US",
  "region": "California",
  "region_code": "CA",
  "city": "Mountain View",
  "postcode": "94043",
  "lat": 37.4056,
  "lon": -122.0775,
  "timezone": "America/Los_Angeles",
  "asn": 15169,
  "org": "Google LLC",
  "is_datacenter": true,
  "is_proxy": false
}

What you get back

FieldMeaning
country, country_codeCountry name and ISO 3166-1 alpha-2 code.
region, region_codeState, province or equivalent, with its ISO 3166-2 code where one exists.
city, postcodeBest estimate of the city and postal code. Absent when unknown.
lat, lonCoordinates of the city or, failing that, the region or country centre.
timezoneIANA name, from the location.
asn, orgThe autonomous system number and the organisation that announces the prefix.
is_datacenterThe address is in a hosting or cloud range. Treat city as unreliable and consider that the traffic may be automated.
is_proxyThe address is a known VPN exit, Tor exit or public proxy.

Where it is used

Localising a first visit

Pick a default country, currency, language and units before the visitor has typed anything. Call without ip from the browser and it uses the visitor's address.

Fraud and abuse signals

Compare the IP country with the billing country. Treat is_proxy and is_datacenter as signals, not verdicts.

Analytics without cookies

Aggregate visits by country and region server-side from access logs, with no client-side tracking at all.

Price and limits

One call is one request; a batch counts one per address. 2,500 a day free, then credits at $0.001 per request or €50 a month unlimited. Pricing. Migrating from ip-api, ipinfo or ipstack? Those formats are available as drop-in hosts. For IPv6 addresses see the IPv6 Lookup API.