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.devThere'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/USconst 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 code | Meaning |
|---|---|
200 | Success |
400 | Bad request |
404 | Not found |
429 | Too many requests |
Next steps
- Authentication — why there's no API key, and using the API from the browser.
- Response format — select fields, sort and paginate.
- Errors & status codes — handle missing data gracefully.
- Rate limits & caching — limits and how responses are cached.
- Browse the full API reference for every endpoint and parameter.