How to Validate EU and UK VAT Numbers Automatically

The VAT API TeamAccounting
06-01-20266 minute read

The Problem With Manual VAT Checks

If you've ever tried to verify a VAT number by hand, you know the drill. You visit the EU's VIES portal, paste in the number, wait for a response, and hope the system isn't down. For UK numbers, you go to HMRC's separate checker. Then you copy the result somewhere, maybe into a spreadsheet, maybe into your CRM. And then you do it again for the next customer.

For a business processing a few invoices a month, that's annoying. For a SaaS platform onboarding hundreds of B2B customers, it's a genuine operational bottleneck — and a compliance risk if anything slips through.

The good news is that VAT number validation is one of the most straightforward compliance tasks to automate. With the right API, you can validate numbers in real time, directly within your own app or workflow, with no manual steps at all.

What Does VAT Number Validation Actually Check?

A VAT number isn't just a string of digits. Each EU member state issues them in its own format, and the VIES (VAT Information Exchange System) database is the authoritative source for checking whether a given number is both valid and active.

When you validate a VAT number properly, you're checking three things:

  • Format — does the number match the expected pattern for that country?
  • Active status — is the number currently registered and active with the tax authority?
  • Business name — in many cases, you can also retrieve the registered name and address.

That last point matters more than people realise. If a customer gives you a VAT number that's technically valid but belongs to a different company, format checking alone won't catch that. A proper validation call against VIES will.

For UK VAT numbers, VIES is no longer the right system — since Brexit, UK numbers are validated through HMRC's own Making Tax Digital infrastructure. Any tool that only checks VIES will give you incorrect results for UK registrations.

Why VIES Alone Is Not Enough

VIES is a useful system, but it has real limitations if you're relying on it directly.

First, availability. VIES has a well-documented history of downtime and slow responses, particularly when querying national tax authority systems that aren't always online 24/7. If your validation call fails because a country's system is temporarily unavailable, you have to decide whether to reject the customer or let them through unvalidated.

Second, rate limits and reliability. Querying VIES directly at scale is unreliable. It wasn't designed to be used as a backend service by commercial applications.

Third, it only covers the EU. UK VAT numbers require a completely separate API call to HMRC. If your business serves both EU and UK customers — which most do — you need to handle two different systems.

Automating VAT validation isn't a nice-to-have. If you're invoicing B2B customers across Europe, it's the difference between clean books and a compliance headache.

How Automated VAT Validation Works

A VAT validation API sits between your application and the underlying tax authority databases. You send a VAT number, it routes the query to the correct system (VIES for EU numbers, HMRC for UK numbers), handles retries and fallbacks, and returns a structured response.

A typical response tells you whether the number is valid, whether it's currently active, and — where available — the registered business name and address. You can use that information to auto-populate billing details at checkout, gate B2B pricing, or log a validation timestamp for audit purposes.

The VAT API from thevatapi.com handles validation for all 27 EU member states and UK VAT numbers in a single endpoint. You send the VAT number, it returns a structured JSON response with validity status, business name, and address where available. There's no need to maintain separate integrations for EU and UK.

Integrating VAT Validation Into Your App

At Checkout or Signup

The most common integration point is during checkout or account creation. When a B2B customer enters their VAT number, you validate it in real time before they complete registration. If the number is invalid or inactive, you flag it immediately rather than discovering the problem when you try to issue a VAT-exempt invoice.

In Your Billing Flow

If you're using Stripe or another payment processor, you likely collect VAT numbers as part of your billing setup. A validation API call at this point lets you confirm the number before it goes into your invoicing system — which matters because issuing a zero-rated invoice to an invalid VAT number is a compliance error that can come back to bite you in an audit.

In Bulk or Batch Processes

If you've got existing customer data that was never validated, you can run batch validation to clean up your records. This is worth doing periodically even for ongoing customers — VAT registrations can lapse, companies can deregister, and numbers that were valid at signup may no longer be active.

What to Do With the Validation Result

Validation isn't a binary pass/fail in all cases. VIES sometimes returns inconclusive results when a national system is temporarily unavailable — different from a definitive 'invalid' response. Your integration should handle these cases explicitly.

A sensible approach is to store the full validation response alongside the VAT number in your database, along with a timestamp. That way you have an audit trail showing that you made a good-faith effort to validate the number at the time it was provided.

For inconclusive responses, you might choose to let the customer proceed while flagging the account for manual review, or retry the validation later. Either way, having the infrastructure in place to make the call automatically is the first step.

Format Validation vs Live Validation

There's a distinction worth drawing between format validation (checking that the number matches the expected pattern) and live validation (checking against the actual tax authority database).

Format validation is fast and can be done client-side without any API call. It catches obvious errors like missing digits or wrong prefixes. But it won't tell you whether the number is actually registered — a correctly formatted number can still be inactive or fraudulent.

For any business where VAT compliance matters — which is most B2B businesses trading in Europe — you want live validation, not just format checking. The extra API call is worth it.

Building This Into Your Stack

VAT number validation is one of those infrastructure pieces that takes half a day to build properly and then runs silently in the background forever. The effort is front-loaded.

What you need: an API key, an HTTP client, and a few lines of code to call the endpoint and handle the response. Most implementations are under 30 lines. You can check the documentation at thevatapi.com to see request and response formats, error codes, and example integrations.

The result is that your team never needs to manually verify a VAT number again — and your finance team has the confidence that every invoice you issue is backed by a verified, active registration.

« Back to Blog

Powered by BlogHandy