# Hacienda DYCTEA Scraper — Spanish Tax Doctrine (TEAC/TEAR) (`bovi/hacienda-scraper`) Actor

Scrape DYCTEA, the Spanish Ministry of Hacienda database of TEAC and TEAR tax criteria. Search by keyword, tribunal, date or claim number and get criterion text, binding status, legal references and concepts. Optional full resolution text. Pay per result.

- **URL**: https://apify.com/bovi/hacienda-scraper.md
- **Developed by:** [Vitalii Bondarev](https://apify.com/bovi) (community)
- **Categories:** Business, Automation
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 97.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 1,000 hacienda dyctea scraper — spanish tax doctrine (teac/tear)s

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

## Hacienda DYCTEA Scraper — Spanish Tax Doctrine (TEAC / TEAR)

Collect tax criteria from **DYCTEA** ("Doctrina y Criterios de los Tribunales Económico-Administrativos"), the official database of the Spanish Ministry of Hacienda at `serviciostelematicosext.hacienda.gob.es/TEAC/DYCTEA/`. It covers the central tribunal (TEAC) and all regional tribunals (TEAR). No login, no browser: plain HTTP, fast and cheap.

### What it collects

For every criterion you get structured fields:

- resolution number, criterion number (and how many criteria the resolution has), date, tribunal / unit
- legal status (`Doctrina`, `No vinculante`, ...)
- subject line (`asunto`) and the full criterion text
- legal references (norm + cited articles) and tax concepts
- link to the criterion page and to the full resolution text
- optionally the **full text of the resolution** itself

### Input

| Field | Description | Default |
| --- | --- | --- |
| `searchText` | Words that must all appear (e.g. `operaciones vinculadas`). Empty = most recent criteria | `operaciones vinculadas` |
| `exactPhrase` | Exact phrase, e.g. `cláusula antiabuso` | — |
| `searchIn` | `criterios`, `resoluciones` (full text of resolutions) or `ambos` | `criterios` |
| `criterioType` | `0` binding, `1` non-binding, `2` all | `2` |
| `unidad` | Tribunal code: `00` TEAC, `28` TEAR Madrid, `24` Cataluña, `12` Andalucía... | all |
| `dateFrom` / `dateTo` | Resolution date range, `DD/MM/YYYY` | — |
| `reclamacionSede`, `reclamacionNumero`, `reclamacionAno` | Look up one claim number | — |
| `fetchDetails` | Open each criterion card for full text, status, references, concepts | `true` |
| `includeResolutionText` | Also download the whole resolution text (large) | `false` |
| `maxResults` | Maximum records to collect | `50` |
| `proxyConfiguration` | Optional Apify proxy; the site works without one | no proxy |

The site shows at most 100 hits per query. When `maxResults` is above 100 the actor splits the date range automatically so you can still collect thousands of criteria.

Example input:

```json
{
  "searchText": "operaciones vinculadas",
  "searchIn": "criterios",
  "unidad": "00",
  "dateFrom": "01/01/2023",
  "maxResults": 100
}
```

### Example output

```json
{
  "id": "00/00417/2023/00/0/1",
  "title": "Criterio 1 de la resolución 00/00417/2023/00/00 del 08/10/2026 - TEAC",
  "url": "https://serviciostelematicosext.hacienda.gob.es/TEAC/DYCTEA/criterio.aspx?id=00/00417/2023/00/0/1",
  "numeroResolucion": "00/00417/2023/00/00",
  "criterioNum": 1,
  "criterioTotal": 3,
  "calificacion": "No vinculante",
  "unidad": "TEAC",
  "fecha": "08/10/2026",
  "fechaIso": "2026-10-08",
  "asunto": "IRPF. Régimen FEAC. Inaplicación del régimen FEAC, total o parcial, ...",
  "criterio": "Esta cláusula antiabuso sólo permite eliminar, total o parcialmente, ...",
  "referenciasNormativas": [
    {"norma": "Ley 27/2014 Impuesto sobre Sociedades", "preceptos": ["21", "89.2"]}
  ],
  "conceptos": ["Cláusula antiabuso", "Impuesto sobre la Renta de las Personas Físicas IRPF"],
  "textoResolucionUrl": "https://serviciostelematicosext.hacienda.gob.es/TEAC/DYCTEA/textoresolucion.aspx?id=00/00417/2023/00/0/1",
  "scrapedAt": "2026-10-26T12:00:00+00:00"
}
```

### Price

Pay per result: you are billed for each record pushed to the dataset (indicatively $0.001 per result on the free plan and $0.0005 on paid plans), with no extra charge for pages that return nothing. Set `maxResults` to cap your spend.

### Notes

- Data is public government doctrine; use it in line with the terms of the Ministry of Hacienda website.
- Free-text search is performed by the site itself, so matching follows its rules (word fragments can match).

# Actor input Schema

## `searchText` (type: `string`):

Words that must all appear in the criterion text, e.g. "operaciones vinculadas" or "retenciones". Leave empty to list the most recent criteria.

## `exactPhrase` (type: `string`):

Exact phrase to match, e.g. "cláusula antiabuso". Optional.

## `searchIn` (type: `string`):

Where the free text is looked up: the criteria summaries, the full text of the resolutions, or both.

## `criterioType` (type: `string`):

Filter by the legal effect of the criterion.

## `unidad` (type: `string`):

Tribunal code. 00 = TEAC (central), 28 = TEAR de Madrid, 24 = TEAR de Cataluña, 12 = TEAR de Andalucía, 32 = TEAR de Valencia, 31 = TEAR del País Vasco, 26 = TEAR de Galicia. Empty = all units.

## `dateFrom` (type: `string`):

Start of the resolution date range, DD/MM/YYYY.

## `dateTo` (type: `string`):

End of the resolution date range, DD/MM/YYYY.

## `reclamacionSede` (type: `string`):

Two-digit office (sede) of the claim number, e.g. 00. Optional.

## `reclamacionNumero` (type: `string`):

Claim number (up to 5 digits), e.g. 417. Optional.

## `reclamacionAno` (type: `string`):

Four-digit claim year, e.g. 2023. Optional.

## `fetchDetails` (type: `boolean`):

Open each criterion card to add the full criterion text, subject, binding status, legal references and concepts. One extra request per result.

## `includeResolutionText` (type: `boolean`):

Also download the complete text of the resolution each criterion comes from (large: usually 50-300 KB of text per record).

## `maxResults` (type: `integer`):

Maximum number of criteria to collect. The site shows at most 100 hits per query; above 100 the actor automatically splits the date range to reach more.

## `proxyConfiguration` (type: `object`):

Optional. The site is reachable directly; switch the proxy on if your IP gets blocked.

## Actor input object example

```json
{
  "searchText": "operaciones vinculadas",
  "searchIn": "criterios",
  "criterioType": "2",
  "fetchDetails": true,
  "includeResolutionText": false,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset with the scraped criteria.

# 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 = {
    "searchText": "operaciones vinculadas",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/hacienda-scraper").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 = {
    "searchText": "operaciones vinculadas",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/hacienda-scraper").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 '{
  "searchText": "operaciones vinculadas",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bovi/hacienda-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bovi/hacienda-scraper"
        }
    }
}
```

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/OinSPGcWCGcVpzcE9/builds/5izcmgDw0S8VZ9vWE/openapi.json
