Identify the Currency of a Country in Java

2 min readFeb 16, 2021


Automating the identification of a country’s currency on your website, application, or other system will set you up for smoother transactions with international customers. The following API can assist in this automation by auto-populating a country’s currency, ISO code, and currency symbol when you input the country name.

To begin the process, we first need to install the Maven SD by adding a reference to the repository in pom.xml:


Then, we will add a reference to the dependency:


Once the installation is complete, we are ready to add the imports to our controller and call the function:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.AddressApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
AddressApi apiInstance = new AddressApi();
ValidateCountryRequest input = new ValidateCountryRequest(); // ValidateCountryRequest | Input request
try {
ValidateCountryResponse result = apiInstance.addressGetCountryCurrency(input);
} catch (ApiException e) {
System.err.println("Exception when calling AddressApi#addressGetCountryCurrency");

This will deliver the aforementioned currency, ISO code, and currency symbol for the specified country. Visit the Cloudmersive website to retrieve your free API key and gain access to 800 calls/month.




There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.