Access detailed information about 240+ countries worldwide through a fast, reliable, and free REST API. Perfect for any application.
Built with modern technologies and best practices
Optimized response times under 100ms with MongoDB indexing and efficient queries.
Use from any domain without restrictions. Perfect for frontend applications.
Complete OpenAPI/Swagger documentation with interactive examples.
Population, area, languages, currencies, flags, borders, and much more.
Search by name, code, region, subregion, or any parameter you need.
Standard REST API following best practices and conventions.
All endpoints return JSON responses
Get started in seconds with these examples
// Get country by code
fetch('https://countries-api-service.vercel.app/api/countries/code/ES')
.then(response => response.json())
.then(data => console.log(data));
// Search countries in Europe
fetch('https://countries-api-service.vercel.app/api/countries/region/Europe')
.then(response => response.json())
.then(data => console.log(data));
// Flexible search
fetch('https://countries-api-service.vercel.app/api/countries/search?q=spain')
.then(response => response.json())
.then(data => console.log(data));
{
"success": true,
"data": {
"name": {
"common": "Spain",
"official": "Kingdom of Spain"
},
"cca2": "ES",
"cca3": "ESP",
"capital": ["Madrid"],
"region": "Europe",
"subregion": "Southern Europe",
"population": 47351567,
"area": 505992,
"languages": { "spa": "Spanish" },
"currencies": {
"EUR": { "name": "Euro", "symbol": "€" }
},
"flags": {
"png": "https://flagcdn.com/w320/es.png",
"svg": "https://flagcdn.com/es.svg"
},
"borders": ["AND", "FRA", "GIB", "PRT", "MAR"]
}
}