How to validate a VAT number in Node.js?

The first thing we need to do is add a reference to the library (in our package.json):

"dependencies": {
"cloudmersive-validate-api-client": "^1.1.2"

Now, we need to add a reference to the library:

var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');

Finally, we just need to call the vatVatLookup method:

var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');
var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveValidateApiClient.VatApi();var input = new CloudmersiveValidateApiClient.VatLookupRequest(); // VatLookupRequest | Input VAT codevar callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.vatVatLookup(input, callback);

We will pass in the input VAT code, and we will get back key information — including whether this code is valid, the country code of the company, the VAT number, the name of the business, and the address of the business in question. It’s that easy!

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store