{
  "openapi": "3.0.1",
  "info": {
    "title": "Consultas vinculantes de la DGT con texto completo",
    "description": "Consultas vinculantes de la Dirección General de Tributos con la contestación completa, fecha y normativa citada. Busque por palabras, número, impuesto (IRPF, IVA, Sociedades) o artículo, y reciba solo las nuevas con el modo monitor. Para asesores fiscales y despachos. No oficial.",
    "version": "1.0",
    "x-build-id": "CQC6D7r00GPtewE7O"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/opendata-cr~consultas-dgt/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-opendata-cr-consultas-dgt",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/opendata-cr~consultas-dgt/runs": {
      "post": {
        "operationId": "runs-sync-opendata-cr-consultas-dgt",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/opendata-cr~consultas-dgt/run-sync": {
      "post": {
        "operationId": "run-sync-opendata-cr-consultas-dgt",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "keywords": {
            "title": "Palabras clave / Keywords",
            "type": "array",
            "description": "Texto a buscar. Las palabras de una misma línea deben aparecer todas, en cualquier orden. Para una frase exacta, escríbala entre comillas, por ejemplo \"vivienda habitual\". No distingue mayúsculas ni tildes. Admite los operadores del buscador oficial: .Y, .O, .NO, * (cualquier terminación) y ? (un carácter). Words on one line must all appear; use quotes for an exact phrase.",
            "items": {
              "type": "string"
            }
          },
          "keywordsMatch": {
            "title": "Coincidencia de palabras clave / Keyword match",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "Todas: cada línea debe aparecer. Alguna: basta con una línea. All lines, or at least one.",
            "default": "all"
          },
          "keywordsField": {
            "title": "Buscar las palabras en / Search keywords in",
            "enum": [
              "textoLibre",
              "cuestion",
              "hechos"
            ],
            "type": "string",
            "description": "Texto libre busca en toda la consulta, incluida la contestación. También puede limitar la búsqueda a la cuestión planteada o a la descripción de hechos. Free text searches the whole ruling, including the answer.",
            "default": "textoLibre"
          },
          "consultaNumbers": {
            "title": "Números de consulta / Ruling numbers",
            "type": "array",
            "description": "Formato Vxxxx-aa para consultas vinculantes (por ejemplo V1234-25) y xxxx-aa para generales. También se aceptan V123-25 y V0123/25. Format Vxxxx-yy.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Fecha de salida desde / Issued from",
            "type": "string",
            "description": "Fecha de salida (emisión) de la consulta, inclusive, en formato AAAA-MM-DD. Si solo indica esta fecha, el rango llega hasta hoy. Issue date, inclusive."
          },
          "dateTo": {
            "title": "Fecha de salida hasta / Issued to",
            "type": "string",
            "description": "Fin del rango, inclusive, en formato AAAA-MM-DD. End date, inclusive."
          },
          "recentDays": {
            "title": "Últimos días / Recent days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Consultas con fecha de salida en los últimos N días. Se usa cuando no indica fechas ni números de consulta. En modo monitor, si lo deja vacío, se usan 120 días. La base oficial se actualiza por lotes mensuales, con más de un mes de retraso. Issue date within the last N days."
          },
          "organos": {
            "title": "Órgano / Issuing body",
            "type": "array",
            "description": "Subdirección General que firma la consulta. Basta con que coincida uno. Escriba el nombre (por ejemplo SG de Tributos Locales) o un atajo: IRPF, IS, IVA, INTERNACIONAL (o IRNR), LOCALES, PATRIMONIALES (ITP, ISD), ESPECIALES (IIEE) o FINANCIERAS. Any of these bodies.",
            "items": {
              "type": "string"
            }
          },
          "impuestos": {
            "title": "Impuesto / Tax",
            "type": "array",
            "description": "Impuesto citado en la normativa de la consulta. Atajos: IRPF, IVA, IS, ITP, ISD, IRNR, LOCALES, IIEE, IP o LGT; cada atajo incluye las siglas y la ley principal. También puede escribir otras siglas, por ejemplo IBI o IIVTNU. Basta con que coincida uno. Tax cited in the ruling; any of them.",
            "items": {
              "type": "string"
            }
          },
          "normativa": {
            "title": "Normativa citada / Cited legislation",
            "type": "array",
            "description": "Norma citada, por ejemplo Ley 35/2006, RD 439/2007 o Ley 37/1992. Cada línea debe aparecer. Puede añadir artículos: Ley 35/2006 art. 33, 34. Con texto completo, solo se entregan y cobran las consultas que citan esos artículos de esa norma. Each line must be cited.",
            "items": {
              "type": "string"
            }
          },
          "onlyCriterioInteres": {
            "title": "Solo criterio de interés / Selected rulings only",
            "type": "boolean",
            "description": "Solo las consultas que la Dirección General de Tributos marca como criterio de interés general (desde 2022). Only rulings flagged as of general interest.",
            "default": false
          },
          "tipo": {
            "title": "Tipo de consulta / Ruling type",
            "enum": [
              "vinculantes",
              "generales",
              "ambas"
            ],
            "type": "string",
            "description": "Vinculantes (por defecto), generales o ambas. Si indica números de consulta, el tipo se deduce del número (V = vinculante). Binding rulings, general rulings or both.",
            "default": "vinculantes"
          },
          "outputMode": {
            "title": "Contenido / Content",
            "enum": [
              "fullText",
              "metadata"
            ],
            "type": "string",
            "description": "Texto completo: cada consulta con órgano, fecha, normativa y contestación completa (evento Consulta). Solo metadatos: número, hechos y cuestión planteada, mucho más rápido (evento Metadatos de consulta). Full text or metadata only.",
            "default": "fullText"
          },
          "sortOrder": {
            "title": "Orden / Order",
            "enum": [
              "newest",
              "oldest"
            ],
            "type": "string",
            "description": "Por fecha de salida: más recientes o más antiguas primero. By issue date.",
            "default": "newest"
          },
          "maxResults": {
            "title": "Máximo de resultados / Maximum results",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cantidad máxima de consultas entregadas (y cobradas) por ejecución. Si lo deja vacío, 100. Si antes se alcanza el máximo a cobrar de la ejecución, esta termina con éxito con lo ya entregado. Maximum results per run.",
            "default": 100
          },
          "onlyNewSinceLastRun": {
            "title": "Solo nuevas desde la última ejecución / Only new since last run",
            "type": "boolean",
            "description": "Entrega y cobra solo las consultas que no se entregaron antes con el mismo almacén. El inicio se cobra en cada ejecución, aunque no haya consultas nuevas. Only rulings not delivered before; the start fee applies on every run.",
            "default": false
          },
          "monitorStoreName": {
            "title": "Nombre del almacén del monitor / Monitor store name",
            "type": "string",
            "description": "Almacén (Key-Value Store) con nombre donde se guardan los números ya entregados. Use un nombre distinto para cada alerta. Letras, números y guiones. Use one name per alert.",
            "default": "consultas-dgt-monitor"
          },
          "concurrency": {
            "title": "Descargas en paralelo / Parallel downloads",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "Cuántas consultas con texto completo se descargan a la vez (1 a 4). Si la fuente responde con avisos o errores, baje a 1 o 2. / How many full-text rulings to download at once (1 to 4).",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Normalmente no hace falta. Úselo solo si las ejecuciones fallan por errores de conexión. Usually not needed.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}