Countries Explorer

API Information

Countries Explorer is powered by the REST Countries API, a free and reliable source for country information. Learn more about the API and how to use it in your own projects.

About REST Countries API

REST Countries

A free API providing detailed information about countries worldwide. No authentication required, making it perfect for educational projects and applications.

Visit REST Countries API

API Endpoints Used

GET
https://restcountries.com/v3.1/all?fields=name,cca3,region,subregion,capital,population,area,languages,currencies,flags

Fetches all countries with specific fields for the main country list.

GET
https://restcountries.com/v3.1/alpha/{code}?fields=name,cca3,capital,region,subregion,population,area,languages,currencies,flags,maps

Fetches detailed information for a specific country by its 3-letter code.

Data Fields

Basic Information

  • name: Common and official names
  • cca3: 3-letter country code
  • capital: Capital city/cities
  • region: Geographic region
  • subregion: Geographic subregion

Detailed Data

  • population: Current population
  • area: Total area in km²
  • languages: Official languages
  • currencies: Used currencies
  • flags: Flag images (SVG/PNG)

Example Response

{
  "name": {
    "common": "Nepal",
    "official": "Federal Democratic Republic of Nepal"
  },
  "cca3": "NPL",
  "capital": ["Kathmandu"],
  "region": "Asia",
  "subregion": "Southern Asia",
  "population": 29136808,
  "area": 147181,
  "languages": {
    "nep": "Nepali"
  },
  "currencies": {
    "NPR": {
      "name": "Nepalese rupee",
      "symbol": "₨"
    }
  },
  "flags": {
    "png": "https://flagcdn.com/w320/np.png",
    "svg": "https://flagcdn.com/np.svg",
    "alt": "The flag of Nepal is..."
  }
}

Rate Limits & Usage

Fair Usage Policy

  • • No authentication required
  • • Free for personal and commercial use
  • • Please don't abuse the service
  • • Consider caching responses for better performance
  • • No official rate limits, but be respectful

Using the API in Your Projects

JavaScript/Fetch Example

// Fetch all countries
const response = await fetch('https://restcountries.com/v3.1/all');
const countries = await response.json();

// Fetch specific country
const country = await fetch('https://restcountries.com/v3.1/alpha/NPL');
const nepal = await country.json();

React Hook Example

const useCountries = () => {
  const [countries, setCountries] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    fetch('https://restcountries.com/v3.1/all')
      .then(res => res.json())
      .then(data => {
        setCountries(data);
        setLoading(false);
      });
  }, []);

  return { countries, loading };
};

Alternative APIs

World Bank API

Economic and development data for countries.

Learn more →

Country.io

Simple API for country codes and basic information.

Learn more →

Support the API

REST Countries API is a free service maintained by volunteers. Consider supporting them:

  • • Star their GitHub repository
  • • Share the API with other developers
  • • Report issues and contribute improvements
  • • Consider donating to support hosting costs