DEV Community

Daniel Igel
Daniel Igel

Posted on

Validate EU VAT numbers against VIES (with company lookup) in one GET

If you sell B2B in the EU, you need valid VAT numbers for reverse-charge invoicing. The official source is the EU's VIES service — but its SOAP endpoint is clunky, rate-limited, and occasionally down per member state, so you end up writing retry + parsing glue.

This wraps VIES in a clean REST call across all 27 member states (+ XI for Northern Ireland), with a 1-hour cache:

curl --request GET \
  --url 'https://eu-vat-number-validator-api.p.rapidapi.com/api/v1/validate?vat=DE811569869' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: eu-vat-number-validator-api.p.rapidapi.com'
Enter fullscreen mode Exit fullscreen mode

GET /api/v1/lookup?vat=... additionally returns the registered company name and address (where the member state exposes it — useful to prefill an invoice). POST /api/v1/validate/batch validates several numbers at once.

Free tier on RapidAPI: https://rapidapi.com/danieligel/api/eu-vat-number-validator-api

Built this to gate EU B2B signups for reverse-charge billing. How does your stack handle VAT validation — VIES directly, or a provider?

Top comments (0)