# EU VAT Number Validator (VIES, Bulk) (`leathered_luna/eu-vat-validator-vies`) Actor

Bulk-validate EU VAT numbers against the official European Commission VIES service. Syntax pre-check, retries on member-state outages, consultation numbers. Not charged for malformed numbers.

- **URL**: https://apify.com/leathered_luna/eu-vat-validator-vies.md
- **Developed by:** [SiennaWorks](https://apify.com/leathered_luna) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 vat number checked

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## EU VAT Number Validator (Official VIES)

Validate **EU VAT numbers in bulk** with the European Commission's official **VIES** service, and get the registered **company name and address** where the member state publishes them. Northern Ireland `XI` numbers are supported too. No API key needed.

Built for finance and accounts-payable teams, e-commerce and marketplace onboarding, B2B invoicing, KYB checks and AI agents that must confirm a business VAT number before a zero-rated sale.

### How this is different

- **Straight from VIES.** It calls the official EC REST API, not a scraped page.
- **Local format check first.** Malformed numbers are rejected before VIES is called, and are never charged.
- **Built for VIES being flaky.** VIES often says a member state is busy. The Actor retries with backoff, and if the service stays down for a number it returns `service_unavailable` (not charged) so you can re-run just those.
- **Proof of validation.** Enter your own EU VAT number as `requesterVatNumber` and VIES returns an official **consultation number** for each check, which you can keep for audits.
- **Clear status per row.** `valid`, `invalid`, `invalid_format` or `service_unavailable`, plus a plain error message.

### What you get

`input`, `status`, `is_valid`, `country_code`, `country`, `vat_number`, `vat_number_full`, `company_name`, `company_address`, `consultation_number`, `vies_request_date`, `name_hidden_by_member_state`, `error_message`, `checked_at`.

Some member states (for example Germany and Spain) do not release the name and address. In that case the number is still valid and `name_hidden_by_member_state` is `true`.

An example is in [`examples/example_output.json`](examples/example_output.json).

### Input

```json
{
    "vatNumbers": ["DE811128135", "IE6388047V", "FR 40 303 265 045"],
    "defaultCountry": "",
    "requesterVatNumber": "",
    "concurrency": 3
}
```

| Field | Meaning |
|---|---|
| `vatNumbers` | One per item, with the 2-letter country prefix. Spaces, dots and dashes are ignored. Greece may be `GR` or `EL`. Duplicates are removed. |
| `defaultCountry` | Prefix to assume for numbers pasted without one. |
| `requesterVatNumber` | Your own EU VAT number, to receive consultation numbers. |
| `concurrency` | 1 to 5 parallel checks (default 3). VIES limits concurrency per country. |

### Pricing (pay-per-event)

**$0.003 per VAT number checked** ($3 per 1,000), charged only when VIES gives a definite answer (`valid` or `invalid`). Malformed numbers and VIES outages are returned free. Platform usage is included. Set a **maximum cost per run** in Apify Console for a hard cap. The Actor stops cleanly when the limit is reached.

### Reliability behaviour

| Situation | Behaviour |
|---|---|
| Malformed number | `invalid_format` with an explanation, not sent to VIES, not charged. |
| Member state busy or VIES down | Automatic retries with backoff, then `service_unavailable`, not charged. Re-run those numbers later. |
| Name or address not published | `valid` with empty name and `name_hidden_by_member_state: true`. |
| One bad number | Never fails the run. Other rows continue. |

### Legal and notes

- Source: the [European Commission VIES service](https://ec.europa.eu/taxation_customs/vies/). A `valid` result confirms the number is registered for intra-EU VAT. It is not a full due-diligence check.
- The UK left VIES after Brexit, so **GB numbers are not supported**. Use the UK HMRC service for those. Northern Ireland uses the `XI` prefix for goods.
- Company names and addresses are business data published by member states. You are responsible for handling any personal data in line with GDPR.
- Not affiliated with or endorsed by the European Commission.

### Local development

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pytest -q
```

### Changelog

- **0.1** — First version: bulk validation, local format checks, retries, consultation numbers, pay-per-event.

# Actor input Schema

## `vatNumbers` (type: `array`):

One VAT number per item with its 2-letter country prefix, e.g. DE811128135, FR40303265045, IE6388047V. Spaces, dots and dashes are ignored; Greece may be written GR or EL. Numbers that fail the official format check are not sent to VIES and are not charged.

## `defaultCountry` (type: `string`):

Optional 2-letter prefix (e.g. DE) to assume for numbers pasted without one.

## `requesterVatNumber` (type: `string`):

Optional. If you enter your own EU VAT number (with prefix), VIES returns an official consultation number you can keep as proof of validation.

## `concurrency` (type: `integer`):

VIES limits concurrent requests per country; the Actor retries automatically when a member state is busy.

## Actor input object example

```json
{
  "vatNumbers": [
    "IE6388047V",
    "DE811128135"
  ],
  "concurrency": 3
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "vatNumbers": [
        "IE6388047V",
        "DE811128135"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leathered_luna/eu-vat-validator-vies").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "vatNumbers": [
        "IE6388047V",
        "DE811128135",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("leathered_luna/eu-vat-validator-vies").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "vatNumbers": [
    "IE6388047V",
    "DE811128135"
  ]
}' |
apify call leathered_luna/eu-vat-validator-vies --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leathered_luna/eu-vat-validator-vies"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Mt0pMvUSOSBwGKQ0O/builds/AjPlM0yIqEJeYPhGm/openapi.json
