Home / VAT API / Integrations / Node.js
Node.js EU VAT Validation API
Validate EU VAT numbers from any Node.js backend — Express, Fastify, Next.js API routes, or plain scripts — using Node 18+ native fetch or axios. Returns company name, address, and registration status from VIES in under 100ms.
Quick start
CURL
curl -H "Authorization: Bearer YOUR_API_KEY" \ http://localhost:3000/api/v1/validate/DE/DE123456789
Code example
Full integration example including error handling for service_unavailable responses from VIES.
Node.js
// Node.js 18+ — uses native fetch, no extra dependencies
const res = await fetch(
'http://localhost:3000/api/v1/validate/DE/DE123456789',
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const data = await res.json();
if (data.valid) {
console.log('Active EU business:', data.company_name);
} else if (data.status === 'service_unavailable') {
// VIES is temporarily down — do not silently zero-rate
console.warn('VIES unavailable — retry later');
} else {
console.log('Invalid VAT number');
}
// data.valid => true
// data.status => "active"
// data.company_name => "Example GmbH"
// data.country_code => "DE"Python
import requests
resp = requests.get(
"http://localhost:3000/api/v1/validate/DE/DE123456789",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
data = resp.json()
if data["valid"]:
print("Active EU business:", data["company_name"])
elif data["status"] == "service_unavailable":
raise RuntimeError("VIES unavailable — retry later")
else:
print("Invalid VAT number")API response
The TaxID API returns a consistent JSON response for every validation:
{
"valid": true,
"status": "active",
"country_code": "DE",
"vat_number": "DE123456789",
"company_name": "Example GmbH",
"company_address": "Musterstraße 1, 10115 Berlin",
"request_date": "2026-05-10T00:00:00.000Z",
"cached": false,
"request_id": "req_01j..."
}activeVAT number is valid and the business is registered
invalidVAT number format is wrong or not registered in VIES
service_unavailableVIES or the national authority is temporarily down — retry later, do not silently zero-rate
Implementation steps
- 1
Get a free TaxID API key
Sign up at taxid.dev/signup. No credit card required. Store your API key as an environment variable (TAXID_API_KEY) — never hardcode it in source files or commit it to version control.
- 2
Make a GET request using native fetch (Node 18+) or axios
Call GET /api/v1/validate/:country/:vat with your API key in the Authorization header. Node 18 and above include native fetch — no extra dependencies needed. For older Node versions, use axios or node-fetch.
- 3
Parse the response and check valid and status fields
The API returns a JSON object with valid (boolean), status (string), company_name, and company_address. Check valid === true for a passing EU business. The status field gives more detail: 'active', 'invalid', 'not_found', or 'service_unavailable'.
- 4
Handle VIES service_unavailable gracefully
VIES has occasional downtime. When status === 'service_unavailable', do not reject the customer — instead, log the event and apply a conservative fallback (charge standard VAT and follow up). The TaxID API caches results for 24h (valid) and 1h (invalid) to reduce upstream dependency.
Frequently asked questions
Do I need any npm packages to call the TaxID API from Node.js?
No. Node.js 18 and above include the native Fetch API, so you can call the TaxID REST API with a single await fetch() call. For older Node versions (14, 16), use the axios or node-fetch package.
Can I use the TaxID API in a Next.js API route or server action?
Yes. Call the TaxID API from any Next.js server-side context: API routes (pages/api/), Route Handlers (app/api/), or Server Actions. Never call it from the client side — that would expose your API key.
How do I validate multiple VAT numbers in a single Node.js request?
Use the batch endpoint: POST /api/v1/validate with a JSON body containing a 'numbers' array (up to 25 entries). Each entry specifies a country code and VAT number. Results are returned in the same order, processed in parallel — ideal for bulk imports or nightly reconciliation jobs.
What is the response time for the TaxID API from Node.js?
Cached results respond in under 10ms. Uncached requests that hit VIES typically complete in 100–400ms. The response includes a 'cached' boolean so you can see whether the result came from cache. Valid numbers are cached for 24 hours, invalid numbers for 1 hour.
Country-specific API docs:
Start validating EU VAT numbers in Node.js
Free plan — 100 validations/month. No credit card required.