# Spanish Tax Rulings Scraper (DGT Binding Consultations) (`flets_sv/dgt-consultas-vinculantes`) Actor

Search and export binding tax rulings from the Spanish Tax Directorate (DGT): full answer, facts, laws and articles cited. Monitor new rulings for advisors.

- **URL**: https://apify.com/flets_sv/dgt-consultas-vinculantes.md
- **Developed by:** [FlEtsv](https://apify.com/flets_sv) (community)
- **Categories:** Business, AI
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 71.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Spanish Tax Rulings Scraper (DGT Binding Consultations)

Search and export binding tax rulings (consultas vinculantes) from the Spanish Tax Directorate (DGT, Ministry of Finance): full answer text, facts, question, laws and articles cited. Monitor new rulings for tax advisors, law firms and legal AI. *Versión en español más abajo.*

***

### Use cases

- Tax advisers: search binding rulings (consultas vinculantes) of the Spanish tax authority by keyword
- Feed accounting and tax-law assistants with official criteria
- Monitor new rulings on VAT, income tax and corporate tax
- Build searchable knowledge bases for tax teams

### English

#### What does it do?

The Actor queries the official **DGT doctrine database (Petete)** and returns each ruling as a structured record. It is the fastest way to build a searchable base of Spanish tax doctrine or to get alerts when the DGT answers a question about a given law.

Use cases:

- **Tax advisory and gestorías:** find how the DGT interprets a rule (VAT, IRPF, inheritance tax, corporate tax).
- **Legal AI / RAG:** feed full rulings with cited laws and articles into a retrieval pipeline.
- **Monitoring:** `soloNuevas` emits only rulings you have not collected before.
- **Research:** filter by date range, ruling type and free text or law.

#### Input

An empty input `{}` widens the date window until it finds results and returns up to 10 rulings.

| Field | Description |
|---|---|
| `textoLibre` | Free-text search. |
| `numeroConsulta` | A specific ruling number, e.g. `V5441-26`. |
| `normativa` | Law or regulation referenced. |
| `cuestionPlanteada`, `descripcionHechos` | Search in the question or facts. |
| `fechaDesde` / `fechaHasta` | Date range (`YYYY-MM-DD`). |
| `tipos` | `vinculantes` and/or `generales`. |
| `soloCriterioInteres` | Only rulings flagged as interesting criterion. |
| `incluirContestacion` | Include the full answer text (default `true`). |
| `maxResultados` | Cap (default 100). |
| `soloNuevas` | Only rulings not seen before. |
| `resumenIA` | Optional AI summary. |

```json
{ "textoLibre": "donaciones", "fechaDesde": "2026-01-01", "maxResultados": 25 }
```

#### Output

Real item from a run (answer text truncated here; the dataset has the full text):

```json
{
  "tipo": "vinculante",
  "numeroConsulta": "V5441-26",
  "organo": "SG de Impuestos Patrimoniales, Tasas y Precios Públicos",
  "fechaSalida": "2026-08-06",
  "normativa": "Ley 29/1987 Impuesto sobre Sucesiones y Donaciones - 3.1 - 5 - 6.1 ...",
  "leyesCitadas": ["Ley 29/1987", "RD 1629/1991", "Ley 22/2009"],
  "articulosCitados": ["3.1", "5", "6.1", "6.2", "9", "24.2", "30", "67", "32.1", "32.2", "48", "55"],
  "descripcionHechos": "El consultante va a recibir de sus padres transferencias de dinero de forma periódica...",
  "cuestionPlanteada": "Tributación de las transferencias periódicas en el Impuesto sobre Sucesiones y Donaciones.",
  "contestacion": "En relación con las cuestiones planteadas este Centro Directivo informa lo siguiente: ...",
  "longitudContestacion": 8026,
  "idDocumento": "70284",
  "urlBuscador": "https://petete.tributos.hacienda.gob.es/consultas/",
  "fuente": "Ministerio de Hacienda - Direccion General de Tributos (petete.tributos.hacienda.gob.es)",
  "extraidoEn": "2026-10-31T18:10:45.020Z",
  "hash": "224a09482d0759d1e7528d35f7f59fcdba776a7b907f323386a9a7258a6f225a"
}
```

#### Pricing (pay per event)

| Event | Price | Per 1,000 |
|---|---|---|
| Ruling with full answer (`consulta`) | $0.006 | $6.00 |
| Ruling, metadata only (`consulta-metadatos`) | $0.001 | $1.00 |
| AI summary (`resumen-ia`, optional) | $0.005 | $5.00 |

Set a maximum spend per run; the Actor stops and keeps what it saved.

#### Integrations (Make, Zapier, Google Sheets)

- **Make**: add the Apify module "Run an Actor" (Actor `Flets_sv/dgt-consultas-vinculantes`), paste the input JSON, chain "Get Dataset Items" and map the fields to Google Sheets, Slack, Airtable or your CRM.
- **Zapier**: the Apify app offers "Run Actor" and "Fetch Dataset Items". Add a Schedule trigger and send each row to Gmail, Slack or Notion.
- **Google Sheets**: enable the official Google Sheets integration in the Actor's Integrations tab to append every run to a sheet, or call `https://api.apify.com/v2/acts/Flets_sv~dgt-consultas-vinculantes/run-sync-get-dataset-items?format=csv` with POST and your input from Apps Script (`UrlFetchApp`).
- **API and webhooks**: start the Actor from the REST API, use Schedules for recurring runs and add a webhook to notify your system when a run finishes.

Input to paste into Make or Zapier:

```json
{"textoLibre":"criptomonedas","tipos":["vinculantes"],"soloCriterioInteres":false,"incluirContestacion":true,"maxResultados":5,"soloNuevas":false,"diasRetencion":365,"pausaMs":1000,"resumenIA":false}
```

#### FAQ

**Is it legal?** The rulings are public administrative doctrine published by the Ministry of Finance. Reuse is allowed under Law 37/2007 on reuse of public sector information; cite the source (each record has `fuente`). The Actor pauses between requests to respect the site. This is not tax or legal advice.

**Do I get the full answer?** Yes, by default. Turn off `incluirContestacion` for a cheaper metadata-only list.

**Binding vs general?** Binding rulings (V...) bind the tax administration for the case; general ones (NV...) are informative. Choose with `tipos`.

**Is it in English?** The source is in Spanish. Use `resumenIA` or your own LLM to translate or summarise.

#### Integrations

- **API / SDKs:** `POST https://api.apify.com/v2/acts/flets_sv~dgt-consultas-vinculantes/runs`, JavaScript and Python clients.
- **Make, Zapier, n8n, Google Sheets:** weekly run plus alert on new rulings.
- **RAG:** load the dataset into Pinecone, Qdrant, LangChain or LlamaIndex.
- **MCP / AI agents:** call it from Claude or any MCP client via `https://mcp.apify.com`.
- Export as JSON, CSV, Excel or XML.

#### Data source and license

Ministerio de Hacienda, Dirección General de Tributos (petete.tributos.hacienda.gob.es). Independent Actor, not affiliated with the Spanish administration.

***

### Español

#### ¿Qué hace?

Busca en la base oficial de doctrina de la **Dirección General de Tributos (Petete)** y devuelve cada consulta como registro estructurado: órgano, fecha, descripción de los hechos, cuestión planteada, **contestación completa**, leyes y artículos citados. Pensado para asesorías fiscales, gestorías, despachos de abogados y proyectos de IA jurídica.

#### Input

Con `{}` amplía la ventana de fechas hasta encontrar resultados y devuelve hasta 10 consultas. Campos: `textoLibre`, `numeroConsulta`, `normativa`, `cuestionPlanteada`, `descripcionHechos`, `fechaDesde`, `fechaHasta`, `tipos` (vinculantes/generales), `soloCriterioInteres`, `incluirContestacion`, `maxResultados`, `soloNuevas`, `resumenIA`.

#### Output

Ver el ejemplo real de la sección inglesa.

#### Precios (pago por evento)

| Evento | Precio | Por 1.000 |
|---|---|---|
| Consulta con contestación (`consulta`) | 0,006 $ | 6,00 $ |
| Consulta solo metadatos (`consulta-metadatos`) | 0,001 $ | 1,00 $ |
| Resumen con IA (`resumen-ia`, opcional) | 0,005 $ | 5,00 $ |

#### Integraciones (Make, Zapier, Google Sheets)

- **Make**: añade el módulo de Apify «Run an Actor» (Actor `Flets_sv/dgt-consultas-vinculantes`), pega el input JSON y encadena «Get Dataset Items»; después mapea los campos a Google Sheets, Slack, Airtable o tu CRM.
- **Zapier**: la app de Apify ofrece «Run Actor» y «Fetch Dataset Items». Ponle un disparador de horario y envía cada fila a Gmail, Slack o Notion.
- **Google Sheets**: en la pestaña Integrations del Actor activa la integración oficial con Google Sheets para añadir cada ejecución a una hoja, o llama desde Apps Script (`UrlFetchApp`) a `https://api.apify.com/v2/acts/Flets_sv~dgt-consultas-vinculantes/run-sync-get-dataset-items?format=csv` con POST y tu input.
- **API y webhooks**: lanza el Actor por API REST, programa ejecuciones (Schedules) y avisa a tu sistema con un webhook al terminar.

Ejemplo de input para pegar en Make o Zapier:

```json
{"textoLibre":"criptomonedas","tipos":["vinculantes"],"soloCriterioInteres":false,"incluirContestacion":true,"maxResultados":5,"soloNuevas":false,"diasRetencion":365,"pausaMs":1000,"resumenIA":false}
```

#### Preguntas frecuentes

**¿Es legal?** Son doctrina administrativa pública del Ministerio de Hacienda, reutilizable según la Ley 37/2007; cita la fuente (`fuente` en cada registro). El Actor espera entre peticiones para no sobrecargar el sitio. No es asesoramiento fiscal ni jurídico.

**¿Cómo recibo solo las nuevas?** Programa el Actor con `soloNuevas`.

#### Integración

API de Apify, Make, Zapier, n8n, Google Sheets, bases vectoriales y agentes de IA vía MCP (`https://mcp.apify.com`). Exporta a JSON, CSV, Excel o XML.

#### Fuente y licencia

Ministerio de Hacienda, Dirección General de Tributos. Actor independiente, sin afiliación con la Administración.

### Ejemplos de uso / Usage examples

#### Example output (real run, 2026-11-05)

First rows returned by a real run of this Actor on 2026-11-05 (shortened columns, values truncated):

| numeroConsulta | fechaSalida | organo | normativa | cuestionPlanteada |
|---|---|---|---|---|
| V0002-26 | 2026-01-08 | SG de Impuestos Especiales y de Tributos sobre el Comerci... | Ley 7/2022, de 8 de abril, de residuos y suelos contamina... | La consultante plantea una serie de preguntas en relación... |
| V0007-26 | 2026-01-08 | SG de Impuestos sobre las Personas Jurídicas | LIS Ley 27/2014 art. 10-3 y 11 | - ¿Cómo tributa esta subvención en el Impuesto sobre Soci... |
| V0012-26 | 2026-01-08 | SG de Impuestos Especiales y de Tributos sobre el Comerci... | Ley 38/1992 arts. 65-3; 66-1,d); 68 y 69 | Sujeción al Impuesto Especial sobre Determinados Medios d... |

