Home / VAT API / Integrations / Deno
Deno EU VAT Validation API
Validate EU VAT numbers in Deno and Deno Deploy with the TaxID API using native fetch — no npm install, no build step. Add it to a Deno Deploy handler or a Fresh route so VAT numbers are verified against VIES before you apply reverse-charge treatment.
Quick start
CURL
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://www.taxid.dev/api/v1/validate/DE/DE123456789
Code example
Full integration example including error handling for service_unavailable responses from VIES.
Deno (TS)
// deno run --allow-net --allow-env validate_vat.ts
// Deploy to Deno Deploy — no npm install, no config
interface VATResult {
valid: boolean;
status: string;
company_name?: string;
company_address?: string;
}
async function validateVAT(
country: string,
vatNumber: string
): Promise<VATResult> {
const res = await fetch(
`https://www.taxid.dev/api/v1/validate/${country}/${vatNumber}`,
{ headers: { Authorization: `Bearer ${Deno.env.get("TAXID_API_KEY")}` } }
);
return res.json() as Promise<VATResult>;
}
const result = await validateVAT("DE", "DE123456789");
if (result.valid) {
console.log(`Valid EU business: ${result.company_name}`);
} else if (result.status === "service_unavailable") {
console.warn("VIES temporarily unavailable — retry later");
} else {
console.log("Invalid VAT number");
}cURL
curl "https://www.taxid.dev/api/v1/validate/DE/DE123456789" \
-H "Authorization: Bearer $TAXID_API_KEY"
# {
# "valid": true,
# "status": "active",
# "company_name": "Example GmbH",
# "company_address": "Musterstraße 1, 10115 Berlin",
# "cached": false
# }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 for a free key with 100 validations/month. Provide it as an environment variable and read it with Deno.env.get("TAXID_API_KEY"); on Deno Deploy, set it in the project's environment-variables settings rather than committing it.
- 2
Write a validateVAT function
Use the global fetch — no imports needed — to GET https://www.taxid.dev/api/v1/validate/{country}/{number} with an Authorization bearer header, and type the JSON response with a small interface. Because Deno ships fetch and TypeScript natively, there is no dependency to install or bundle.
- 3
Serve it from a handler or Fresh route
Call the function from a Deno.serve handler or a Fresh routes/api handler, reading the country and number from the request. Return the result as JSON. The same code runs locally with deno run --allow-net --allow-env and unchanged on Deno Deploy.
- 4
Branch on the status
Apply reverse-charge only when status is 'active'. Return a clear error for 'invalid', and for 'service_unavailable' let the request proceed while flagging the number for a later re-check — do not treat a temporary VIES outage as a failed validation.
- 5
Deploy globally
Push to Deno Deploy to run the validator at the edge in dozens of regions with no server to manage. Grant only --allow-net and --allow-env so the isolate has the minimum permissions it needs, keeping the deployment locked down.
Frequently asked questions
Do I need any dependencies to validate VAT numbers in Deno?
No. Deno ships a global fetch and native TypeScript, so a single function with fetch and an interface is all you need — there is no npm install, package.json, or build step. This keeps a Deno Deploy isolate tiny and fast to cold-start.
How do I read the API key on Deno Deploy?
Set TAXID_API_KEY in your Deno Deploy project's environment-variables settings and read it with Deno.env.get("TAXID_API_KEY"). Locally, pass --allow-env (and --allow-net) so the script may read the variable and make the outbound request.
Does this work with the Fresh framework?
Yes. Put the validation call in a routes/api/ handler in your Fresh project and invoke it from your island's form submission. Fresh runs on Deno, so the same fetch-based function works without modification.
What permissions does the validator need?
Only --allow-net for the outbound HTTPS request to the TaxID API and --allow-env to read the API key. Granting the minimum flags keeps the Deno security sandbox tight, which is a core benefit of running validation on Deno.
Country-specific API docs:
In-depth integration guide:
EU VAT validation in Deno
Validate EU VAT numbers in Deno using the built-in fetch API and TypeScript. Deployable to Deno Deploy with zero configuration — no npm install, no package.json needed.
Start validating EU VAT numbers in Deno
Free plan — 100 validations/month. No credit card required.