Get a list of all countries as JSON

One request returns every country as JSON — names, ISO codes, capitals, currencies, languages and flags. No API key, no CSV wrangling.

Back

You need a list of every country — for a dropdown, a seed file, a quiz, a map. You could dig up a stale CSV somewhere and parse it, or make one request:

curl https://countries.dev/countries

That's all ~250 countries with the full set of fields each. No key, no pagination to stitch back together.

Just the fields you want

A full dump is large. If you only need a few columns, ask for them:

curl "https://countries.dev/countries?fields=name,alpha2Code,flag"
[
  { "name": "Afghanistan", "alpha2Code": "AF", "flag": "🇦🇫" },
  { "name": "Albania", "alpha2Code": "AL", "flag": "🇦🇱" }
]

Add sort=name for alphabetical order, or sort=population&order=desc for biggest-first.

Cache it

The list barely changes, so don't hit the API on every page load. Fetch it once at build time and ship it as a static file:

const countries = await fetch(
  "https://countries.dev/countries?fields=name,alpha2Code,flag&sort=name"
).then((r) => r.json());
// write countries.json, import it, done

Full field list and filters are in the docs.

Written by

Dov Azencot

At

Sat Jun 20 2026