Spain Tax Rulings Scraper (DGT Consultas Vinculantes) avatar

Spain Tax Rulings Scraper (DGT Consultas Vinculantes)

Pricing

from $1.40 / 1,000 result items

Go to Apify Store
Spain Tax Rulings Scraper (DGT Consultas Vinculantes)

Spain Tax Rulings Scraper (DGT Consultas Vinculantes)

Searches the public database of Spanish tax rulings (Consultas Tributarias of the Direccion General de Tributos, binding and general, 1997 onwards) and returns ruling number, date, issuing body, legislation, facts, question and full answer. Unofficial tool, not affiliated with Hacienda or the DGT.

Pricing

from $1.40 / 1,000 result items

Rating

0.0

(0)

Developer

Gonzalo Fajardo

Gonzalo Fajardo

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Share

Unofficial tool. It is not affiliated with, endorsed by or connected to the Ministerio de Hacienda or the Dirección General de Tributos (DGT).

What it does

The Dirección General de Tributos publishes its written replies to taxpayers' questions ("Consultas Tributarias", 1997 onwards) in a public search application. This Actor searches that database with your search terms and returns one dataset item per ruling, including the full text of the answer. Binding rulings (consultas vinculantes, numbers such as V5460-26) and general rulings (consultas generales, numbers such as 0018-23) are both supported. Useful for tax advisers, legal-tech teams, researchers and anyone building a Spanish tax knowledge base (Spanish keywords: consultas tributarias, doctrina administrativa, IRPF, IVA, Impuesto sobre Sociedades, criptomonedas, vivienda habitual).

Fields returned per ruling:

  • rulingNumber: number as published (for example V5460-26)
  • rulingType: binding or general
  • date: date of issue ("Fecha salida") as yyyy-mm-dd
  • issuingBody: the DGT unit that issued the reply ("Órgano")
  • legislation: legislation cited ("Normativa"), one reference per line
  • facts: description of the facts ("Descripción de hechos")
  • question: question put to the administration ("Cuestión planteada")
  • answer: full answer ("Contestación completa"), paragraphs separated by line breaks
  • url: link that opens the ruling in the official search application
  • scrapedAt: UTC time of scraping

Fields the site does not provide are left null, never guessed. General rulings have no separate facts field (the facts are part of the answer text), so facts is null for them, and some rulings cite no legislation. E-mail addresses, should the text contain any, are replaced by [email removed]. The site does not publish a ruling's subject tags, so none are returned.

How to run it

  1. Open the Actor and keep the prefilled input: search term vivienda habitual, ruling type binding, maxItems 10.
  2. Click Start. The run opens the search application, runs the search and reads each ruling one at a time.
  3. When the run has finished, open the Output tab for the table or download the dataset as JSON, CSV or Excel.
  4. To search for something else, replace the search term. Add several terms to run several searches in one run; a ruling found twice is returned once.
  5. To narrow by period, fill dateFrom and/or dateTo (yyyy-mm-dd). With only dateFrom the end is today; with only dateTo the start is 1997-01-01.

How much does it cost to scrape the DGT tax rulings database?

The Actor uses pay-per-event pricing: 0.002 USD per ruling (one result event per dataset item). 1,000 rulings cost 2 USD, 100 rulings cost 0.20 USD. The site is slow and is read politely (one request at a time, at least one second apart, one extra request per ruling), so expect roughly 2 to 9 seconds per ruling: the prefill of 10 rulings took 17 to 94 seconds in local runs, and 30 rulings took 265 seconds in one local run.

Input example

{
"queries": ["criptomonedas"],
"rulingTypes": ["binding", "general"],
"dateFrom": "2023-01-01",
"dateTo": "2025-12-31",
"maxItems": 30
}
  • queries: search terms sent to the site's free-text field (Spanish works best). A search with no hits ends successfully with an empty dataset.
  • rulingTypes: binding, general or both (default both; binding rulings come first).
  • dateFrom, dateTo: optional date range on the issue date.
  • maxItems: total cap across all terms and types (default 50, prefill 10).

Output example

Three items from a local run with the prefill (long texts shortened here with "..."; the dataset holds the full text):

