A lightweight .NET client for validating European VAT numbers using the official European Commission VIES (VAT Information Exchange System) API.
This library provides simple and strongly typed access to VAT validation including optional qualified checks with trader information.
- Validate VAT numbers via VIES
- Strongly typed request/response models
- Support for qualified VAT checks (trader name, address, company type)
- Async/await support
- CancellationToken support
- Clean and minimal API surface
- Exception-safe argument validation
Install via NuGet:
dotnet add package Nager.EuropeanCommissionViesOr via Package Manager:
Install-Package Nager.EuropeanCommissionViesvar serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider();
var httpClientFactory = serviceProvider.GetRequiredService<IHttpClientFactory>();
var viesClient = new ViesClient(httpClientFactory);
var response = await viesClient.CheckVatAsync("DE123456789");
if (response != null && response.Valid)
{
Console.WriteLine("VAT number is valid");
Console.WriteLine(response.Name);
Console.WriteLine(response.Address);
}var isValid = await viesClient.IsValidVatAsync("DE123456789");
if (isValid)
{
Console.WriteLine("Valid VAT number");
}var request = new VatCheckRequest
{
VatNumber = "123456789",
CountryCode = "DE",
TraderName = "Example Company",
TraderStreet = "Example Street 1",
TraderPostalCode = "10115",
TraderCity = "Berlin"
};
var response = await viesClient.CheckVatAsync(request);
if (response != null)
{
Console.WriteLine($"Valid: {response.Valid}");
Console.WriteLine($"Name match: {response.Name}");
}| Code | Description |
|---|---|
| MS_MAX_CONCURRENT_REQ | The maximum number of concurrent requests is not linked to a specific IP. It is a global count across all users. |
| CountryCode | Example | Abbreviation |
|---|---|---|
| AT | ATU9999999p | UID |
| BE | BE999999999p | N° TVA / BTW-nr. / MwSt.-Nr. |
| BG | BG99999999p | DDS (ДДС) |
| CY | CY50999999L | FPA |
| CZ | CZ901231999p | DIČ |
| DE | DE99999999p | USt-IdNr. |
| DK | DK99999999 | SE-Nr. |
p= Check Digit
https://en.wikipedia.org/wiki/VAT_identification_number
The VAT Information Exchange System (VIES) is operated by the European Commission and allows validation of VAT numbers registered within the European Union.
Official information: https://ec.europa.eu/taxation_customs/vies/
- .NET 10 or later
- Internet connection for VIES API access
This project is licensed under the MIT License.
Contributions are welcome. Please open an issue or submit a pull request.