European VAT Number Validation API
Unfortunately, especially for e-commerce systems, there isn't a simple way to check the validity of a European VAT number. The European Commission provides a web site where you can validate VAT numbers by entering them in an HTML form. This is not practical, of course, for web applications.
Enter, the European VAT Number Validation API that I just hacked together on Google App Engine.
You can hit a URL like http://isvat.appspot.com/GB/802311782/ and get a true or a false back as a simple JSON boolean.
Check out the European VAT Number Validation API.
I hope you find it useful.
The European VAT Number Validation API article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Subscribe to my blog






Peter
oh that’s very useful, thanks Aral!
July 4th, 2008 at 11:47 amErki Esken
You shuld make it return application/json replies instead of text/html. See:
$ curl -i http://isvat.appspot.com/GB/802311782/
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Date: Fri, 04 Jul 2008 12:19:03 GMT
Server: Google Frontend
Content-Length: 4
true
July 4th, 2008 at 1:21 pmAral
Hi Erki,
It’s on purpose. I want people to be able to test out the API in the browser — even non-techies. I don’t think my accountant (whom I just sent the link to) would understand what to do with a JSON file download when she hits the site but she’ll still be able to use it in the browser at the moment manually.
When I get some time, I’ll add a separate JSON endpoint — this was something I threw together before breakfast this morning :).
July 4th, 2008 at 5:27 pmAral
Hey Erki,
OK, I just added JSONP support (pass ?callback=nameOfCallback) and I’m now returning application/javascript so that it currently fits my use-case too.
July 4th, 2008 at 7:45 pmFarid Abdulhadi
Nice API Aral.
July 10th, 2008 at 10:31 amI was looking for something like this a couple of years back.
Nicolas Jacobeus
Hello Aral,
You probably know this as it’s mentioned in the FAQ, but there is in fact an official SOAP web service provided by VIES (WSDL here: http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl). We are using it on one of our web applications to allow online registration of companies. I don’t know if your own service is relying on it, or simply parsing the output of the “human-oriented” website.
I personally agree that your solution, being REST-based, is more elegant, but people might prefer SOAP or feel more comfortable using an “official” service.
In either case, I’m still trying to find a solution which allows applications to keep functioning even when the VIES site/service is down (which seems to be the case for the moment, at least for certain VAT numbers). One solution is to simply rely on syntax validation (check for example http://www.braemoor.co.uk/software/vat.shtml for a JS-based solution).
August 12th, 2008 at 11:19 amMoksA
Hi, and thanks for you code.
As Nicolas said there is an official wsdl… Some php code to use it :
$client = new SoapClient(null, array(’location’ => “http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl”,’uri’ => “http://test-uri/”));
August 27th, 2008 at 3:27 pm$params = array(”countryCode” =>”FR”,”vatNumber”=>”00000000000″);
$result=$client->__soapCall(”checkVat”, $params);
var_dump($result);
zmove
Hi,
Thank you MoksA for your example, it seems to works good.
But what is the ‘uri’ parameter in your soap declaration ?
November 18th, 2008 at 12:16 pm