Skip to content
@deckyard/vies

vies cheatsheet

Every export of @deckyard/vies. Guides are listed in the introduction.

jennifer
import "@deckyard/vies/" as vies;

A refused or failed check throws ViesError (kind "vies") with VIES's fault code and transient; an answer to another request (wrong element, another number echoed, checkApprox without a consultation number) has code "". A reply over its cap is kind "limit".

Constants

ConstantValueMeaning
ERROR_KIND"vies"the kind of a ViesError
ENDPOINT"https://ec.europa.eu/taxation_customs/vies/services/checkVatService"the VIES service
STATUS_ENDPOINT"https://ec.europa.eu/taxation_customs/vies/rest-api/check-status"the availability endpoint status reads
AVAILABLE"Available"the availability of a member state VIES can reach
TEST_ENDPOINT"https://ec.europa.eu/taxation_customs/vies/services/checkVatTestService"the test service
DEFAULT_TIMEOUT_MS30000the idle timeout of one request
DEFAULT_RETRIES2retries of a transient fault
DEFAULT_BACKOFF_MS1000the first wait, doubled after
MAX_WAIT_MS30000the longest wait before one retry
UNAVAILABLE_STATUS503the HTTP status of the maintenance page, retried like a transient fault
MAX_REPLY_BYTES65536the largest reply read
TRANSIENT_CODES["SERVICE_UNAVAILABLE", "MS_UNAVAILABLE", "TIMEOUT", "GLOBAL_MAX_CONCURRENT_REQ", "GLOBAL_MAX_CONCURRENT_REQ_TIME", "MS_MAX_CONCURRENT_REQ", "MS_MAX_CONCURRENT_REQ_TIME"]the faults that mean "try again later"

Functions

FunctionReturnsDoes
client()Clientthe VIES service: 30 s, 2 retries, syntax checks on
sandboxClient()Clientthe test service; syntax checks and retries off
withEndpoint(c, url)Clientanother endpoint; http:// only on this machine
withStatusEndpoint(c, url)Clientanother availability endpoint; http:// only on this machine
withTimeout(c, ms)Clientthe idle timeout of one request, 1000 to 300000 ms
withRetries(c, n, backoffMs)Clientretries of a transient fault (0 to 10) and the first wait (0 to MAX_WAIT_MS)
check(c, country, number)Resultcheck a number; valid false when VIES does not know it
checkApprox(c, country, number, requesterCountry, requesterNumber)ApproxResultthe same with the caller's number; a consultation number as proof
normalize(country, number)VatIdremove spaces, dots, hyphens and the prefix; GR as EL
parse(vat)VatIda number written with its country prefix
isWellFormed(id)boolthe number fits its country's syntax
countries()list of stringthe country codes VIES checks
status(c)Statuswhich member states VIES can reach now; one request, not retried

Types

Client

FieldMeaning
endpoint as stringthe SOAP service URL
statusEndpoint as stringthe availability endpoint
timeoutMs as intthe idle timeout of one request
retries as intretries of a transient fault
backoffMs as intthe first wait, doubled after, at most MAX_WAIT_MS each
checkSyntax as boolrefuse a malformed number before sending it

VatId

FieldMeaning
country as stringthe VIES country code, such as DE, EL, XI
number as stringthe number without its prefix, upper case; a 9-digit Belgian one gets its leading 0

Result

FieldMeaning
country as stringthe country code checked
number as stringthe number checked
valid as boolregistered for intra-EU trade
name as stringthe trader's name, "" if not disclosed
address as stringthe trader's address, "" if not disclosed
requestDate as stringthe date of the check, 2026-11-14+01:00

ApproxResult

FieldMeaning
country as stringthe country code checked
number as stringthe number checked
valid as boolregistered for intra-EU trade
name as stringthe trader's name, "" if not disclosed
address as stringthe trader's address, "" if not disclosed
companyType as stringthe company type code, "" if none
requestDate as stringthe date of the check
requestIdentifier as stringthe consultation number to keep as proof; never ""

Status

FieldMeaning
available as boolthe VIES service itself is up
countries as list of CountryStatuseach member state, in VIES's order

CountryStatus

FieldMeaning
country as stringthe VIES country code
availability as stringVIES's word, as sent: Available, Unavailable, ...
available as boolavailability is AVAILABLE

ViesError

FieldMeaning
kind as stringalways "vies"
message as stringvies: <what>
code as stringVIES's fault code, "" if none
transient as booltry again later: a transient fault or a 503 page
status as intthe HTTP status of the reply refused, 0 for a local error