ipinfo.io drop-in replacement

ipinfo's compact JSON with a loc string and an org string prefixed by the AS number is reproduced at ipinfo.mygeocode.com. The official ipinfo client libraries accept a custom base URL, so they work too.

Change one hostname

Original host
  • ipinfo.io
Use insteadipinfo.mygeocode.com
Key parametertoken (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 "https://ipinfo.io/8.8.8.8/json?token=YOUR_IPINFO_TOKEN"
After
curl "https://ipinfo.mygeocode.com/8.8.8.8/json?token=YOUR_MYGEOCODE_KEY"

Why people move

ipinfo's free tier is 50,000 a month without geolocation details on some fields. Here every account gets 2,500 a day with full fields, and paid usage is per request or flat.

Same free allowance, key or not. Requests to ipinfo.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 ipinfo.mygeocode.comWhat it doesBacked by
/{ip}/jsonLookup by addressIPv4 lookup
/{ip}Lookup by address (same response)IPv4 lookup
/jsonLookup the callerIPv4 lookup
/{ip}/{field}Single field, plain text (ip, hostname, city, region, country, loc, org, postal, timezone)IPv4 lookup
/batch (POST, JSON array)Batch lookup, up to 1,000IPv4 lookup

Example response

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

Response from ipinfo.mygeocode.com
{
  "ip": "8.8.8.8",
  "hostname": "dns.google",
  "city": "Mountain View",
  "region": "California",
  "country": "US",
  "loc": "37.3862,-122.0838",
  "org": "AS15169 Google LLC",
  "postal": "94043",
  "timezone": "America/Los_Angeles",
  "anycast": true
}

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 ipinfo.io key went: the token query parameter, a Bearer token, or curl -u YOUR_KEY: like ipinfo’s own examples. 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 ipinfo.io returns and nothing else, so a response can be dropped into code that already parses ipinfo.io. Our additional data (ground elevation, threat and network detail) is available on request: add mg_extras=1 to the query or send X-MG-Extras: 1.

  • hostname comes from a reverse DNS lookup and is left out when the address has no PTR record, exactly as ipinfo does.
  • anycast appears when the address is anycast, and reserved ranges answer bogon.
  • An address that is not valid answers 404 with ipinfo’s "Wrong ip" body.
  • The readme field never appears, even on requests without a key.
  • The single field endpoints (/8.8.8.8/city and friends) return plain text.
  • POST /batch works as ipinfo’s does: a JSON array of up to 1,000 addresses, address/field paths or full URLs answers an object keyed by each entry, filter=1 drops the empty ones, and each entry counts as one lookup, as ipinfo counts them. A batch larger than what is left of the day’s allowance is refused whole with ipinfo’s 429 rather than partly answered.

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.