Country.is API
Dead-simple, key-free API that returns the country for the caller's IP.
What it does
country.is is a minimal API that returns the two-letter country code for an IP address — the caller’s by default, or any IP you pass in the path. That is the entire feature set: no city, no ISP, no key.
Base URL
Authentication
None. No key, no sign-up, CORS enabled so it works from the browser. The service is open source and runs on edge infrastructure.
Code examples
curl -s https://api.country.is # {"ip":"203.0.113.9","country":"US"}
curl -s https://api.country.is/8.8.8.8 # {"ip":"8.8.8.8","country":"US"}const { country } = await fetch("https://api.country.is").then(r => r.json());
if (country === "GB") showUKPricing();Rate limits & quotas
No published hard limit; it is designed for high volume and light payloads. Still, cache the result per session rather than calling it on every page view.
Key response fields
| ip | The IP that was resolved |
| country | ISO 3166-1 alpha-2 country code (e.g. DE) |
Common errors
| (rare) | 5xx only during an outage. |
| (no country) | For some reserved/unknown IPs the field may be absent — handle that case. |
When to use it (and alternatives)
Ideal for lightweight geo-gating: currency/language defaults, compliance banners, redirecting to a regional site. If you need city, coordinates or ISP, step up to ipinfo or ip-api.
FAQ
Is country.is really free with no limits?
It is free and key-less with no documented rate limit. As with any free service, cache aggressively and have a fallback default country.
Can I call it from front-end JavaScript?
Yes — it sends permissive CORS headers, so a browser fetch works directly. There is nothing secret to protect since there is no key.
How accurate is it?
Country-level IP geolocation is generally 95%+ accurate, far better than city-level. VPNs and some mobile carriers are the main sources of error.
New to APIs?
Short guides for working with this API — and any other.