Skip to main content

vies-check

Check EU VAT numbers in VIES, the EU's official register, from async Python. It normalizes and validates the format of numbers from every EU country and Northern Ireland, asks VIES, and gives one of three answers: valid, invalid, or unavailable.

One dependency (httpx), fully typed, Python 3.11 and newer.

Install

pip install vies-check

Usage

import asyncio
from vies_check import Status, check_vat


async def main() -> None:
    result = await check_vat("DE", "DE 123 456 789")
    if result.status is Status.VALID:
        print("Valid:", result.name or "(name not shared)")
    elif result.status is Status.INVALID:
        print("Not a valid EU VAT number")
    else:
        print("VIES couldn't check it right now, try again later")


asyncio.run(main())

country is the ISO code ("DE", "GR"; "EL" and "XI" work too). The number may come with or without its prefix, spaces, dots or dashes.

Why three outcomes

VIES doesn't hold the data itself: it relays each question to the register of the country concerned, and those registers go offline or throttle requests regularly. Then VIES answers with an error, or even with "valid": false plus a userError such as MS_UNAVAILABLE, MS_MAX_CONCURRENT_REQ or TIMEOUT, which says nothing about the number.

Treating that as "invalid" tells a real company its number is wrong. Treating it as "valid" lets a reverse-charge invoice go out without evidence. So vies-check returns Status.UNAVAILABLE: keep the number unconfirmed and ask again later. VIES's error code is in result.error. Numbers with the wrong format are rejected as INVALID without asking VIES (result.checked_in_vies is then False).

The result

@dataclass(frozen=True)
class Result:
    status: Status  # VALID, INVALID or UNAVAILABLE
    vat_id: str  # normalized, e.g. "DE123456789"
    name: str = ""  # as registered; empty when the country doesn't share it
    address: str = ""
    request_identifier: str = ""
    checked_in_vies: bool = True
    error: str = ""  # e.g. "MS_UNAVAILABLE"

Proof of the check: request identifier

Send your own EU VAT number with the check, and VIES returns a request identifier, a reference for that exact check. Some tax offices accept it as proof that you checked a customer's number before invoicing them without VAT.

from vies_check import Requester, check_vat

me = Requester("DE", "DE 987 654 321")
result = await check_vat("FR", "FR12345678901", requester=me)
print(result.request_identifier)

An invalid requester number raises ValueError when you create the Requester.

More

  • Your own HTTP client: check_vat(..., client=httpx.AsyncClient(...)) reuses connections and keeps your proxy settings; the client is left open. Otherwise each call opens and closes its own, with timeout seconds (default 10).
  • Format only: normalize(), is_valid_format() and prefix_for() work offline. They check the shape each country uses, from the VIES FAQ, not the national checksums.
  • Northern Ireland: XI numbers are supported (9 or 12 digits, GD + 3 digits for government departments, HA + 3 digits for health authorities). VIES covers them for trade in goods.
  • Logging: failed checks are logged as warnings on the vies_check logger.

Development

pip install -e ".[dev]"
pytest
ruff check . && ruff format --check .
mypy

The tests never touch the network: VIES is replaced with httpx.MockTransport.

License

MIT


vies-check is extracted from getpylaunch, a FastAPI starter kit for paid SaaS, where it handles EU VAT for Stripe billing.

Metadata

Release files for vies-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vies-check 0.1.0
File Size Uploaded Provenance Actions
vies_check-0.1.0.tar.gz 10.4 kB With provenance Details for vies_check-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vies-check 0.1.0
File Interpreter ABI Platform Actions
vies_check-0.1.0-py3-none-any.whl Python 3 none any Details for vies_check-0.1.0-py3-none-any.whl

Total release size: 18.7 kB

Release files / vies_check-0.1.0.tar.gz

Download URL vies_check-0.1.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2d97864d81d1998c6c268f00fb38a9ac9c110a4e387f9cde2ebbeaa80fe85d0c
BLAKE2b-256 checksum
How to use checksums
bbdca4fa61077e64302b47400f3af42408916c079f0e829c73e22b292cbc5b18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / vies_check-0.1.0-py3-none-any.whl

Download URL vies_check-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4542977a3ec6e75ed074be8eb28f62ada685aae205afe89ce02d6d9c36025360
BLAKE2b-256 checksum
How to use checksums
36742863704355ba2ca269397322b13acd5828dc55f4da3413085481f5e473e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for vies-check 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vies_check-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page