# EU VIES VAT Validator & Batch Enricher (`immemorial_damask/eu-vies-vat-validator`) Actor

Validate EU VAT numbers via the official European Commission VIES REST API. Smart retries, official company name and address enrichment, consultation IDs, and zero Pay-Per-Event charges when a member state is unavailable.

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

## Pricing

from $4.00 / 1,000 vat validations

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/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 VIES VAT Validator & Batch Enricher (Official API)

**Validate EU VAT numbers against the official European Commission VIES REST API** and get clean, flat JSON with official company names and addresses. No unofficial HTML scraping, no API key, and **no Pay-Per-Event charge when a member-state gateway is down**.

Click **Start** with the prefilled input (`SE556703748501` and `IE6388047V`) to see **Spotify AB** and **GOOGLE IRELAND LIMITED** come back immediately from the official service.

**Price: $4.00 per 1,000 definitive validations** (`$0.004` per `vat-validation`). Malformed numbers, `MS_UNAVAILABLE` after retries, network errors, and cache hits are never charged.

### What is EU VIES VAT Validator & Batch Enricher?

[VIES](https://ec.europa.eu/taxation_customs/vies/) (VAT Information Exchange System) is the European Commission's official service for checking whether a VAT number is registered for intra-EU trade. Member-state nodes go down regularly and return `MS_UNAVAILABLE` — a wrapper that retries, backs off, and records "could not check" separately from "invalid VAT" is what finance, onboarding, and AI-agent workflows actually need.

This Actor turns that official REST API into an Apify dataset you can schedule, export, or call from an **AI / MCP agent**. You get:

- Official VIES results for all **EU-27** member states, plus **Greece (EL)** and **Northern Ireland (XI)**
- Local syntax validation *before* VIES is called, so typo'd numbers never hammer the API and are never billed
- Smart retries with exponential backoff and jitter on `MS_UNAVAILABLE`, `MS_MAX_CONCURRENT_REQ`, `GLOBAL_MAX_CONCURRENT_REQ`, `TIMEOUT`, and HTTP 429/5xx
- Official **company name** and **address** enrichment when the member state publishes them
- Optional official **consultation number** (`requestIdentifier`) for audit and tax proof when you provide your requester VAT
- Polite **per-member-state concurrency** for bulk batches
- Optional 24-hour cache of definitive `VALID` / `INVALID` results (`UNAVAILABLE` is never cached; cache hits are free)
- Limited permissions and predictable **pay-per-event** pricing

### How to validate EU VAT numbers

1. Open this Actor and keep the prefilled VAT numbers, or paste a column from Excel / Google Sheets into **VAT numbers (pasted column / CSV)**.
2. Optionally add your own EU VAT number under **Requester VAT number** to receive an official consultation ID.
3. Click **Start**. The Actor calls `POST https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number` and writes clean records to the default dataset.
4. Open the **Overview** table for status, official company name, address, consultation number, and billing flags — or download JSON / CSV / Excel.

No European Commission API key is required. A free Apify account is enough to try the prefilled run.

For large batches, raise the run timeout in the Actor's run options (the default is 5 minutes). VIES member-state calls commonly take a few seconds each.

### How much does it cost?

Pricing is **pay per event**, not pay per compute unit:

| Event | When it is charged | Price |
| --- | --- | --- |
| `vat-validation` (primary) | Once for each definitive official VIES result (`VALID` or `INVALID`) written to the dataset | **$0.004** ($4.00 / 1,000) |
| `apify-actor-start` | Once when the run starts | $0.00005 |

**What 1,000 definitive validations cost:** `$4.00` in `vat-validation` events, plus one start event (`$0.00005`). Platform usage is not billed on top of these events.

**What is never charged:**

- `INVALID_FORMAT` — the number failed official EU VAT syntax locally, so VIES was not called
- `UNAVAILABLE` — the member state (or VIES itself) was still down after retries, including `MS_UNAVAILABLE`
- Network errors and HTTP 429/5xx after retries
- Cache hits of an earlier definitive result (within `cacheHours`)
- Duplicate VAT numbers dropped in the same run

A typical 2-number trial (the prefilled Spotify + Google check) is about **$0.008**. The run's `maxItems` cap and the user's `maxTotalChargeUsd` budget are both honored for billable events.

### Input examples

#### Default try-it-now input (prefilled)

```json
{
  "vatNumbers": ["SE556703748501", "IE6388047V"],
  "maxRetries": 3,
  "concurrencyPerCountry": 2,
  "cacheHours": 24,
  "deduplicate": true,
  "maxItems": 5
}
```

#### Pasted Excel column plus official consultation ID

```json
{
  "vatNumbersText": "SE 556703-748501\nIE6388047V\nDE123456789",
  "requesterVatNumber": "SE556703748501",
  "maxRetries": 3,
  "cacheHours": 0,
  "maxItems": 100
}
```

#### Fair-billing batch (invalid formats and downtime cost nothing)

```json
{
  "vatNumbers": ["SE556703748501", "SE123", "DE811569869"],
  "maxRetries": 3,
  "cacheHours": 24
}
```

`SE123` is returned as `INVALID_FORMAT` without calling VIES. If the German node is down, `DE811569869` is returned as `UNAVAILABLE` with `retryable: true` and `charged: false`.

### Output

Each dataset row is a flat record:

| Field | Meaning |
| --- | --- |
| `status` | `VALID`, `INVALID`, `INVALID_FORMAT`, or `UNAVAILABLE` |
| `valid` | `true` / `false` for a definitive official result; `null` otherwise |
| `companyName`, `companyAddress` | Official VIES trader details when the member state publishes them (`---` becomes `null`) |
| `consultationNumber` | Official VIES `requestIdentifier`, only when `requesterVatNumber` was set |
| `viesErrorCode` | Transient or input error code such as `MS_UNAVAILABLE` |
| `attempts` | How many times VIES was called, including retries |
| `fromCache` | `true` when a definitive result was reused from `eu-vies-vat-cache` |
| `charged` | `true` only when a `vat-validation` event was applied |
| `retryable` | `true` when you can reasonably try again later (member-state downtime) |

Source data is attributed on every row to the official VIES REST API.

### Supported countries

All EU-27 prefixes, plus:

- **EL** for Greece (unofficial `GR` prefixes are rewritten automatically)
- **XI** for Northern Ireland

VAT numbers are normalized before the check: whitespace, dashes, dots and case are stripped (`"se 556703-748501"` becomes `SE556703748501`). Local official syntax is validated first so obviously malformed values never reach VIES.

### Fair use of the official API

This Actor calls only the official [VIES on-the-Web REST API](https://ec.europa.eu/taxation_customs/vies/) and throttles concurrency per member state. Company name and address are exactly what VIES already returns for a valid number. You are responsible for how you use the results in your own compliance, invoicing, or onboarding process.

### Changelog

See [CHANGELOG.md](CHANGELOG.md).

# Changelog

This Actor's version history is a separate document: https://apify.com/immemorial_damask/eu-vies-vat-validator/changelog.md

# Actor input Schema

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

EU VAT numbers to validate (with or without punctuation). Include the country prefix (SE, IE, DE, EL for Greece, XI for Northern Ireland). Greek GR prefixes are rewritten to EL automatically.

## `vatNumbersText` (type: `string`):

Optional multiline or CSV block — paste a column of VAT numbers from Excel or Google Sheets. Values are merged with vatNumbers and de-duplicated when Deduplicate is on.

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

Optional EU VAT number of the requesting business (for example SE556703748501). When set, VIES returns an official consultation number (requestIdentifier) for audit and tax proof. Cache is bypassed for these live consultation requests.

## `maxRetries` (type: `integer`):

Retry attempts after the first call, with exponential backoff and jitter, on transient VIES errors only (MS_UNAVAILABLE, MS_MAX_CONCURRENT_REQ, GLOBAL_MAX_CONCURRENT_REQ, TIMEOUT, HTTP 429/5xx).

## `concurrencyPerCountry` (type: `integer`):

Polite per-member-state parallelism so national VIES gateways are not flooded during large batches. A modest global cap is also applied.

## `cacheHours` (type: `integer`):

Optional Key-Value Store cache (eu-vies-vat-cache) for definitive VALID/INVALID results. UNAVAILABLE responses are never cached. 0 disables the cache. Cache hits are not charged.

## `deduplicate` (type: `boolean`):

Drop repeated VAT numbers (after normalization) within the same run before calling VIES or charging.

## `maxItems` (type: `integer`):

Hard cap on rows written to the dataset. Also respects the run's PPE budget (ChargingManager / maxTotalChargeUsd) for billable VALID/INVALID events. Default 500.

## Actor input object example

```json
{
  "vatNumbers": [
    "SE556703748501",
    "IE6388047V"
  ],
  "maxRetries": 3,
  "concurrencyPerCountry": 2,
  "cacheHours": 24,
  "deduplicate": true,
  "maxItems": 5
}
```

# Actor output Schema

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

Clean, flat JSON records for each VAT number (status, official company name and address, consultation number, retry and billing flags).

## `stats` (type: `string`):

Counts for valid, invalid, invalid-format and unavailable rows, cache hits, charges, and whether the PPE budget cap was reached.

# 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": [
        "SE556703748501",
        "IE6388047V"
    ],
    "maxRetries": 3,
    "concurrencyPerCountry": 2,
    "cacheHours": 24,
    "maxItems": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("immemorial_damask/eu-vies-vat-validator").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": [
        "SE556703748501",
        "IE6388047V",
    ],
    "maxRetries": 3,
    "concurrencyPerCountry": 2,
    "cacheHours": 24,
    "maxItems": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("immemorial_damask/eu-vies-vat-validator").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": [
    "SE556703748501",
    "IE6388047V"
  ],
  "maxRetries": 3,
  "concurrencyPerCountry": 2,
  "cacheHours": 24,
  "maxItems": 5
}' |
apify call immemorial_damask/eu-vies-vat-validator --silent --output-dataset

```

## MCP server setup

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

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/HBlbEWfgSUfxCv7kN/builds/E1GibVGbTZzRbiioF/openapi.json
