# Spain De Minimis & State Aid Scraper (BDNS) (`xamto1987/spain-de-minimis-aid`) Actor

Ayudas de minimis y ayudas de estado notificadas a la UE desde la Base de Datos Nacional de Subvenciones (BDNS/SNPSAP). Spanish de minimis and notified state aid grants, by beneficiary NIF, for due diligence.

- **URL**: https://apify.com/xamto1987/spain-de-minimis-aid.md
- **Developed by:** [Santi Belloso Lopez](https://apify.com/xamto1987) (community)
- **Categories:** Lead generation, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 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.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Spain De Minimis & State Aid Scraper (BDNS) · Ayudas de minimis y ayudas de estado

Extrae **ayudas de minimis** y **ayudas de estado notificadas** de la **Base de
Datos Nacional de Subvenciones (BDNS / SNPSAP)**, el registro oficial del
Ministerio de Hacienda (IGAE). Pensado para **due diligence**: cuánta ayuda
pública acumulada ha recibido una empresa, bajo qué reglamento europeo y de
qué organismo.

Scrapes **Spanish de minimis aid and notified state aid** from the official
**National Subsidies Database (BDNS)** — every award under the EU de minimis
regulation or notified as state aid, with amounts, recipients and the legal
basis (regulation / SA. case number).

***

### 🇪🇸 Español

#### Qué obtienes

**Modo `minimis`** — ayudas bajo el Reglamento (UE) de minimis (el instrumento
más habitual para pymes, hasta el tope que marca cada reglamento sin
necesidad de notificación individual a la Comisión Europea):

| Campo | Qué es |
|---|---|
| `nif`, `razonSocial` | Beneficiario **ya separado** en NIF/CIF y denominación |
| `tipoBeneficiario` | `juridica` / `fisica` / `desconocido` |
| `importe`, `ayudaEquivalente` | Cuantía en euros, como número |
| `reglamento` | **Reglamento europeo** bajo el que se concede (p. ej. `REG (UE) 2023/2831 de minimis, General`) |
| `fechaConcesion` | Fecha de la concesión |
| `convocante`, `tituloConvocatoria` | Quién concede y de qué convocatoria procede |
| `sectorActividad` | Sector económico del beneficiario |

**Modo `ayudas_estado`** — ayudas notificadas a la Comisión Europea como ayuda
de estado (no sujetas al límite de minimis), con el número de caso:

| Campo adicional | Qué es |
|---|---|
| `ayudaEstado` | Número de caso ante la Comisión Europea (`SA.xxxxxx`) |
| `urlAyudaEstado` | Enlace al registro de ayudas de estado de la UE |
| `objetivo` | Objetivo/base jurídica de la ayuda |
| `region`, `sectores` | Ámbito territorial y sectores económicos |

#### Para qué se usa

- **Due diligence de M\&A / crédito**: cuánta ayuda pública acumulada ha
  recibido una empresa (NIF) y bajo qué reglamento — información que no
  aparece en el balance.
- **Cumplimiento del límite de minimis**: verificar el histórico de ayudas de
  minimis de un beneficiario antes de conceder una nueva.
- **Inteligencia competitiva**: qué empresas de tu sector reciben ayudas de
  estado y de qué organismo.
- **Investigación y periodismo de datos** sobre ayudas públicas.

#### Parámetros de entrada

| Parámetro | Tipo | Por defecto | Descripción |
|---|---|---|---|
| `mode` | `minimis` | `ayudas_estado` | `minimis` | Qué registro se extrae |
| `nifs` | lista de NIF/CIF | `[]` | Ver más abajo — filtro **en cliente** |
| `keywords` | lista de textos | `[]` | Una búsqueda por término, sobre el título de la convocatoria de origen |
| `fechaDesde` | fecha `AAAA-MM-DD` | — | Solo concesiones desde esa fecha |
| `maxItems` | entero | `200` | Tope de ítems |
| `maxPaginasEscaneadas` | entero | `50` | Solo con `nifs` sin `keywords` — ver más abajo |
| `includePersonalData` | booleano | `false` | Ver protección de datos, más abajo |

Ejemplo — histórico de ayudas de un beneficiario concreto:

```json
{
  "mode": "minimis",
  "nifs": ["B13347190"],
  "fechaDesde": "2025-01-01",
  "maxItems": 200
}
```

#### Búsqueda por NIF: cómo funciona de verdad

**La API oficial de BDNS no permite filtrar por NIF en el servidor.** Se
comprobó en fase 5: pasar `beneficiario=B13347190` (el NIF tal cual) devuelve
`HTTP 400 "El parámetro 'beneficiario' no tiene un formato correcto"`. El
único filtro de beneficiario que funciona de verdad es
`beneficiario=<idPersona>`, un identificador interno de la BDNS que no se
puede conocer a partir del NIF sin buscarlo antes.

Por eso este actor implementa la búsqueda por `nifs` **en cliente**: recorre
páginas recientes (ordenadas por fecha de concesión descendente) y descarta en
local todo lo que no case con la lista de NIFs pedida. El parámetro
`maxPaginasEscaneadas` (100 filas por página) acota ese recorrido para no
escanear el pool completo — más de 4,3 millones de filas en minimis, más de
6,4 millones en ayudas de estado. **Recomendación**: combina `nifs` con
`fechaDesde` (y opcionalmente `keywords`) para que el escaneo encuentre
resultados rápido; si tu beneficiario tiene poca actividad reciente, sube
`maxPaginasEscaneadas`.

#### Protección de datos: personas físicas fuera por defecto

Igual que en `spain-grants-bdns`: con `includePersonalData: false` — el valor
por defecto — se excluyen los beneficiarios que son personas físicas (DNI/NIE,
o NIF enmascarado por la propia fuente como `***2182**`). En una muestra de
100 filas verificada en fase 5, el **32 %** de minimis y el **42 %** de ayudas
de estado eran personas físicas enmascaradas — proporción alta, así que el
filtro por defecto importa. La clasificación es *fail-closed*: cualquier
identificador que no se pueda confirmar como persona jurídica se descarta
(esto incluye algunos beneficiarios internacionales cuyo código no sigue el
formato NIF español — se pierden por precaución, no por ser realmente
personas físicas).

#### Fuente y aviso legal

- **Fuente oficial**: BDNS / SNPSAP, IGAE, Ministerio de Hacienda —
  `https://www.pap.hacienda.gob.es/bdnstrans/api/`.
- Solo lectura de datos públicos, sin login ni token, ~1 petición/segundo,
  User-Agent identificado. No es un producto oficial ni está afiliado con
  IGAE ni con el Ministerio de Hacienda.
- Marco: Ley 38/2003 General de Subvenciones y Ley 37/2007 de reutilización
  de la información del sector público. Reutilización sujeta al
  [aviso legal del SNPSAP](https://www.infosubvenciones.es/bdnstrans/GE/es/avisolegal).
- Los datos son dinámicos y pueden corregirse tras la extracción.

***

### 🇬🇧 English

#### What it does

`spain-de-minimis-aid` scrapes **Spanish de minimis aid** and **notified
state aid** from the official **BDNS** (*Base de Datos Nacional de
Subvenciones*), built for **due diligence**: how much cumulative public aid a
company has received, under which EU regulation, from which body.

- **`minimis`** — aid under the EU de minimis regulation (the common
  instrument for SMEs, no individual notification to the European
  Commission required below the threshold).
- **`ayudas_estado`** — aid notified to the European Commission as state aid,
  including the case number (`SA.xxxxxx`).

#### NIF search: how it actually works

**BDNS's official API does not support server-side filtering by tax ID.**
Passing the NIF as a parameter returns HTTP 400. The only working beneficiary
filter uses an internal numeric ID that can't be derived from a NIF without
looking it up first. This actor therefore does the `nifs` filter
**client-side**: it scans recent pages (bounded by `maxPaginasEscaneadas`,
default 50 pages × 100 rows) and drops anything that doesn't match. Combine
`nifs` with `fechaDesde` (and optionally `keywords`) for a fast, tractable
scan; raise `maxPaginasEscaneadas` for beneficiaries with little recent
activity.

#### GDPR: individual beneficiaries excluded by default

Same policy as `spain-grants-bdns`: `includePersonalData: false` (default)
removes every individual beneficiary. In a verified 100-row sample, 32%
(minimis) and 42% (state aid) of beneficiaries were masked natural persons —
a high share, so the default filter matters. Classification is fail-closed.

#### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `mode` | enum | `minimis` | `minimis` or `ayudas_estado` |
| `nifs` | string list | `[]` | Client-side filter — see above |
| `keywords` | string list | `[]` | One search per term (grant-call title match) |
| `fechaDesde` | ISO date | — | Records from this date on |
| `maxItems` | integer | `200` | Hard cap |
| `maxPaginasEscaneadas` | integer | `50` | Only relevant for NIF search without keywords |
| `includePersonalData` | boolean | `false` | See GDPR section |

#### Disclaimer

Data comes from the official BDNS/SNPSAP API operated by IGAE (Spanish
Ministry of Finance). Not an official product, not affiliated with or
endorsed by IGAE. Rate-limited to ~1 request/second with an identifying
User-Agent. Reuse subject to the
[SNPSAP legal notice](https://www.infosubvenciones.es/bdnstrans/GE/es/avisolegal)
and Spanish Law 37/2007.

***

**Palabras clave / Keywords**: ayudas de minimis, ayudas de estado, BDNS,
due diligence, subvenciones España, state aid Spain, de minimis aid,
SA case number, beneficiarios de ayudas públicas, NIF, CIF, compliance,
reglamento de minimis, ayuda pública acumulada, cumulative state aid.

# Actor input Schema

## `mode` (type: `string`):

Que registro se extrae. `minimis` = ayudas de minimis (Reg. UE 2023/2831 y anteriores), el instrumento mas comun para pymes. `ayudas_estado` = ayudas de estado notificadas a la Comision Europea (incluye numero de caso SA.xxxxx). / Which register to scrape.

## `nifs` (type: `array`):

Lista de NIF/CIF a buscar (p. ej. "B12345678"). IMPORTANTE: la API oficial de BDNS no permite filtrar por NIF en el servidor, asi que el filtro se aplica EN CLIENTE recorriendo paginas recientes (ver "maxPaginasEscaneadas"). Combinalo con "keywords" o "fechaDesde" para acotar mejor. Vacio = sin filtro por beneficiario. / Server-side NIF filtering is not supported by BDNS; this is a bounded client-side scan.

## `keywords` (type: `array`):

Lista de terminos a buscar en el titulo de la convocatoria de origen. Una busqueda por termino, resultados deduplicados; cada termino se busca por TODAS sus palabras. Vacio = sin filtro de texto. / One search per term; empty = no text filter.

## `fechaDesde` (type: `string`):

Solo concesiones con fecha de concesion a partir de esta fecha. Formato ISO `AAAA-MM-DD`. Recomendado para ejecuciones incrementales diarias y para acotar busquedas por NIF. / ISO date; recommended for incremental runs and to bound NIF scans.

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

Numero maximo de items a guardar en el dataset. El actor para limpiamente al alcanzarlo. / Hard cap on dataset items.

## `maxPaginasEscaneadas` (type: `integer`):

Solo aplica cuando usas "nifs" sin "keywords": tope de paginas (100 filas cada una) que el actor recorre buscando coincidencias antes de rendirse, para no escanear el pool completo (millones de filas). Subelo si tu beneficiario tiene poca actividad reciente. / Only relevant for NIF search without keywords: bounds the client-side scan.

## `includePersonalData` (type: `boolean`):

DESACTIVADO POR DEFECTO. Con esta opcion desactivada se excluyen los beneficiarios que son personas fisicas (DNI/NIE, o NIF enmascarado por la propia fuente) y el dataset contiene unicamente empresas, entidades y administraciones. En una muestra de 100 filas verificada en fase 5, un 32-42% de los beneficiarios de minimis/ayudas de estado eran personas fisicas enmascaradas. Activarlo hace que el dataset incluya datos personales: su tratamiento posterior es responsabilidad tuya (RGPD / LOPDGDD). / OFF by default: individual (natural person) beneficiaries are excluded.

## Actor input object example

```json
{
  "mode": "minimis",
  "nifs": [],
  "keywords": [
    "agricultura"
  ],
  "maxItems": 50,
  "maxPaginasEscaneadas": 50,
  "includePersonalData": false
}
```

# Actor output Schema

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

Items normalizados en el dataset por defecto (JSON, CSV, Excel).

# 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 = {
    "keywords": [
        "agricultura"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("xamto1987/spain-de-minimis-aid").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 = {
    "keywords": ["agricultura"],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("xamto1987/spain-de-minimis-aid").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 '{
  "keywords": [
    "agricultura"
  ],
  "maxItems": 50
}' |
apify call xamto1987/spain-de-minimis-aid --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xamto1987/spain-de-minimis-aid"
        }
    }
}

```

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/gFWBIeesqhYwFzpbj/builds/OyMhi3A5Fppc4kpeO/openapi.json