#### Copy-paste inputs

**1. Binding rulings about donations since January**

```json
{
  "textoLibre": "donaciones",
  "fechaDesde": "2026-01-01",
  "maxResultados": 25
}
```

**2. Only rulings flagged as of special interest**

```json
{
  "soloCriterioInteres": true,
  "tipos": [
    "vinculantes"
  ],
  "maxResultados": 50
}
```

#### Call it from your code (Apify API)

```bash
curl -X POST "https://api.apify.com/v2/acts/Flets_sv~dgt-consultas-vinculantes/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"textoLibre": "donaciones", "fechaDesde": "2026-01-01", "maxResultados": 25}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("Flets_sv/dgt-consultas-vinculantes").call(run_input={"textoLibre": "donaciones", "fechaDesde": "2026-01-01", "maxResultados": 25})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

No code? Use the Apify modules for **Make** and **Zapier** (run the Actor, then fetch dataset items), or the **Google Sheets** integration in the Actor's Integrations tab to append each run to a sheet.

# Actor input Schema

## `textoLibre` (type: `string`):

Palabras a buscar en todo el texto de la consulta. Si no pones ningun filtro se buscan los ultimos 30 dias.

## `numeroConsulta` (type: `string`):

Numero exacto, por ejemplo V1000-25. Util para localizar una consulta concreta.

## `normativa` (type: `string`):

Texto que debe aparecer en la normativa citada, por ejemplo Ley 37/1992.

## `cuestionPlanteada` (type: `string`):

Texto que debe aparecer en la cuestion planteada.

## `descripcionHechos` (type: `string`):

Texto que debe aparecer en la descripcion de los hechos (solo consultas vinculantes).

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

Fecha minima de salida en formato AAAA-MM-DD.

## `fechaHasta` (type: `string`):

Fecha maxima de salida en formato AAAA-MM-DD.

## `tipos` (type: `array`):

Que tipos buscar: vinculantes y/o generales.

## `soloCriterioInteres` (type: `boolean`):

Si se activa, solo se devuelven las consultas marcadas por la DGT como de interes.

## `incluirContestacion` (type: `boolean`):

Descarga el texto completo de la contestacion (evento consulta). Si se desactiva solo se devuelven los datos de la lista (evento consulta-metadatos).

## `maxResultados` (type: `integer`):

Numero maximo de consultas que se recuperaran (1 a 5000).

## `soloNuevas` (type: `boolean`):

Si se activa, solo se emiten las consultas no vistas en ejecuciones anteriores.

## `diasRetencion` (type: `integer`):

Dias que se recuerdan las consultas ya vistas antes de olvidarlas.

## `pausaMs` (type: `integer`):

Milisegundos de espera entre peticiones al buscador (500 a 10000), para ser respetuosos con el servidor.

## `resumenIA` (type: `boolean`):

Anade un resumen a cada consulta. Opcional, desactivado por defecto y solo funciona si el Actor tiene IA configurada.

## Actor input object example

```json
{
  "textoLibre": "criptomonedas",
  "numeroConsulta": "",
  "normativa": "",
  "cuestionPlanteada": "",
  "descripcionHechos": "",
  "fechaDesde": "",
  "fechaHasta": "",
  "tipos": [
    "vinculantes"
  ],
  "soloCriterioInteres": false,
  "incluirContestacion": true,
  "maxResultados": 5,
  "soloNuevas": false,
  "diasRetencion": 365,
  "pausaMs": 1000,
  "resumenIA": false
}
```

# Actor output Schema

## `consultas` (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 = {
    "textoLibre": "criptomonedas",
    "maxResultados": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("flets_sv/dgt-consultas-vinculantes").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 = {
    "textoLibre": "criptomonedas",
    "maxResultados": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("flets_sv/dgt-consultas-vinculantes").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 '{
  "textoLibre": "criptomonedas",
  "maxResultados": 5
}' |
apify call flets_sv/dgt-consultas-vinculantes --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,flets_sv/dgt-consultas-vinculantes"
        }
    }
}
```

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/JKydzKzCDIFzxfRD1/builds/m6paAGAoyx5aS5htQ/openapi.json
