region enum Only return entries in this lowercase geographic region; any keeps every region.
All 249 ISO 3166-1 countries and territories with codes, regions, capitals, currencies, languages, calling codes, flags and label-safe land points.
Authoritative reference data or standards computation
Returns the full 249-entry alphabetical table by default. Region and search filters compose; count limits the filtered result.
| Parameter | Type | Default & allowed | Description |
|---|---|---|---|
region | enum | default: any allowed: any | africa | americas | asia | europe | oceania | antarctic example: europe | Only return entries in this lowercase geographic region; any keeps every region. |
search | string | allowed: 1 – 100 example: united | Case- and diacritic-insensitive substring match against the common English name (aland finds Åland Islands). |
region enum Only return entries in this lowercase geographic region; any keeps every region.
search string Case- and diacritic-insensitive substring match against the common English name (aland finds Åland Islands).
| Parameter | Type | Default & allowed | Description |
|---|---|---|---|
count | int | default: all matches allowed: 1 – 100 example: 3 | Limit the number of returned records (1–100). Defaults to all matches. |
fields | list | example: name,code | Return only these fields (comma-separated). Mutually exclusive with 'exclude'. |
exclude | list | example: longitude | Return all fields except these (comma-separated). |
format | enum | default: json allowed: json | ndjson | csv example: csv | Response format: json envelope, ndjson (one record per line) or csv. |
pretty | boolean | default: false example: true | Pretty-print the JSON response. |
unwrap | boolean | default: false example: true | Drop the envelope: return the raw array/object without data/meta wrapper. |
count int Limit the number of returned records (1–100). Defaults to all matches.
fields list Return only these fields (comma-separated). Mutually exclusive with 'exclude'.
exclude list Return all fields except these (comma-separated).
format enum Response format: json envelope, ndjson (one record per line) or csv.
pretty boolean Pretty-print the JSON response.
unwrap boolean Drop the envelope: return the raw array/object without data/meta wrapper.
| Field | Type | Description | Example |
|---|---|---|---|
name | string | Common English country or territory name. | Denmark |
code | string | ISO 3166-1 alpha-2 code. | DK |
alpha3 | string | ISO 3166-1 alpha-3 code. | DNK |
numeric | string | Three-digit ISO 3166-1 numeric code, kept as text to preserve leading zeroes. | 208 |
capital nullable | string | Capital; multiple official seats are separated by semicolons. Null for territories without a capital. | Copenhagen |
region | string | Lowercase geographic region: africa, americas, asia, europe, oceania or antarctic. | europe |
subregion nullable | string | UN M49 geographic subregion where assigned; otherwise null. | Northern Europe |
currencyCode nullable | string | Primary active ISO 4217 currency code. Null where no single active ISO currency is assigned. | DKK |
languages | string[] | English labels normalized to the LOC ISO 639 Set 1 registry; Papiamento is included explicitly for Aruba and Curaçao despite having no Set 1 code. | ["Danish"] |
callingCode nullable | string | Primary international calling prefix. Shared numbering plans may include the destination prefix; null where none is assigned. | +45 |
flagEmoji | string | Unicode regional-indicator flag sequence for the alpha-2 code. | 🇩🇰 |
latitude | float | Latitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's latitude. | 56 |
longitude | float | Longitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's longitude. | 10 |
name string Common English country or territory name.
example: Denmark
code string ISO 3166-1 alpha-2 code.
example: DK
alpha3 string ISO 3166-1 alpha-3 code.
example: DNK
numeric string Three-digit ISO 3166-1 numeric code, kept as text to preserve leading zeroes.
example: 208
capital string nullable Capital; multiple official seats are separated by semicolons. Null for territories without a capital.
example: Copenhagen
region string Lowercase geographic region: africa, americas, asia, europe, oceania or antarctic.
example: europe
subregion string nullable UN M49 geographic subregion where assigned; otherwise null.
example: Northern Europe
currencyCode string nullable Primary active ISO 4217 currency code. Null where no single active ISO currency is assigned.
example: DKK
languages string[] English labels normalized to the LOC ISO 639 Set 1 registry; Papiamento is included explicitly for Aruba and Curaçao despite having no Set 1 code.
example: ["Danish"]
callingCode string nullable Primary international calling prefix. Shared numbering plans may include the destination prefix; null where none is assigned.
example: +45
flagEmoji string Unicode regional-indicator flag sequence for the alpha-2 code.
example: 🇩🇰
latitude float Latitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's latitude.
example: 56
longitude float Longitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's longitude.
example: 10
/api/countries {
"data": [
{
"name": "Afghanistan",
"code": "AF",
"alpha3": "AFG",
"numeric": "004",
"capital": "Kabul",
"region": "asia",
"subregion": "Southern Asia",
"currencyCode": "AFN",
"languages": [
"Pashto",
"Persian",
"Turkmen",
"Uzbek"
],
"callingCode": "+93",
"flagEmoji": "🇦🇫",
"latitude": 34.3332,
"longitude": 66.6552
},
{
"name": "Åland Islands",
"code": "AX",
"alpha3": "ALA",
"numeric": "248",
"capital": "Mariehamn",
"region": "europe",
"subregion": "Northern Europe",
"currencyCode": "EUR",
"languages": [
"Swedish"
],
"callingCode": "+358",
"flagEmoji": "🇦🇽",
"latitude": 60.1611,
"longitude": 19.8774
},
{
…
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} /api/countries?region=europe {
"data": [
{
"name": "Åland Islands",
"code": "AX",
"alpha3": "ALA",
"numeric": "248",
"capital": "Mariehamn",
"region": "europe",
"subregion": "Northern Europe",
"currencyCode": "EUR",
"languages": [
"Swedish"
],
"callingCode": "+358",
"flagEmoji": "🇦🇽",
"latitude": 60.1611,
"longitude": 19.8774
},
{
"name": "Albania",
"code": "AL",
"alpha3": "ALB",
"numeric": "008",
"capital": "Tirana",
"region": "europe",
"subregion": "Southern Europe",
"currencyCode": "ALL",
"languages": [
"Albanian"
],
"callingCode": "+355",
"flagEmoji": "🇦🇱",
"latitude": 40.6449,
"longitude": 20.1102
},
{
"name": "Andorra",
"code": "AD",
"alpha3": "AND",
…
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} /api/countries?search=united {
"data": [
{
"name": "United Arab Emirates",
"code": "AE",
"alpha3": "ARE",
"numeric": "784",
"capital": "Abu Dhabi",
"region": "asia",
"subregion": "Western Asia",
"currencyCode": "AED",
"languages": [
"Arabic"
],
"callingCode": "+971",
"flagEmoji": "🇦🇪",
"latitude": 23.4791,
"longitude": 54.5322
},
{
"name": "United Kingdom",
"code": "GB",
"alpha3": "GBR",
"numeric": "826",
"capital": "London",
"region": "europe",
"subregion": "Northern Europe",
"currencyCode": "GBP",
"languages": [
"English"
],
"callingCode": "+44",
"flagEmoji": "🇬🇧",
"latitude": 52.4815,
"longitude": -1.2582
},
{
"name": "United States",
"code": "US",
"alpha3": "USA",
…
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} /api/countries?region=asia&count=10&format=csv&fields=name,code,alpha3 name,code,alpha3
Afghanistan,AF,AFG
Armenia,AM,ARM
Azerbaijan,AZ,AZE
Bahrain,BH,BHR
Bangladesh,BD,BGD
Bhutan,BT,BTN
Brunei,BN,BRN
Cambodia,KH,KHM
China,CN,CHN
Cyprus,CY,CYP
Accepts a 2- or 3-letter ISO 3166-1 code, case-insensitively. Unknown codes are explicit 404s with a nearby-code hint when available.
| Parameter | Type | Default & allowed | Description |
|---|---|---|---|
code
required
| string | allowed: 2 – 3 example: DK | ISO 3166-1 alpha-2 or alpha-3 code, case-insensitive (DK or DNK). |
code string required ISO 3166-1 alpha-2 or alpha-3 code, case-insensitive (DK or DNK).
| Parameter | Type | Default & allowed | Description |
|---|---|---|---|
fields | list | example: name,code | Return only these fields (comma-separated). Mutually exclusive with 'exclude'. |
exclude | list | example: longitude | Return all fields except these (comma-separated). |
pretty | boolean | default: false example: true | Pretty-print the JSON response. |
unwrap | boolean | default: false example: true | Drop the envelope: return the raw array/object without data/meta wrapper. |
fields list Return only these fields (comma-separated). Mutually exclusive with 'exclude'.
exclude list Return all fields except these (comma-separated).
pretty boolean Pretty-print the JSON response.
unwrap boolean Drop the envelope: return the raw array/object without data/meta wrapper.
| Field | Type | Description | Example |
|---|---|---|---|
name | string | Common English country or territory name. | Denmark |
code | string | ISO 3166-1 alpha-2 code. | DK |
alpha3 | string | ISO 3166-1 alpha-3 code. | DNK |
numeric | string | Three-digit ISO 3166-1 numeric code, kept as text to preserve leading zeroes. | 208 |
capital nullable | string | Capital; multiple official seats are separated by semicolons. Null for territories without a capital. | Copenhagen |
region | string | Lowercase geographic region: africa, americas, asia, europe, oceania or antarctic. | europe |
subregion nullable | string | UN M49 geographic subregion where assigned; otherwise null. | Northern Europe |
currencyCode nullable | string | Primary active ISO 4217 currency code. Null where no single active ISO currency is assigned. | DKK |
languages | string[] | English labels normalized to the LOC ISO 639 Set 1 registry; Papiamento is included explicitly for Aruba and Curaçao despite having no Set 1 code. | ["Danish"] |
callingCode nullable | string | Primary international calling prefix. Shared numbering plans may include the destination prefix; null where none is assigned. | +45 |
flagEmoji | string | Unicode regional-indicator flag sequence for the alpha-2 code. | 🇩🇰 |
latitude | float | Latitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's latitude. | 56 |
longitude | float | Longitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's longitude. | 10 |
name string Common English country or territory name.
example: Denmark
code string ISO 3166-1 alpha-2 code.
example: DK
alpha3 string ISO 3166-1 alpha-3 code.
example: DNK
numeric string Three-digit ISO 3166-1 numeric code, kept as text to preserve leading zeroes.
example: 208
capital string nullable Capital; multiple official seats are separated by semicolons. Null for territories without a capital.
example: Copenhagen
region string Lowercase geographic region: africa, americas, asia, europe, oceania or antarctic.
example: europe
subregion string nullable UN M49 geographic subregion where assigned; otherwise null.
example: Northern Europe
currencyCode string nullable Primary active ISO 4217 currency code. Null where no single active ISO currency is assigned.
example: DKK
languages string[] English labels normalized to the LOC ISO 639 Set 1 registry; Papiamento is included explicitly for Aruba and Curaçao despite having no Set 1 code.
example: ["Danish"]
callingCode string nullable Primary international calling prefix. Shared numbering plans may include the destination prefix; null where none is assigned.
example: +45
flagEmoji string Unicode regional-indicator flag sequence for the alpha-2 code.
example: 🇩🇰
latitude float Latitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's latitude.
example: 56
longitude float Longitude of a label-safe point inside the largest/main land unit (WGS84), not the capital's longitude.
example: 10
/api/countries/lookup?code=DK {
"data": {
"name": "Denmark",
"code": "DK",
"alpha3": "DNK",
"numeric": "208",
"capital": "Copenhagen",
"region": "europe",
"subregion": "Northern Europe",
"currencyCode": "DKK",
"languages": [
"Danish"
],
"callingCode": "+45",
"flagEmoji": "🇩🇰",
"latitude": 55.942,
"longitude": 8.9969
},
"meta": {
"endpoint": "countries",
"route": "/lookup",
"params": {
"code": "DK"
},
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} /api/countries/lookup?code=dnk {
"data": {
"name": "Denmark",
"code": "DK",
"alpha3": "DNK",
"numeric": "208",
"capital": "Copenhagen",
"region": "europe",
"subregion": "Northern Europe",
"currencyCode": "DKK",
"languages": [
"Danish"
],
"callingCode": "+45",
"flagEmoji": "🇩🇰",
"latitude": 55.942,
"longitude": 8.9969
},
"meta": {
"endpoint": "countries",
"route": "/lookup",
"params": {
"code": "DNK"
},
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} /api/countries/lookup?code=JPN&fields=name,callingCode,currencyCode {
"data": {
"name": "Japan",
"callingCode": "+81",
"currencyCode": "JPY"
},
"meta": {
"endpoint": "countries",
"route": "/lookup",
"params": {
"code": "JPN"
},
"generatedAt": "2026-07-30T15:14:08.000Z"
}
} The complete set of 249 officially assigned ISO 3166-1 entries — countries and dependent territories — with alpha-2, alpha-3 and zero-padded numeric codes. The user-assigned XK code is deliberately excluded because it is not an officially assigned ISO 3166-1 entry.
The code fields are checked against ISO 3166-1 and UN Statistics M49. region and subregion follow M49's statistical geography where it assigns one; Antarctica and Taiwan use their conventional geographic placement where the M49 table does not provide a grouping. This means statistically assigned territories can appear under a region that differs from their physical continent — the API returns the reference classification rather than silently inventing one.
Codes and names are reproduced exactly as published by the source cited on this page; randomapi.dev takes no position on the sovereignty or territorial status of any country, territory or subdivision, and the presence, absence or nesting of any entry implies none.
The two reference endpoints built on this same key space state it identically: /api/country-borders for land adjacency and /api/country-subdivisions for ISO 3166-2.
Supplemental fields are deliberately explicit about their limits:
The list route is alphabetical, region genuinely restricts every result, and search is case- and diacritic-insensitive. The lookup route accepts either alpha-2 or alpha-3, case-insensitively. Unknown codes return a 404 with a nearby-code hint when possible — never a substitute country.
Yes — it contains all 249 officially assigned alpha-2, alpha-3 and numeric entries. The user-assigned XK code is excluded because it is not an official ISO 3166-1 assignment.
Yes — /api/countries/lookup?code=DK and ?code=DNK return the same Denmark record, case-insensitively. A well-formed unknown code returns 404, never a nearby record.
Use region=africa|americas|asia|europe|oceania|antarctic and search= for a case- and diacritic-insensitive common-name match. Both filters compose, and count limits the already-filtered alphabetical list.
No — each is a deterministic label-safe point inside the entry's largest or main land unit, designed for useful lightweight map pins. The capital is separate, and entries without one return null.
6,300+ world cities from a pinned GeoNames snapshot: coordinates, IANA timezone, population and capital flag — filter by country, size, name or distance.
Live IANA offsets, DST transitions, local-time ambiguity resolution and exact instant conversion — no guessed wall-clock mappings.
Every active ISO 4217 currency — code, name, symbol, minor-unit decimals and the countries using it. Search the list or look up one code, with honest 404s.
Real public holidays for 61 countries, computed from official national rules — list a year, check a date, or get the next upcoming holiday.
Land neighbours for all 250 countries and territories, published border lengths in km, the 45 landlocked entries and shortest land-border paths.
ISO 3166-2 states, provinces and regions: 5,046 subdivision codes for 200 countries, with English names, parent codes and an auditable per-country index.