# EU VAT Number Validation (Official VIES) (`kdhan/eu-vat-validation-vies`) Actor

Validate EU VAT numbers against the European Commission's official VIES service. Returns the registered business name and address where the member state provides them. Separates 'not registered' from 'member state did not answer', so a valid number is never reported as invalid. No API key.

- **URL**: https://apify.com/kdhan/eu-vat-validation-vies.md
- **Developed by:** [Doohan Kim](https://apify.com/kdhan) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-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 Validation (Official VIES)

Validate EU VAT numbers against **VIES**, the European Commission's own validation service.
No API key, no scraping.

### The thing most VAT checkers get wrong

VIES does not answer by itself. It forwards your question to the tax authority of that member
state. When that national system is busy or down, VIES replies with **HTTP 200 and
`isValid: false`** — the same shape as a genuinely invalid number.

A checker that only reads `isValid` will tell you a perfectly valid French VAT number is
**invalid**. In tax and invoicing work, that is worse than an error.

This Actor separates the two:

| Status | Meaning |
|---|---|
| `VALID` | Registered for VAT. `isValid` is `true`. |
| `INVALID` | Not registered. `isValid` is `false`. |
| `SERVICE_UNAVAILABLE` | The member state did not answer. **`isValid` is empty — unknown, not invalid.** Retry later. |
| `INVALID_INPUT` | The number could not be read, or VIES rejected the format. |

Busy member states are retried with backoff before this is reported.

This is not rare. While building this Actor, Germany's system reported itself as
`Available` in the status endpoint and still answered `MS_UNAVAILABLE` to every
request for several minutes. A checker reading only `isValid` would have declared a
valid German VAT number invalid during that window.

### Output

| Field | Description |
|---|---|
| `input` | What you supplied, unchanged |
| `countryCode`, `vatNumber` | Parsed country and number |
| `status`, `statusDetail` | The four statuses above, with a plain explanation |
| `isValid` | `true`, `false`, or empty when the service did not answer |
| `name`, `address` | Registered business, where the member state discloses it |
| `requestDate` | Timestamp VIES returned |

Some countries (Germany among them) do not disclose the name and address. VIES returns `---`
for those. This Actor leaves the fields empty rather than handing you `---` as if it were data.

### Input

```json
{
  "vat_numbers": ["IE6388047V", "DE811569869", "FR 40 303 265 045"],
  "max_retries": 3
}
```

Spaces, dots and dashes are ignored. If your numbers have no country prefix, set `country`.

Turn on `include_country_status` to log which member state systems are available before the
run — useful when you get `SERVICE_UNAVAILABLE` and want to know whether it is worth retrying.

### Use cases

- Validating customer VAT numbers before issuing zero-rated invoices
- Cleaning a CRM or ERP list of EU business customers
- Periodic re-validation for compliance records
- Enriching leads with the registered business name where available

### Limits worth knowing

- VIES is a shared public service. The default pace is two requests per second; going faster
  makes member state systems refuse requests.
- Availability varies by country and by time of day. `SERVICE_UNAVAILABLE` is normal and
  temporary — it is not a defect in your data.
- VIES confirms registration. It does not confirm that a business is trading, nor validate
  addresses.

### Running locally

```bash
pip install -r requirements.txt
python -m tests.test_vies
```

### Attribution

Data from VIES, operated by the European Commission. This Actor is not affiliated with or
endorsed by the European Commission. VIES results reflect what each member state's system
reports at the time of the request.

# Actor input Schema

## `vat_numbers` (type: `array`):

One per line, with the country prefix. Spaces, dots and dashes are ignored. Example: DE811569869, IE6388047V, FR 40 303 265 045

## `country` (type: `string`):

Two-letter code such as DE, IE, FR. Only needed if your numbers do not start with the country code.

## `include_country_status` (type: `boolean`):

Before checking, log which member state systems are currently available. Useful when results come back as SERVICE\_UNAVAILABLE.

## `requests_per_second` (type: `integer`):

VIES is a shared public service. Going fast makes member state systems refuse requests.

## `max_retries` (type: `integer`):

When a member state reports it is busy, retry this many times before giving up and reporting SERVICE\_UNAVAILABLE.

## `max_results` (type: `integer`):

You are charged per checked number.

## Actor input object example

```json
{
  "vat_numbers": [
    "IE6388047V",
    "DE811569869"
  ],
  "include_country_status": false,
  "requests_per_second": 2,
  "max_retries": 3
}
```

# Actor output Schema

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

Country, number, status (VALID / INVALID / SERVICE\_UNAVAILABLE / INVALID\_INPUT), the registered name and address where the member state provides them, and a plain explanation.

# 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 = {
    "vat_numbers": [
        "IE6388047V",
        "DE811569869"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kdhan/eu-vat-validation-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 = { "vat_numbers": [
        "IE6388047V",
        "DE811569869",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("kdhan/eu-vat-validation-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 '{
  "vat_numbers": [
    "IE6388047V",
    "DE811569869"
  ]
}' |
apify call kdhan/eu-vat-validation-vies --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kdhan/eu-vat-validation-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/Gu40wDlNKdjIJUJxD/builds/OnY3cA7PCmYNURPhw/openapi.json
