Invoice automation and B2B onboarding both hit the same question: is this EU VAT number real, and is this legal entity who it says it is?
The EU runs a free VIES service for VAT checks, but it is SOAP, it goes down for single countries without warning, and it does not cover LEI codes. This is a small REST wrapper that handles both with the same headers.
Check a VAT number
import os, requests
HOST = "eu-vat-and-lei-validator.p.rapidapi.com"
headers = {"x-rapidapi-host": HOST, "x-rapidapi-key": os.environ["RAPIDAPI_KEY"]}
r = requests.get(f"https://{HOST}/vat/validate",
headers=headers, params={"number": "FR40303265045"}, timeout=30)
d = r.json()
print(d["status"], d["name"], d["address"])
A valid number prints VALID SA SODIMAS 11 RUE AMPERE 26600 PONT DE L ISERE. An unregistered one returns NOT_REGISTERED.
Check a LEI
r = requests.get(f"https://{HOST}/lei/validate",
headers=headers, params={"lei": "HWUPKR0MPOU8FGXBT394"}, timeout=30)
e = r.json()["entity"]
print(e["legalName"], e["entityStatus"], e["jurisdiction"])
That prints Apple Inc. ACTIVE US-CA. The response also has the registration dates, renewal date and legal address.
Batch and search
POST /vat/batch takes a list of numbers, and GET /lei/search?q=siemens&country=DE finds entities by name.
One thing to handle
VIES sometimes says a country is unavailable under load. The API reports that as a status field (VIES_UNAVAILABLE) instead of an error, so retry later rather than treating the number as invalid.
Try it
- Free plan (100 requests a month): https://rapidapi.com/ahmedsaidmorsy206/api/eu-vat-and-lei-validator
- Python and JavaScript examples and a Postman collection: https://github.com/kyb-api-toolkit/eu-vat-lei-validator-examples
Top comments (0)