Skip to content

Free country API: no key, no rate limit

A free JSON API for all 250 countries and territories: flag, capital, currency, calling code, ISO 3166-1 codes, languages, land borders, area and population, plus a public-domain SVG flag for every one. No API key, no rate limit, no sign up, no account. The endpoints are static files on a CDN, CORS is open to any origin, and the data is licensed for commercial use.

GET https://flagdex.net/api/v1/country/fr.json works right now, from anywhere, with no headers.

How it compares

The obvious alternatives, checked on 5 August 2026. Each row states what that service itself documents; follow the links and verify before you commit to one.

Four free country-data APIs compared on key requirement, rate limit, commercial use and licence, checked on 5 August 2026.
ServiceAPI keyRate limitCommercial use, free tierData licence
FlagdexNoneNoneYesODbL 1.0 and CC BY 4.0
restcountries.comRequired, bearer tokenTiered, by planDepends on planNot stated on the homepage
countries.devNoneNot documentedYesCC BY 4.0, GeoNames
api-ninjas.comRequired, headerMonthly quota by planNo, paid plan requiredNot stated

Flagdex is not trying to be the richest country API. It is a static reference site that publishes the dataset it runs on. If you need cities, postal codes or IP geolocation, one of the others is the better fit.

Endpoints

All endpoints are plain JSON files served over HTTPS from https://flagdex.net. The versioned paths are the ones to build on.

All countries (full)

GET /api/v1/countries.json

Dataset metadata plus an array of every country with all fields.

All countries (lite)

GET /api/v1/countries-lite.json

A compact array with name, ISO codes, capital, region and flag. Small and fast, which is what an autocomplete or a dropdown needs.

A single country

GET /api/v1/country/{iso2}.json

One country by its lowercase ISO 3166-1 alpha-2 code, for example /api/v1/country/fr.json or /api/v1/country/jp.json.

Metadata

GET /api/v1/meta.json

Dataset vintage, the endpoint list, the licence and the stability policy.

Flags

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

A public-domain SVG per country, with CORS open, so you can use it inside your own application and not only in an img tag.

OpenAPI

A machine-readable description lives at /openapi.json, so the API can be loaded into tooling or listed in a directory without anyone hand-writing a spec.

Versioning and stability

/api/v1/ is the stable namespace. Fields present in v1 are never removed or retyped within v1; new fields may be added. A breaking change would ship as /api/v2/ and the v1 paths would keep working. The unversioned paths (/api/countries.json and the rest) still work and will keep working, but pin to v1 for anything you care about.

The dataset is rebuilt periodically. The current vintage is 2026-07-02, and meta.json always states it. Responses carry a long Cache-Control, so cache them rather than refetching.

Example response

GET /api/v1/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

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

curl
curl -s https://flagdex.net/api/v1/country/br.json | jq .capital

Python
import requests

data = requests.get("https://flagdex.net/api/v1/countries-lite.json").json()
by_iso = {c["iso2"]: c for c in data}
print(by_iso["BR"]["capital"])

React country dropdown with flags
import { useEffect, useState } from "react";

export function CountrySelect({ value, onChange }) {
  const [countries, setCountries] = useState([]);
  useEffect(() => {
    fetch("https://flagdex.net/api/v1/countries-lite.json")
      .then((r) => r.json())
      .then((list) => setCountries(list.sort((a, b) => a.name.localeCompare(b.name))));
  }, []);

  return (
    <select value={value} onChange={(e) => onChange(e.target.value)}>
      {countries.map((c) => (
        <option key={c.iso2} value={c.iso2}>
          {c.flagEmoji} {c.name}
        </option>
      ))}
    </select>
  );
}

Common use cases

Licence and attribution

Base country data comes from the mledoze/countries dataset under the Open Database License 1.0. Population figures come from the World Bank under CC BY 4.0. The flag SVGs are public domain. Both licences permit commercial use and both require attribution, so here is a snippet you can paste as it stands:

Attribution snippet (HTML)
<a href="https://flagdex.net">Country data from Flagdex</a> (ODbL 1.0, CC BY 4.0)

Attribution snippet (plain text)
Country data from Flagdex (https://flagdex.net), ODbL 1.0 and CC BY 4.0.

Attribution is a condition of the underlying licences, not a favour to us. Full sources and vintage are on the data page.

Frequently asked questions

Do I need an API key?
No. There is no key, no token, no account and no sign up. The endpoints are static JSON files served over HTTPS, so you fetch them like any other file.
Is there a rate limit?
No. The files are served from a CDN, so there is nothing to throttle. If you are making many requests, cache the response rather than refetching: the data changes only when the dataset is rebuilt.
Can I use it from the browser?
Yes. Every endpoint and every flag SVG sends Access-Control-Allow-Origin: *, so cross-origin requests work without a proxy.
Can I use it commercially?
Yes. The base data is under the Open Database License 1.0 and the population figures under CC BY 4.0, both of which allow commercial use with attribution. The flag SVGs are public domain.
Will the response shape change?
Not within v1. Fields present in /api/v1/ are never removed or retyped; new fields may be added. A breaking change would ship as /api/v2/ and the v1 paths would keep working.

Who builds this

Flagdex is built and maintained by FusionStudios. We build fast, privacy-first web tools, with no ads and no tracking. If you need something similar, get in touch.

The API serves the same dataset the site itself is built on, so anything you read on a country page is in the JSON. Full sources and vintage on the data page. Last updated . Report a correction.