Function Signatures
Function Signatures
getCountryInfo(countryName, fields)
countryName (string): The name of the country in English or Spanish.
fields (string or array of strings, optional): The specific fields to retrieve. Returns an object or an array with the requested country information, or null if no information is found.
getContinent(continentName, fields)
continentName (string): The name of the continent in English or Spanish.
fields (string or array of strings, optional): The specific fields to retrieve. Returns an array of objects containing information about the countries in the specified continent.
getAllCountries(fields)
fields (array of strings, optional): The specific fields to retrieve. Returns an array of objects containing information about all available countries.
getCountryByCode(countryCode, fields)
countryCode (string): The code of the country (2-letter or 3-letter).
fields (string or array of strings, optional): The specific fields to retrieve. Returns an object or an array with the requested country information, or null if no information is found.
getCountryByTLD(topLevelDomain, fields)
topLevelDomain (string): The top-level domain (TLD) of the country (e.g., ".us").
fields (string or array of strings, optional): The specific fields to retrieve. Returns an object or an array with the requested country information, or null if no information is found.
searchCountries(keyword, fields)
keyword (string): The keyword to search for in country names, capitals, or codes.
fields (array of strings, optional): The specific fields to retrieve. Returns an array of objects containing information about the countries matching the keyword.
Fields
name_en: Country name in English.
name_es: Country name in Spanish.
continent_en: Continent name in English.
continent_es: Continent name in Spanish.
capital_en: Capital city name in English.
capital_es: Capital city name in Spanish.
dial_code: International dialing code for the country.
code_2: ISO 3166-1 alpha-2 code for the country (2-letter country code).
code_3: ISO 3166-1 alpha-3 code for the country (3-letter country code).
tld: Top-level domain (TLD) for the country (e.g., ".af" for Afghanistan).
km2: Total land area of the country in square kilometers.
Last updated
Was this helpful?