EU VAT Number Validator

This is a free service to validate an EU VAT number.

UPDATE:

This service now supports JSON. Use Accept: application/json request header to request a JSON response.

Oct 7 2013

All registered companies within the EU have a VAT number assigned by the local government.

In order to sell goods and services exempt of VAT within the EU to registered companies you must ensure that the buyer has a valid VAT number.

In order to check this the EU provides a service to validate VAT numbers. This service, however, is either a form-based webpage or a SOAP web-service. No RESTful webservice is provided.

Therefore I have made this small webservice to accommodate users who prefer RESTful webservices.

Donation

This service is provided free of cost but if you wish to make a donation to support me please use the link below. All donations are welcome no matter the amount.

Usage

The web service will reply in XML (default) or JSON. Use an Accept: application/json request header to request a JSON response.

GET http://vatid.eu/check/<country_code>/<vat_number>

In order to obtain the request_identifier you must also provide the following parameters.

GET http://vatid.eu/check/<country_code>/<vat_number>/<requester_country_code>/<requester_vat_number>

Attributes:

Optional Attributes:

Example request and response without documentation id:
Request:
GET http://vatid.eu/check/DK/30505166

Response:		  
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <country-code>DK</country-code>
  <vat-number>30505166</vat-number>
  <valid>true</valid>
  <name><![CDATA[JUSTABOUTIT APS]]></name>
  <address>
    <![CDATA[GAMMELTORV 8 2 
    1457 KØBENHAVN K]]>
  </address>
<response>

Request:
Accept: application/json
GET http://vatid.eu/check/DK/30505166/DK/30505166

Response (JSON):
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
...

{
  "response": {
    "country_code": "DK",
    "vat_number": "30505166",
    "valid": "true",
    "name": "JUSTABOUTIT ApS",
    "address": "Gammeltorv 8 2\n1457 København K\n"
  }
}

NB! Please note that <address> and <name> might not always be present! This depends whether the member country (country code) supplies this information.

Example request and response with documentation id:
Request:
GET http://vatid.eu/check/DK/30505166/DK/30505166

Response:	
HTTP/1.1 200 OK
Content-Type: application/xml;charset=utf-8	  
...

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <country-code>DK</country-code>
  <vat-number>30505166</vat-number>
  <valid>true</valid>
  <name><![CDATA[JUSTABOUTIT APS]]></name>
  <address>
    <![CDATA[GAMMELTORV 8 2 
    1457 KØBENHAVN K]]>
  </address>
  <request-date>2011-02-28+01:00</request-date>
  <request-identifier>WAPIAAAAS5s4vZIa</request-identifier>
<response>

Request:
Accept: application/json
GET http://vatid.eu/check/DK/30505166/DK/30505166

Response (JSON):
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
...

{
  "response": {
    "country_code": "DK",
    "vat_number": "30505166",
    "valid": "true",
    "name": "JUSTABOUTIT ApS",
    "address": "Gammeltorv 8 2\n1457 København K\n",
    "request_date": "2013-10-07",
    "request_identifier": "WAPIAAAAUGRThrWw"
  }
}

The request-identifier Documentation ID

If you specify your own country and VAT number the response will contain the elements request-date and request-identifier.

You can use this information as documentation for your inquiry to the VIES system.

Country Codes

The following are valid country codes.

Error handling

If the request fails for some reason an XML (or JSON) error response will be returned.

The error will always be of the following format.

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <code>invalid-input</code>
  <text>Cannot process this request. Please check your input parameters.</text>
</error>

The following codes exist and they will all return a text description of the error.

Known problems

Please note that the "member-state-unavailable" error is not an error with vatid.eu but happens when VIES for a given member state is unavailable.

Unfortunately this happens rather often. Your best bet is to try again later.

References

Contact

This service is hosted by Gigahost.

If you have any questions you can contact me at:

Blog: http://www.whatastruggle.com

E-mail: mortenmoellerriis _at_ gmail.com

Twitter: mmriis