Free country JSON API

A free, static JSON API covering all 250 countries and territories. No API key, no rate limits, no sign up. Just fetch the files. Ideal for quiz apps, dropdowns, maps and any project that needs clean country data.

Endpoints

All endpoints are plain JSON files served over HTTPS. Base URL:

https://flagdex.net

All countries (full)

GET /api/countries.json

Returns dataset metadata plus an array of every country with all fields.

All countries (lite)

GET /api/countries-lite.json

A compact array with just name, ISO codes, capital, region and flag. Small and fast, great for autocomplete and quiz builders.

A single country

GET /api/country/{iso2}.json

Look up one country by its lowercase ISO 3166-1 alpha-2 code. For example, /api/country/fr.json for France or /api/country/jp.json for Japan.

Metadata and endpoint list

GET /api/meta.json

Example response

GET /api/country/fr.json

{
  "iso2": "FR",
  "iso3": "FRA",
  "name": "France",
  "officialName": "French Republic",
  "capital": ["Paris"],
  "region": "Europe",
  "currencies": [{ "code": "EUR", "name": "Euro", "symbol": "\u20ac" }],
  "callingCodes": ["+33"],
  "flagEmoji": "\ud83c\uddeb\ud83c\uddf7",
  "population": 68720337
}

Quick start

Fetch a single country in the browser or Node:

const res = await fetch("https://flagdex.net/api/country/br.json");
const brazil = await res.json();
console.log(brazil.capital[0]); // "Brasília"

Flags

Each country’s flag is a public-domain SVG at a predictable path, so you can build image URLs directly:

https://flagdex.net/flags/{iso2}.svg
e.g. https://flagdex.net/flags/fr.svg

Licence

The data is drawn from open sources (ODbL and CC BY 4.0). You are free to use it in your own projects. A credit link back to Flagdex is appreciated. Full sources and vintage are on the data page.

This API is static and versionless. It is regenerated when the dataset is refreshed, and the current vintage is 2026-07-02.

Building a country quiz or dropdown with this API? Let us know on the contact page and we may feature it.