Python 3 · no extra packages

Check an EORI number with Python’s standard library

Make one request from your server, then read the status, source and original check time. This example uses Python’s built-in urllib; you do not need an SDK.

Read the Python example ↓

Reviewed 30 October 2026 · documentation, no request runs on this page

Before you run it

  1. Use Python 3 on your server or private development machine. Set EORI_API_KEY through your environment or secret manager. Never paste a key into this page, source control or browser code.
  2. Save the code as eori_check.py. Replace the example IT00159560366 in the URL with the EORI number you intend to check; the sample number is not a result or a recommendation.
  3. Run python3 eori_check.py. Running the file sends one request and may consume your existing allowance. Reading or copying it sends none. There is no automatic retry loop.

One request, with a 20-second timeout

A key is required before the request is sent. HTTP, network and unreadable-response errors stop the script without recording an invalid EORI.

# Python 3 · standard library only; run on your server.
# Set EORI_API_KEY privately in your environment first.
import json
import os
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

key = os.environ.get("EORI_API_KEY")
if not key:
    raise SystemExit("Set EORI_API_KEY first")
request = Request(
    "https://eoricheck.com/v1/eori?number=IT00159560366",
    headers={"Authorization": f"Bearer {key}"},
)
try:
    with urlopen(request, timeout=20) as response:
        result = json.load(response)
except HTTPError as error:
    retry = error.headers.get("Retry-After", "not supplied")
    raise SystemExit(
        f"HTTP {error.code}; no validity decision. Retry-After: {retry}"
    ) from None
except (URLError, TimeoutError, OSError):
    raise SystemExit("Network failure; no validity decision") from None
except (ValueError, UnicodeError):
    raise SystemExit("Unreadable response; no validity decision") from None

if not isinstance(result, dict) or result.get("estado") not in (
    "valido", "no_valido"
):
    raise SystemExit("No validity decision; review or retry later")
print(result["estado"], result.get("fuente"), result.get("checked_at"))

On a narrow screen, focus the code block and use the arrow keys to read long lines. You can also scroll it sideways.

Read the three values together

estado
valido means valid in the queried register; no_valido means invalid. Other statuses are not a validity decision. A valid number does not identify the person using it.
fuente
Keep the returned source with the result. A cached response is not a new check with the register. GB uses HMRC; XI and EU-27 use TAXUD.
checked_at
Keep the original check time, rather than replacing it with the time your script ran. Results may come from a 24-hour cache. Missing source or date needs review.

The script prints these values; it does not save an audit record or approve a supplier. A missing source or date prints as None, not a new date or invented source.

Reference and next step

The request and timeout follow the Python urllib.request documentation. Response fields follow the existing EORICheck API contract reviewed on 30 October 2026. EORICheck is independent of HMRC and the European Commission; a check is not customs clearance or official certification.

Open the existing API documentation →