ip-api.com returns rich IP geolocation as JSON, but the free endpoint has two catches: it's non-commercial only, and it's HTTP-only (HTTPS needs the paid plan). If you want IP-to-country in a real product, countries.dev does it free, over HTTPS, with no key.
IP β country, over HTTPS
curl https://countries.dev/ip # the caller's own IP
curl https://countries.dev/ip/8.8.8.8 # any IP{ "ip": "8.8.8.8", "countryCode": "US", "country": { "name": "United States of America", "flag": "πΊπΈ" } }Free for commercial use, HTTPS, no key, no sign-up β and CORS is open for browser calls. The full country record comes attached, so you don't need a second request to turn a code into a name, flag or currency.
Batch up to 100
curl -X POST https://countries.dev/ip -d '["8.8.8.8","1.1.1.1"]'Being straight about scope
countries.dev resolves to country level β it doesn't return city, ISP/ASN or coordinates the way ip-api's richer fields do. If you need those and can work within the licensing, ip-api's paid plan fits. For country-level geolocation in production, countries.dev is free and keyless.
Switching over
ip-api returns countryCode; so does countries.dev, plus the country object. Map the fields and you're done.
See the IP geolocation API page for a live demo, or the docs.
Written by
Dov Azencot
At
Fri Jun 26 2026