BlogData

127.0.0.1 is not an error

A local IP address can be valid without having a location. Why /ip returns null fields for loopback and private addresses.

If you're parsing IPs from a log, some of them will be local addresses. 127.0.0.1 is a perfectly valid IP. Treating it as a failed lookup would make your application handle an error just because there is no country to return.

So /ip returns 200 for it:

GET /ip/127.0.0.1
{
  "ip": "127.0.0.1",
  "country": null,
  "country_name": null,
  "continent": null,
  "asn": null,
  "asn_name": null
}

The same applies to IPv6 loopback (::1), private addresses like 10.0.0.1 and 192.168.1.1, and other special-use ranges. These aren't public addresses we can place on a map, so the location and network fields are null.

That is different from malformed input, which returns 400, or a public IP we have no record for, which returns 404. Those distinctions matter when you're deciding whether to retry a lookup, report an error, or just leave the location blank.

Asking for ?deep=true on a paid plan doesn't manufacture a location either. The extra fields are present, with null details and false flags. You can keep reading the same response fields and let an empty location be an ordinary result.