RestCountries now needs an API key. Here's a free alternative.

RestCountries v3.1 is deprecated and v5 requires an API key, with a 500-request/month free tier. countries.dev is a free, keyless alternative that returns the same country data.

Back

If your app called https://restcountries.com/v3.1/all, it's probably broken right now. v3.1 is deprecated — the old versions return an error payload instead of the data. The replacement is v5, and v5 wants an API key.

That's a bigger change than it sounds. RestCountries was the API you could drop into a side project without thinking about it: no signup, no token, no quota. That part is over.

What changed in RestCountries v5

The short list:

  • A key is required on every request (Authorization: Bearer <key>, with a ?api-key= fallback for quick tests).
  • You need an account to get that key.
  • The free tier is 500 requests a month. Not per day — per month. Above that you're on a paid plan (Personal starts at 25k/month).
  • The base URL moved to https://api.restcountries.com/countries/v5.

To be fair, v5 is a fine product, and it's now their long-term-stable version. If you're building something that warrants an account and you're happy managing a key, use it. But showing a flag next to a username or filling a country dropdown shouldn't cost a signup and a monthly budget.

countries.dev: the same data, without a key

countries.dev is what RestCountries used to be — free, keyless, no signup. The whole integration is one line:

curl https://countries.dev/alpha/US

Next to v5:

curl https://api.restcountries.com/countries/v5/alpha/US \
  -H "Authorization: Bearer rc_live_xxx"

No header, no account, no 500-call ceiling. You get the full record back — name, capital, region, currencies, languages, calling codes, borders — plus a flag emoji and map links:

{
  "name": "United States of America",
  "alpha2Code": "US",
  "capital": "Washington, D.C.",
  "region": "Americas",
  "flag": "🇺🇸",
  "currencies": [{ "code": "USD", "name": "United States dollar", "symbol": "$" }]
}

Only need a couple of fields? Add ?fields=name,capital,flag. Want to filter? There are endpoints for currency, language, region, and calling code. There's even an IP geolocation endpoint that returns the full country record for a visitor's IP — which is usually the real reason people reach for a country API in the first place.

The catch

countries.dev serves country-level data from a public, rate-limited endpoint. It isn't trying to be a paid platform with a contract behind it. If you need an SLA, buy one. For the other 95% of country-data work, you don't need a key — so we don't ask for one.

Ready to switch? Here's the endpoint-by-endpoint migration, or jump straight to the docs.

Written by

Dov Azencot

At

Tue Jun 23 2026