Country API
Overview
Country.is is a simple, free API that detects a visitor's country based on their IP address. It returns a two-letter country code in milliseconds with no authentication required. It is ideal for beginners who need basic IP geolocation without setting up complex libraries.
Beginner Tip
When testing locally, the API will return a loopback or private network result; deploy to a real server to see accurate country detection. You can also pass any IP as a query parameter: http://country.is/8.8.8.8.
Available Data
Example Response
{
"name": "Japan",
"capital": "Tokyo",
"population": 125800000,
"region": "Asia",
"languages": [
"Japanese"
],
"flag": "https://flagcdn.com/jp.svg",
"currencies": [
{
"code": "JPY",
"name": "Japanese yen"
}
]
} Field Reference
ip The IP address that was queried, either from the caller or the one specified in the URL path. country Two-letter ISO 3166-1 alpha-2 country code (e.g., "US", "DE", "JP") corresponding to the IP address. Implementation Example
const url = "http://country.is/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
Common Errors & Troubleshooting
Matrix Score Breakdown
Fully tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →administrative-divisons-db
⭐ Beginner's PickThe Administrative Divisions DB API provides a structured list of all administrative divisions (states, provinces, regions, cities) for countries around the world.
adresse.data.gouv.fr
adresse.data.gouv.fr provides programmatic access to address database of france, geocoding and reverse via REST API.
Airtel IP
⭐ Beginner's PickAirtel IP is a free, no-auth IP geolocation API that aggregates data from multiple sources to return the country associated with any given IP address.
bng2latlong
⭐ Beginner's Pickbng2latlong is a simple, free API that converts British National Grid (OSGB36) easting and northing coordinates into standard WGS84 latitude and longitude.
Cartes.io
⭐ Beginner's PickCartes.io is a free API that lets you create maps and add custom markers without signing up.