Validate European VAT numbers with format verification and database lookups. For Latvian VAT numbers, optionally retrieve complete company information from our comprehensive business registry.
Format validation for all EU member states with comprehensive pattern matching and country-specific rules.
Real-time database validation for Latvian VAT numbers with optional company data retrieval.
https://api.clients.lv/api/vat
All API endpoints require authentication using Bearer tokens with the following permission:
vat:read - Required for all VAT Validation API access
Provides access to VAT number validation and Latvian company data retrieval.
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST https://api.clients.lv/api/vat/validate \
-d '{"vat_number": "LV40203029397"}'
/api/vat/validate
Validate VAT number format and optionally retrieve company data for Latvian VAT numbers.
| Parameter | Type | Required | Description |
|---|---|---|---|
| vat_number | string | Yes | VAT number to validate (with or without country prefix) |
| include_company | boolean | No | Include company data for valid Latvian VAT numbers (default: false) |
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-X POST "https://api.clients.lv/api/vat/validate" \
-d '{"vat_number": "LV40203029397"}'
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-X POST "https://api.clients.lv/api/vat/validate" \
-d '{"vat_number": "LV40203029397", "include_company": true}'
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-X POST "https://api.clients.lv/api/vat/validate" \
-d '{"vat_number": "DE123456789"}'
{
"valid": true,
"vat_number": "LV40203029397",
"country": "LV",
"format_valid": true,
"database_check": true,
"exists_in_database": true,
"vat_status": {
"is_active": true,
"registered_date": "2018-02-01",
"excluded_date": null,
"construction_industry": false,
"company_name": "SIA \"Example Company\""
}
}
{
"valid": true,
"vat_number": "LV40203029397",
"country": "LV",
"format_valid": true,
"database_check": true,
"exists_in_database": true,
"vat_status": {
"is_active": true,
"registered_date": "2018-02-01",
"excluded_date": null,
"construction_industry": false,
"company_name": "SIA \"Example Company\""
},
"company_data": {
"regcode": "40203029397",
"name": "SIA \"Example Company\"",
"type": "SIA",
"type_text": "Sabiedrība ar ierobežotu atbildību",
"address": "Rīga, Brīvības iela 1-1",
"registered": "2018-01-15",
"is_active": true,
"is_liquidated": false
}
}
{
"valid": true,
"vat_number": "DE123456789",
"country": "DE",
"format_valid": true,
"database_check": false,
"exists_in_database": false,
"vat_status": null
}
{
"valid": false,
"vat_number": "XX123",
"error": "Unknown or unsupported country code: XX",
"country": "XX",
"format_valid": false
}
/api/vat/stats
Get VAT validation system statistics including database coverage and supported countries.
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
"https://api.clients.lv/api/vat/stats"
{
"total_vat_numbers": 15234,
"active_vat_numbers": 14567,
"excluded_vat_numbers": 667,
"construction_companies": 1234,
"supported_countries": {
"total": 28,
"with_database_support": ["LV"],
"format_validation_only": [
"LT", "EE", "DE", "FR", "GB", "IE", "IT", "ES", "PT", "NL", "BE",
"AT", "DK", "FI", "SE", "PL", "CZ", "SK", "HU", "SI", "HR", "RO",
"BG", "MT", "LU", "CY"
]
},
"last_updated": "2025-09-27T14:53:35.000000Z"
}
The VAT Validation API supports format validation for all 28 EU member states. Database validation is currently available for Latvian VAT numbers only.
All other EU countries support format validation with country-specific patterns:
The API returns standard HTTP status codes and JSON error responses:
{
"error": "Missing API token"
}
{
"error": "Insufficient permissions. Required: vat:read"
}
{
"message": "The vat number field is required.",
"errors": {
"vat_number": ["The vat number field is required."]
}
}
| Code | Status | Description |
|---|---|---|
| 200 | OK | VAT validation successful |
| 401 | Unauthorized | Missing/invalid token |
| 403 | Forbidden | Insufficient permissions |
| 422 | Validation Error | Invalid request parameters |
| 500 | Server Error | Internal server error |
<?php
$apiToken = 'YOUR_API_TOKEN';
$baseUrl = 'https://api.clients.lv/api/vat';
// Validate VAT number with company data
$data = [
'vat_number' => 'LV40203029397',
'include_company' => true
];
$response = file_get_contents($baseUrl . '/validate', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => [
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json',
'Accept: application/json'
],
'content' => json_encode($data)
]
]));
$result = json_decode($response, true);
if ($result['valid']) {
echo "VAT Number: " . $result['vat_number'] . "\n";
echo "Country: " . $result['country'] . "\n";
if (isset($result['vat_status'])) {
echo "VAT Status: " . ($result['vat_status']['is_active'] ? 'Active' : 'Inactive') . "\n";
echo "Company: " . $result['vat_status']['company_name'] . "\n";
}
if (isset($result['company_data'])) {
echo "Company Type: " . $result['company_data']['type_text'] . "\n";
echo "Address: " . $result['company_data']['address'] . "\n";
}
} else {
echo "Invalid VAT number: " . $result['error'] . "\n";
}
const apiToken = 'YOUR_API_TOKEN';
const baseUrl = 'https://api.clients.lv/api/vat';
// Validate VAT number with company data
async function validateVAT(vatNumber, includeCompany = false) {
try {
const response = await fetch(`${baseUrl}/validate`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
vat_number: vatNumber,
include_company: includeCompany
})
});
const result = await response.json();
if (result.valid) {
console.log('VAT Number:', result.vat_number);
console.log('Country:', result.country);
if (result.vat_status) {
console.log('VAT Status:', result.vat_status.is_active ? 'Active' : 'Inactive');
console.log('Company:', result.vat_status.company_name);
}
if (result.company_data) {
console.log('Company Type:', result.company_data.type_text);
console.log('Address:', result.company_data.address);
}
} else {
console.log('Invalid VAT number:', result.error);
}
return result;
} catch (error) {
console.error('Error:', error);
}
}
// Usage examples
validateVAT('LV40203029397', true); // Latvian VAT with company data
validateVAT('DE123456789'); // German VAT (format only)