API Directory › 🌍 Geo & Location › Country.is
No authHTTPSCORS

Country.is API

Dead-simple, key-free API that returns the country for the caller's IP.

Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open Country.is docs ↗

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

https://api.country.is

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
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"}
JavaScript
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

ipThe IP that was resolved
countryISO 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.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

IP LookupDNS Lookup

Related Geo & Location APIs

← Back

More Geo & Location APIs · All 196 APIs