ip-api.com drop-in replacement

ip-api's JSON endpoint is one of the most widely copied IP lookup formats. ipapi.mygeocode.com returns the same field names for IPv4 and IPv6 addresses, over HTTPS on free keys too, which ip-api does not offer.

Change one hostname

Original host
  • ip-api.com
  • pro.ip-api.com
Use insteadipapi.mygeocode.com
Key parameterkey (optional: any address gets 2,500 requests a day with no key; put your My Geocode key here for credit, packages and a usage history)
Before
curl "http://ip-api.com/json/8.8.8.8?fields=status,country,countryCode,city,lat,lon,timezone,isp,query"
After
curl "https://ipapi.mygeocode.com/json/8.8.8.8?fields=status,country,countryCode,city,lat,lon,timezone,isp,query"

Why people move

ip-api's free endpoint is HTTP only, non-commercial, and limited to 45 requests a minute. Here it is HTTPS, commercial use is fine, and any address gets 2,500 a day before paying anything, key or no key.

Same free allowance, key or not. Requests to ipapi.mygeocode.com count toward the same 2,500 free requests a day your address, or your key, gets on our own endpoints. Above that, prepaid credit at €0.0001 per request, or €50 a month for an Unlimited key. Signing up takes a name and an email address, and no card.

See pricing Get a free key

Endpoints

Path on ipapi.mygeocode.comWhat it doesBacked by
/json/{ip}Lookup by address, IPv4 or IPv6IPv4 lookup
/json/Lookup the callerIPv4 lookup
/batch (POST, JSON array)Batch lookup, up to 100IPv4 lookup

Example response

This is what the request above returns. Field names, nesting and types follow ip-api. Only the data behind them is ours.

Response from ipapi.mygeocode.com
{
  "status": "success",
  "country": "United States",
  "countryCode": "US",
  "city": "Mountain View",
  "lat": 37.3862,
  "lon": -122.0838,
  "timezone": "America/Los_Angeles",
  "isp": "Google LLC",
  "query": "8.8.8.8"
}

Details and differences

No key is needed for the first 2,500 requests a day. To use a My Geocode key, put it where your ip-api.com key went: the key query parameter. The X-API-Key header, Authorization: Bearer and HTTP Basic authentication (the key as the user name) work on every host too, so client libraries that authenticate their own way keep working unchanged.

Answers carry the fields ip-api.com returns and nothing else, so a response can be dropped into code that already parses ip-api.com. Our additional data (ground elevation, threat detail and the reason a lookup failed) is available on request: add mg_extras=1 to the query or send X-MG-Extras: 1.

  • The default answer is ip-api’s own field set, in its order. fields takes names or the numeric bitmask, and lang translates country and continent names into de, es, pt-BR, fr, ja, zh-CN and ru.
  • The json, xml, csv and line formats all work.
  • A bad address answers HTTP 200 with status: fail, as ip-api does; only key and quota refusals change the status code.
  • The batch endpoint takes up to 100 entries with per entry fields and lang, as ip-api does; each address in it counts as one request.
  • Ask for reverse and the host name is resolved for that address.
  • Region names come back as short codes for the United States, Canada and Australia; elsewhere the dataset only has the full name.

If your client depends on a field or behaviour that is not listed here, tell us. Compatibility gaps get fixed quickly because they are usually small.

Other drop-in hosts

How the drop-ins work, the overview, and the JavaScript library drop-ins.