Countries API

Fetch Countries

Make a GET request to /api/countries endpoint to fetch *all* countries.

[JSON] [Successful] Request sample #1 - Fetch all countries

curl -X GET \
  "https://randapis.com/api/countries" \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json'

Response:
HTTP Status: 200 Success
Body:


{
    "_metadata": {
        "data_last_updated": "02/22/2024",
        "notices": [],
        "endpoint": {
            "available_options": {
                "filters": [
                    "?filters[alpha2_code]=US,AU"
                ]
            },
            "path": "/api/countries"
        }
    },
    "items": [
        {
            "alpha2_code": "AU",
            "alpha3_code": "AUS",
            "alternate_names": [
                "AU"
            ],
            "area": 7692024,
            "borders": [],
            "calling_codes": [
                "61"
            ],
            "capital": "Canberra",
            "cioc": "AUS",
            "currencies": [
                {
                    "code": "AUD",
                    "name": "Australian dollar",
                    "symbol": "$"
                }
            ],
            "demonym": "Australian",
            "gini": 30.5,
            "languages": [
                {
                    "iso639_1": "en",
                    "iso639_2": "eng",
                    "name": "English",
                    "nativeName": "English"
                }
            ],
            "lat_long": [
                -27,
                133
            ],
            "name": "Australia",
            "native_name": "Australia",
            "numeric_code": "036",
            "region": "Oceania",
            "regional_blocs": [],
            "subregion": "Australia and New Zealand",
            "timezones": [
                "UTC+05:00",
                "UTC+06:30",
                "UTC+07:00",
                "UTC+08:00",
                "UTC+09:30",
                "UTC+10:00",
                "UTC+10:30",
                "UTC+11:30"
            ],
            "top_level_domain": [
                ".au"
            ],
            "translations": {
                "de": "Australien",
                "es": "Australia",
                "fr": "Australie",
                "ja": "オーストラリア",
                "it": "Australia",
                "br": "Austrália",
                "pt": "Austrália",
                "nl": "Australië",
                "hr": "Australija",
                "fa": "استرالیا"
            }
        },
        {
            "alpha2_code": "US",
            "alpha3_code": "USA",
            "alternate_names": [
                "US",
                "USA",
                "United States of America"
            ],
            "area": 9629091,
            "borders": [
                "CAN",
                "MEX"
            ],
            "calling_codes": [
                "1"
            ],
            "capital": "Washington, D.C.",
            "cioc": "USA",
            "currencies": [
                {
                    "code": "USD",
                    "name": "United States dollar",
                    "symbol": "$"
                }
            ],
            "demonym": "American",
            "gini": 48,
            "languages": [
                {
                    "iso639_1": "en",
                    "iso639_2": "eng",
                    "name": "English",
                    "nativeName": "English"
                }
            ],
            "lat_long": [
                38,
                -97
            ],
            "name": "United States of America",
            "native_name": "United States",
            "numeric_code": "840",
            "region": "Americas",
            "regional_blocs": [
                {
                    "acronym": "NAFTA",
                    "name": "North American Free Trade Agreement",
                    "otherAcronyms": [],
                    "otherNames": [
                        "Tratado de Libre Comercio de América del Norte",
                        "Accord de Libre-échange Nord-Américain"
                    ]
                }
            ],
            "subregion": "Northern America",
            "timezones": [
                "UTC-12:00",
                "UTC-11:00",
                "UTC-10:00",
                "UTC-09:00",
                "UTC-08:00",
                "UTC-07:00",
                "UTC-06:00",
                "UTC-05:00",
                "UTC-04:00",
                "UTC+10:00",
                "UTC+12:00"
            ],
            "top_level_domain": [
                ".us"
            ],
            "translations": {
                "de": "Vereinigte Staaten von Amerika",
                "es": "Estados Unidos",
                "fr": "États-Unis",
                "ja": "アメリカ合衆国",
                "it": "Stati Uniti D'America",
                "br": "Estados Unidos",
                "pt": "Estados Unidos",
                "nl": "Verenigde Staten",
                "hr": "Sjedinjene Američke Države",
                "fa": "ایالات متحده آمریکا"
            }
        },
        ... // truncated for brevity
    ]
}

Fetch Only Specific Countries

[Successful] Request Sample #1 - Get a country by Alpha 2 Code

curl -X GET \
  "https://randapis.com/api/countries?filters[alpha2_code]=US,FR" \
  -H 'Authorization: Bearer {{YOUR_API_KEY}}' \
  -H 'Content-Type: application/json'