[
{
"rulingNumber": "V5487-26",
"rulingType": "binding",
"date": "2026-08-18",
"issuingBody": "SG de Impuestos sobre las Personas Jurídicas",
"legislation": "Ley 27/2014 Impuesto sobre Sociedades - 10 - 11\nLey 37/1992 Impuesto sobre el Valor Añadido IVA - 5 - 7 - 8 - 11 - 20 - 78",
"facts": "La consultante es una entidad mercantil que es propietaria de una finca rústica en la que existen unas edificaciones destinadas a la explotación ganadera (granj...",
"question": "Tratamiento fiscal de las cantidades pagadas en concepto de alquiler y la cantidad entregada en concepto de a cuenta de la compra para el arrendador a efectos d...",
"answer": "IMPUESTO SOBRE SOCIEDADES\nEl artículo 10.3 de la Ley 27/2014, de 27 de noviembre, del Impuesto sobre Sociedades (en adelante, LIS) establece que:\n“3. En el méto...",
"url": "https://petete.tributos.hacienda.gob.es/consultas/?num_consulta=V5487-26",
"scrapedAt": "2026-10-05T12:40:08Z"
},
{
"rulingNumber": "V5462-26",
"rulingType": "binding",
"date": "2026-08-11",
"issuingBody": "SG de Impuestos sobre el Consumo",
"legislation": "Ley 37/1992 Impuesto sobre el Valor Añadido IVA - 20.1.20",
"facts": "La consultante es una entidad mercantil que se dedica a la actividad inmobiliaria que adquirió un solar y lo segregó en tres solares (de 150 metros cuadrados ca...",
"question": "Tipo del Impuesto sobre el Valor Añadido aplicable a la transmisión de la referida vivienda.",
"answer": "1.- El artículo 4, apartado uno de la Ley 37/1992, de 28 de diciembre, del Impuesto sobre el Valor Añadido (BOE de 29 de diciembre), establece que \"estarán suje...",
"url": "https://petete.tributos.hacienda.gob.es/consultas/?num_consulta=V5462-26",
"scrapedAt": "2026-10-05T12:40:08Z"
},
{
"rulingNumber": "V5460-26",
"rulingType": "binding",
"date": "2026-08-11",
"issuingBody": "SG de Impuestos sobre el Consumo",
"legislation": "Ley 37/1992 Impuesto sobre el Valor Añadido IVA - 91",
"facts": "La consultante, persona física, va a arrendar un local a una psicóloga para dedicarlo a su actividad.",
"question": "A efectos del Impuesto sobre el Valor Añadido, se cuestiona la tributación de la operación",
"answer": "1.- El artículo 4, apartado uno de la Ley 37/1992, de 28 de diciembre, del Impuesto sobre el Valor Añadido (BOE de 29 de diciembre), establece que “estarán suje...",
"url": "https://petete.tributos.hacienda.gob.es/consultas/?num_consulta=V5460-26",
"scrapedAt": "2026-10-05T12:40:09Z"
}
]

Limitations and the free plan

  • Only the public search application at petete.tributos.hacienda.gob.es is read; no login, no captcha, no proxies. Before anything else the Actor reads the site's robots.txt and obeys it. If robots.txt cannot be read (for example the host answers 5xx), the run stops with a clear status message instead of scraping.
  • The site is sometimes slow or answers 502/503. Failed requests are retried three times (after 5, 15 and 30 seconds); a ruling that still fails is skipped and logged. If no search can be completed at all, the run fails.
  • The site returns 20 rulings per results page; the Actor pages through the results until maxItems. The site can refuse a search it considers too slow (it has an HTTP 408 message for that); the run then reports it and you can narrow the date range.
  • The search is the site's own: its relevance, stop-word and phrase rules apply, and results are ordered newest first. The site's "criterio de interés" flag and rulings' internal ids are not returned.
  • The text is the Administration's reply as published. This Actor does not give tax advice, and a ruling binds the tax authorities only with respect to the person who asked.
  • Free plan: the prefill (10 rulings) is billed as 10 result events, 0.02 USD; larger runs scale linearly in cost and in time (roughly 2 to 9 seconds per ruling). Use maxItems to keep a run small.

FAQ and support

Does it return the names of the people who asked? No. The rulings are published anonymised ("el consultante"); the Actor reads only the fields listed above, and replaces e-mail addresses should the text contain one.

Why is facts empty for some rulings? General rulings do not have a separate "Descripción de hechos" field on the site.

Can I get the rulings of one year? Yes: set dateFrom and dateTo, with a search term or with queries left empty.

Something is wrong or a field is missing. Please report it in the Issues tab of this Actor on Apify, with the input you used.