Skip to main content

invalid_vat_format

HTTP Status: 422 Unprocessable Entity

Example response

{
  "error": {
    "code": "invalid_vat_format",
    "message": "The VAT number format is invalid. Expected format: CC123456789",
    "docs_url": "https://docs.vatly.dev/errors/invalid_vat_format"
  },
  "meta": {
    "request_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}

What happened?

The VAT number doesn’t match the expected format for its country, or the country code is not supported. This happens when:
  • The VAT number is missing a country prefix
  • The country code is not in the supported countries list
  • The number contains only the country code with no digits
  • The number does not match the expected format for its country (wrong length, missing required characters)
  • The number contains invalid characters after normalization
  • The Swiss UID (CHE format) or Norwegian org number fails the MOD11 checksum
  • The Australian ABN fails the weighted checksum validation

Expected formats

CountryCodeFormat (after country prefix)Example
AustriaATU + 8 digitsATU12345678
BelgiumBE10 digits (starts with 0 or 1)BE0123456789
BulgariaBG9 or 10 digitsBG123456789
CroatiaHR11 digitsHR12345678901
CyprusCY8 digits + 1 letterCY12345678A
Czech RepublicCZ8, 9, or 10 digitsCZ12345678
DenmarkDK8 digitsDK12345678
EstoniaEE9 digitsEE123456789
FinlandFI8 digitsFI12345678
FranceFR2 characters + 9 digitsFRAB123456789
GermanyDE9 digitsDE123456789
GreeceEL9 digitsEL123456789
HungaryHU8 digitsHU12345678
IrelandIE7 digits + 1-2 letters, or 1 digit + letter + 5 digits + letterIE1234567A
ItalyIT11 digitsIT12345678901
LatviaLV11 digitsLV12345678901
LithuaniaLT9 or 12 digitsLT123456789
LuxembourgLU8 digitsLU12345678
MaltaMT8 digitsMT12345678
NetherlandsNL9 digits + B + 2 digitsNL123456789B01
PolandPL10 digitsPL1234567890
PortugalPT9 digitsPT123456789
RomaniaRO2 to 10 digitsRO1234567890
SlovakiaSK10 digitsSK1234567890
SloveniaSI8 digitsSI12345678
SpainES1 letter + 7 digits + 1 letter or digitESA12345678
SwedenSE12 digitsSE123456789012
N. IrelandXI9 or 12 digitsXI123456789
United KingdomGB9 or 12 digitsGB123456789
SwitzerlandCH9 digits (with MWST/TVA/IVA suffix)CHE123456789MWST
NorwayNO9 digits (with MVA suffix)NO123456789MVA
AustraliaAU11 digits (ABN)AU51824753556

How to fix

  1. Include the country code: Always prefix with the country code: NL123456789B01, GB123456789, DE123456789, CHE123456789MWST, NO123456785MVA, AU51824753556
  2. Check supported countries: See the full list at Supported Countries
  3. Let the API normalize: Don’t strip spaces or dots manually. Send "NL 123.456.789 B01" and the API handles it
# Correct
curl "...?vat_number=NL123456789B01"
curl "...?vat_number=CHE-123.456.789+MWST"
curl "...?vat_number=NO123456785MVA"

# Wrong - no country code
curl "...?vat_number=123456789B01"

# Wrong - invalid MOD11 checksum for Swiss UID
curl "...?vat_number=CHE999999999MWST"

# Also correct - the API normalizes this
curl "...?vat_number=nl+123.456.789+b01"

Common mistakes

  • Forgetting the country code: 123456789 instead of NL123456789B01
  • Using lowercase: This actually works fine (the API normalizes to uppercase), but check there’s a country prefix
  • Including “VAT” prefix: VAT123456789 is not valid; use the country code instead
  • Using GR for Greece: Greece uses EL in the VIES system, not GR
  • Missing the MWST/TVA/IVA suffix for Swiss numbers: CHE123456789 alone is not valid; include the suffix (e.g. CHE123456789MWST)
  • Missing the MVA suffix for Norwegian numbers: NO123456785 alone is not valid; include MVA (e.g. NO123456785MVA)
  • Wrong number of digits: e.g. sending 10 digits for GB (requires exactly 9 or 12)
  • Missing the B separator for Dutch VAT: NL numbers require B between the digit groups, e.g. NL123456789B01
  • Using an unsupported country: Only EU member states, GB, XI, CH, LI, NO, AU, and SG are supported

Catching this error with the SDKs

import Vatly, { ValidationError } from '@vatly/node';

const vatly = new Vatly('vtly_live_your_api_key');
const { data, error } = await vatly.vat.validate({ vatNumber: '...' });

if (error instanceof ValidationError) {
  console.log(error.message);
  console.log(error.details); // Array<{ field, message }> | null
}