Aral Balkan

Mastodon icon RSS feed icon

Using the European Commission EU VAT Number validation API with Node.js

You may know of the VIES site where you can manually validate EU VAT numbers but did you know that the European Commission also has an API for programmatically doing this?1

So that’s the good news.

The bad news is that it’s SOAP.

I’ll wait until you’re done retching… ok, feeling better? Let’s move on.

Example

Here’s how you consume it in Node.js:

  1. Install the soap package:

npm install soap
  1. Create the web service by consuming the WSDL file and calling the right method:2

import soap from 'soap'
const wsdl = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'

const client = await soap.createClientAsync(wsdl)
const result = await client.checkVatAsync({
  countryCode: 'EE',
  vatNumber: '100244258'
})

console.log(result)

And that’s all there is to it.

Enjoy! 3

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.


  1. I didn’t until I stumbled onto it today while doing research into VAT OSS for Basil, which is part of our Small Web initiative at Small Technology Foundation. ↩︎

  2. VAT Number in the example retrieved following a web search from SEB’s contact page. ↩︎

  3. As much as that word can be used for anything tax-related. ↩︎