Quick Start

Get started with the countries.dev REST API — a free country data API with no API key and no signup. Fetch countries, ISO codes, flags, currencies, languages, cities, postal codes and IP geolocation in seconds.

countries.dev is a free REST API for country and geographic data. Every endpoint returns JSON over HTTPS with no API key, no signup and no rate-limit tiers — append a path and you get data back.

Base URL

All requests go to:

https://countries.dev

There's nothing to install and no key to send. The API also returns permissive CORS headers, so you can call it straight from the browser.

Make your first request

Fetch a single country by its ISO 3166 code:

curl https://countries.dev/alpha/US
const res = await fetch('https://countries.dev/alpha/US');
const country = await res.json();
console.log(country.name, country.capital); // United States of America Washington, D.C.
import requests

country = requests.get('https://countries.dev/alpha/US').json()
print(country['name'], country['capital'])

No API key

There's nothing to authenticate. Send the request and you get JSON back. See Authentication.

Example response

{
  "name": "United States of America",
  "alpha2Code": "US",
  "alpha3Code": "USA",
  "capital": "Washington, D.C.",
  "region": "Americas",
  "subregion": "North America",
  "population": 329484123,
  "area": 9372610,
  "currencies": [{ "code": "USD", "name": "United States dollar", "symbol": "$" }],
  "languages": [{ "iso639_1": "en", "name": "English" }],
  "callingCodes": ["1"],
  "topLevelDomain": [".us"],
  "borders": ["CAN", "MEX"],
  "flag": "https://countries.dev/flags/us.svg"
}

What you can fetch

You want…Endpoint
A country by ISO code (alpha-2 / alpha-3)/alpha/{code}
A country by name/name/{name}
Countries by region, currency, language, calling code…/region, /currency, /lang, /callingcode
Cities, places and postal codes/cities, /places, /postal
A visitor's country from their IP/ip
Every country at once/countries

Prefer to click around first? Try every endpoint live in the data explorer.

Shape your response

List endpoints accept query parameters to keep payloads small and ordered — fields, sort, order, limit and offset. For example, the ten most populous countries with just two fields:

curl "https://countries.dev/countries?sort=population&order=desc&limit=10&fields=name,population"

See Response format for the full list.

Status codes

countries.dev uses standard HTTP status codes — see Errors & status codes for details.

Status codeMeaning
200Success
400Bad request
404Not found
429Too many requests

Next steps

On this page