Country Data API: 250 Countries with Currencies, Languages, and More
Access structured data for 250 countries including currencies, languages, calling codes, timezones, and ISO codes through a single REST API. Build localized experiences, payment forms, and country selectors with reliable, always-updated reference data.
Edge Team
Every application that serves international users eventually hits the same wall: you need reliable, structured data about countries. Whether you are building a checkout form that needs to map a country to its currency, a registration flow that pre-fills phone prefixes, or a dashboard that groups users by region, hard-coding this data is a maintenance liability that compounds over time.
Edge's Country Data API gives you structured access to 250 countries and territories, covering currencies, official languages, calling codes, timezones, regions, capitals, flag emojis, and both ISO 3166-1 alpha-2 and alpha-3 codes. One endpoint, one API key, always current.
This guide walks through what data is available, why it matters for real products, and how to integrate it into your stack with practical code examples.
What Data Does the Country Data API Return?
Each country object in the API response contains a comprehensive set of fields that cover the most common needs in application development:
| Field | Example (Bahrain) | Description |
|---|---|---|
name |
Bahrain | Common country name |
official_name |
Kingdom of Bahrain | Full official name |
iso2 |
BH | ISO 3166-1 alpha-2 code |
iso3 |
BHR | ISO 3166-1 alpha-3 code |
numeric_code |
048 | ISO 3166-1 numeric code |
currencies |
[{"code": "BHD", "name": "Bahraini Dinar", "symbol": "BD"}] |
Array of official currencies |
languages |
[{"code": "ar", "name": "Arabic"}] |
Official languages with ISO 639-1 codes |
calling_codes |
["+973"] |
International dialing prefixes |
capital |
Manama | Capital city |
region |
Asia | Continent/region |
subregion |
Western Asia | Subregion classification |
timezones |
["Asia/Bahrain"] |
IANA timezone identifiers |
flag_emoji |
🇧🇭 | Unicode flag emoji |
latitude |
26.0 | Geographic latitude |
longitude |
50.55 | Geographic longitude |
This is not a minimal dataset. It covers the fields that developers actually query for in production systems: currency codes for payment processing, calling codes for phone inputs, timezones for scheduling, and ISO codes for interoperability with other APIs and databases.
Why a Reliable Country Data API Matters
Hard-coding country data into your application seems harmless at first. You drop a JSON file into your repo, ship it, and move on. Then reality sets in.
Country Data Changes More Than You Think
South Sudan became independent in 2011. Eswatini changed its name from Swaziland in 2018. Turkey officially became Turkiye in the UN system in 2022. Currency redenominations happen. Calling codes split. Timezone rules shift with legislation.
When your country data is a static file buried in your codebase, these changes require a code deployment. When it comes from an API, the data stays current without you touching a line of code.
Consistency Across Services
If your backend, mobile app, and partner integrations all maintain their own country lists, you will eventually have inconsistencies. One system might use "United States" while another uses "US" and a third uses "USA." A single API source of truth eliminates this entire class of bug.
Localization and Internationalization
Building for global users means adapting currency symbols, date formats, language defaults, and phone number formatting per country. The Country Data API gives you all the building blocks in a single call rather than stitching together multiple data sources.
Core Use Cases
Country Dropdown Selectors
The most common use case is powering a <select> element in forms. The API returns countries sorted alphabetically by default, with ISO codes ready for storage and display names ready for the UI.
curl -X GET "https://api.edge.bh/v1/countries" \
-H "X-Api-Key: your_api_key" \
-H "Accept: application/json"
Response (abbreviated):
{
"success": true,
"data": [
{
"name": "Afghanistan",
"iso2": "AF",
"iso3": "AFG",
"flag_emoji": "\ud83c\udde6\ud83c\uddeb",
"currencies": [{"code": "AFN", "name": "Afghan Afghani", "symbol": "\u060b"}],
"calling_codes": ["+93"],
"region": "Asia",
"subregion": "Southern Asia"
},
{
"name": "Bahrain",
"iso2": "BH",
"iso3": "BHR",
"flag_emoji": "\ud83c\udde7\ud83c\udded",
"currencies": [{"code": "BHD", "name": "Bahraini Dinar", "symbol": "BD"}],
"calling_codes": ["+973"],
"region": "Asia",
"subregion": "Western Asia"
}
]
}
In your frontend, mapping this to a dropdown is straightforward:
const response = await fetch("https://api.edge.bh/v1/countries", {
headers: {
"X-Api-Key": process.env.EDGE_API_KEY,
"Accept": "application/json"
}
});
const { data: countries } = await response.json();
// Render a select element
const options = countries.map(country => ({
value: country.iso2,
label: `${country.flag_emoji} ${country.name}`
}));
Currency Detection for Payment Forms
When a user selects their country, you can immediately set the correct currency for payment processing. This matters for platforms that support multi-currency checkout.
async function getCurrencyForCountry(iso2Code) {
const response = await fetch(
`https://api.edge.bh/v1/countries/${iso2Code}`,
{
headers: {
"X-Api-Key": process.env.EDGE_API_KEY,
"Accept": "application/json"
}
}
);
const { data: country } = await response.json();
// Most countries have one primary currency
const primaryCurrency = country.currencies[0];
return {
code: primaryCurrency.code, // "BHD"
symbol: primaryCurrency.symbol, // "BD"
name: primaryCurrency.name // "Bahraini Dinar"
};
}
// On country select change
const currency = await getCurrencyForCountry("BH");
// Set payment form currency to BHD
This pairs naturally with the Exchange Rates API if you need to convert between currencies at checkout.
Phone Number Prefix Auto-Fill
Registration and contact forms that collect phone numbers should auto-fill the international dialing prefix when a user selects their country. This reduces input errors and improves conversion rates.
function getCallingCode(country) {
return country.calling_codes[0]; // "+973" for Bahrain
}
// When user selects Bahrain from country dropdown
const prefix = getCallingCode(selectedCountry);
phoneInput.value = prefix + " ";
For full phone number validation beyond the prefix, see the Phone Validation API, which handles E.164 formatting and carrier detection.
Try Edge for free
500 API credits, no credit card required. Start integrating in minutes.
Get free API keyFiltering Countries by Region
If your application serves specific geographic markets, you can filter countries by region or subregion to show only relevant options.
curl -X GET "https://api.edge.bh/v1/countries?region=Europe" \
-H "X-Api-Key: your_api_key" \
-H "Accept: application/json"
This is useful for compliance scenarios where your service is only licensed in certain regions, or for analytics dashboards that break down data by geographic area.
Timezone Handling
Scheduling features, notification timing, and report generation all depend on knowing the user's timezone. The API returns IANA timezone identifiers (like Asia/Bahrain or Europe/London) that work directly with JavaScript's Intl.DateTimeFormat and server-side libraries.
const { data: country } = await fetchCountry("DE");
// Germany: ["Europe/Berlin"]
const userTimezone = country.timezones[0];
const formatter = new Intl.DateTimeFormat("en-US", {
timeZone: userTimezone,
dateStyle: "full",
timeStyle: "long"
});
console.log(formatter.format(new Date()));
// "Monday, March 10, 2026 at 2:30:00 PM Central European Standard Time"
Looking Up a Country by ISO Code
When you already have an ISO code (from a database, another API, or user input), you can fetch a single country directly:
curl -X GET "https://api.edge.bh/v1/countries/SA" \
-H "X-Api-Key: your_api_key" \
-H "Accept: application/json"
This returns the full country object for Saudi Arabia without requiring you to fetch and filter the entire list. Both alpha-2 (SA) and alpha-3 (SAU) codes are supported.
How Edge Compares to REST Countries
REST Countries has been a popular free API for years, and it has served the community well. However, production applications have different requirements than hobby projects.
| Consideration | REST Countries | Edge Country Data API |
|---|---|---|
| Uptime SLA | Community-maintained, no SLA | Production SLA with monitoring |
| Authentication | None (open) | API key with usage tracking |
| Rate limiting | Aggressive public rate limits | Generous limits based on your plan |
| Data freshness | Community PRs, variable update speed | Maintained dataset with regular updates |
| Support | GitHub issues | Direct support channel |
| Bundled with other APIs | Standalone | Part of Edge's API suite (IBAN, phone, email, FX, and more) |
| Credit-based pricing | Free (donations encouraged) | Pay-per-use with free tier |
If you are building a production fintech application, you likely need more than just country data. Edge gives you country data, IBAN validation, bank directory lookups, phone and email validation, and exchange rates under one API key and one billing relationship.
Integration Example: Complete Country Selector Component
Here is a practical React component that uses the Country Data API to build an accessible country selector with currency detection:
import { useState, useEffect } from "react";
function CountrySelector({ onSelect, apiKey }) {
const [countries, setCountries] = useState([]);
const [selected, setSelected] = useState(null);
useEffect(() => {
fetch("https://api.edge.bh/v1/countries", {
headers: { "X-Api-Key": apiKey }
})
.then(res => res.json())
.then(({ data }) => setCountries(data));
}, [apiKey]);
const handleChange = (iso2) => {
const country = countries.find(c => c.iso2 === iso2);
setSelected(country);
onSelect({
country: country.iso2,
currency: country.currencies[0]?.code,
callingCode: country.calling_codes[0],
timezone: country.timezones[0]
});
};
return (
<select
onChange={(e) => handleChange(e.target.value)}
value={selected?.iso2 || ""}
aria-label="Select your country"
>
<option value="">Select a country</option>
{countries.map(country => (
<option key={country.iso2} value={country.iso2}>
{country.flag_emoji} {country.name}
</option>
))}
</select>
);
}
When a user selects a country, your form instantly knows the currency, phone prefix, and timezone without any additional API calls.
Getting Started
Setting up the Country Data API takes under five minutes:
- Create an account at app.edge.bh and set up your organization.
- Generate an API key from the dashboard under API Keys.
- Make your first request using the examples above.
- Integrate into your application using the patterns shown in this guide.
Edge uses a credit-based pricing model, so you only pay for what you use. The free tier includes enough credits to build and test your integration before going to production.
Frequently Asked Questions
How many countries does the API cover?
The API returns data for 250 countries and territories, following the ISO 3166-1 standard. This includes sovereign states, dependent territories, and special areas of geographical interest. The dataset is comprehensive enough for any production application.
How often is the country data updated?
The dataset is reviewed and updated regularly. Changes to country names, currency adoptions, calling code reassignments, and other modifications are reflected in the API as they are officially recognized. You do not need to deploy code to receive updated data.
Can I filter countries by currency or language?
Yes. The API supports filtering by region and subregion directly. For currency or language filtering, you can fetch the full list and filter client-side, which is efficient since the full dataset is relatively small (under 100KB). Results are also cacheable, so repeated requests are fast.
What is the difference between iso2 and iso3?
iso2 is the two-letter country code from ISO 3166-1 alpha-2 (e.g., "BH" for Bahrain). iso3 is the three-letter code from ISO 3166-1 alpha-3 (e.g., "BHR"). Alpha-2 codes are more common in web applications, while alpha-3 codes are used in some financial and government systems. The API supports looking up countries by either format.
Does the API return data in languages other than English?
Currently, country names and other text fields are returned in English. If you need localized country names, you can use the ISO codes from our API as keys to map against a localization library like i18n-iso-countries in your application layer.
How does pricing work for the Country Data API?
Edge uses a credit-based model. Each API call costs a set number of credits. You can check current pricing on the Edge dashboard. A free tier is available for development and testing, and paid plans scale with your usage. Since country data is highly cacheable, most applications use very few credits even at scale.
Related articles
Start building with Edge
Get 500 free API credits instantly. No credit card required. Full access to IBAN validation, sanctions screening, exchange rates, and all 12 services.
Trusted by fintechs and banks across the GCC.