Response:
HTTP Status: 200 Success

Body:


{
    "_metadata": {
        "data_last_updated": "02/22/2024",
        "notices": [],
        "endpoint": {
            "available_options": {
                "filters": [
                    "?filters[alpha2_code]=US,AU"
                ]
            },
            "path": "/api/countries"
        }
    },
    "items": [
        {
            "alpha2_code": "FR",
            "alpha3_code": "FRA",
            "alternate_names": [
                "FR",
                "French Republic",
                "République française"
            ],
            "area": 640679,
            "borders": [
                "AND",
                "BEL",
                "DEU",
                "ITA",
                "LUX",
                "MCO",
                "ESP",
                "CHE"
            ],
            "calling_codes": [
                "33"
            ],
            "capital": "Paris",
            "cioc": "FRA",
            "currencies": [
                {
                    "code": "EUR",
                    "name": "Euro",
                    "symbol": "€"
                }
            ],
            "demonym": "French",
            "gini": 32.7,
            "languages": [
                {
                    "iso639_1": "fr",
                    "iso639_2": "fra",
                    "name": "French",
                    "nativeName": "français"
                }
            ],
            "lat_long": [
                46,
                2
            ],
            "name": "France",
            "native_name": "France",
            "numeric_code": "250",
            "region": "Europe",
            "regional_blocs": [
                {
                    "acronym": "EU",
                    "name": "European Union",
                    "otherAcronyms": [],
                    "otherNames": []
                }
            ],
            "subregion": "Western Europe",
            "timezones": [
                "UTC-10:00",
                "UTC-09:30",
                "UTC-09:00",
                "UTC-08:00",
                "UTC-04:00",
                "UTC-03:00",
                "UTC+01:00",
                "UTC+03:00",
                "UTC+04:00",
                "UTC+05:00",
                "UTC+11:00",
                "UTC+12:00"
            ],
            "top_level_domain": [
                ".fr"
            ],
            "translations": {
                "de": "Frankreich",
                "es": "Francia",
                "fr": "France",
                "ja": "フランス",
                "it": "Francia",
                "br": "França",
                "pt": "França",
                "nl": "Frankrijk",
                "hr": "Francuska",
                "fa": "فرانسه"
            }
        },
        {
            "alpha2_code": "US",
            "alpha3_code": "USA",
            "alternate_names": [
                "US",
                "USA",
                "United States of America"
            ],
            "area": 9629091,
            "borders": [
                "CAN",
                "MEX"
            ],
            "calling_codes": [
                "1"
            ],
            "capital": "Washington, D.C.",
            "cioc": "USA",
            "currencies": [
                {
                    "code": "USD",
                    "name": "United States dollar",
                    "symbol": "$"
                }
            ],
            "demonym": "American",
            "gini": 48,
            "languages": [
                {
                    "iso639_1": "en",
                    "iso639_2": "eng",
                    "name": "English",
                    "nativeName": "English"
                }
            ],
            "lat_long": [
                38,
                -97
            ],
            "name": "United States of America",
            "native_name": "United States",
            "numeric_code": "840",
            "region": "Americas",
            "regional_blocs": [
                {
                    "acronym": "NAFTA",
                    "name": "North American Free Trade Agreement",
                    "otherAcronyms": [],
                    "otherNames": [
                        "Tratado de Libre Comercio de América del Norte",
                        "Accord de Libre-échange Nord-Américain"
                    ]
                }
            ],
            "subregion": "Northern America",
            "timezones": [
                "UTC-12:00",
                "UTC-11:00",
                "UTC-10:00",
                "UTC-09:00",
                "UTC-08:00",
                "UTC-07:00",
                "UTC-06:00",
                "UTC-05:00",
                "UTC-04:00",
                "UTC+10:00",
                "UTC+12:00"
            ],
            "top_level_domain": [
                ".us"
            ],
            "translations": {
                "de": "Vereinigte Staaten von Amerika",
                "es": "Estados Unidos",
                "fr": "États-Unis",
                "ja": "アメリカ合衆国",
                "it": "Stati Uniti D'America",
                "br": "Estados Unidos",
                "pt": "Estados Unidos",
                "nl": "Verenigde Staten",
                "hr": "Sjedinjene Američke Države",
                "fa": "ایالات متحده آمریکا"
            }
        }
    ]
}