{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacienda",
    "description": "Actor de Apify que automatiza la búsqueda en la Doctrina Histórica del TEAC y en el buscador DYCTEA (TEAC + TEAR) del Ministerio de Hacienda. Extrae resoluciones y criterios administrativos tributarios con soporte de extracción de texto de HTML y PDF.",
    "version": "0.0",
    "x-build-id": "BRwWxvUaJTXdR4kcK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/legaltech~hacienda/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-legaltech-hacienda",
        "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/legaltech~hacienda/runs": {
      "post": {
        "operationId": "runs-sync-legaltech-hacienda",
        "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/legaltech~hacienda/run-sync": {
      "post": {
        "operationId": "run-sync-legaltech-hacienda",
        "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": {
          "source": {
            "title": "Fuente",
            "enum": [
              "DYCTEA_DGT",
              "DYCTEA",
              "DGT",
              "AMBOS",
              "TEAC_HISTORICA"
            ],
            "type": "string",
            "description": "Sistema(s) en los que buscar. AVISO: TEAC Histórica (serviciostelematicosext.hacienda.gob.es/TEAC/DoctrinaHistoricaTEAC) está actualmente deshabilitada/no disponible. Usa DYCTEA_DGT como opción por defecto para obtener resultados fiables.",
            "default": "DYCTEA_DGT"
          },
          "searchText": {
            "title": "Texto de búsqueda",
            "type": "string",
            "description": "Texto libre. En TEAC Histórica se envía como Texto1; en DYCTEA como parámetro 'p'."
          },
          "fechaInicio": {
            "title": "Fecha inicio",
            "type": "string",
            "description": "Fecha de inicio en formato DD/MM/YYYY. Aplica a ambas fuentes."
          },
          "fechaFin": {
            "title": "Fecha fin",
            "type": "string",
            "description": "Fecha de fin en formato DD/MM/YYYY. Aplica a ambas fuentes."
          },
          "numRecla": {
            "title": "Número de reclamación",
            "type": "string",
            "description": "Número de la reclamación (p.ej. '4976'). Aplica a ambas fuentes."
          },
          "anoRecla": {
            "title": "Año de reclamación",
            "type": "string",
            "description": "Año de la reclamación (p.ej. '2023'). Aplica a ambas fuentes."
          },
          "fetchDetails": {
            "title": "Obtener texto completo",
            "type": "boolean",
            "description": "Si se activa, se accede al detalle de cada resolución/criterio para obtener el texto íntegro. Aumenta el tiempo de ejecución.",
            "default": false
          },
          "nivel1": {
            "title": "[TEAC Histórica] Concepto - Nivel 1",
            "type": "string",
            "description": "Código de concepto nivel 1. 'XX'=todos. Ej: '01'=IRPF, '02'=IS, '03'=IVA, '04'=Impuestos Patrimoniales, '05'=Tráfico Exterior, '06'=II.EE., '07'=Otros tributos, '08'=Procedimientos de Gestión, '09'=Procedimiento Económico-Administrativo, '10'=LGT, '11'=Clases Pasivas.",
            "default": "XX"
          },
          "nivel2": {
            "title": "[TEAC Histórica] Concepto - Nivel 2",
            "type": "string",
            "description": "Código de concepto nivel 2. 'XX'=todos.",
            "default": "XX"
          },
          "nivel3": {
            "title": "[TEAC Histórica] Concepto - Nivel 3",
            "type": "string",
            "description": "Código de concepto nivel 3. 'XX'=todos.",
            "default": "XX"
          },
          "sede": {
            "title": "[TEAC Histórica] Sede",
            "type": "string",
            "description": "Código de sede para TEAC Histórica. '00'=todas.",
            "default": "00"
          },
          "uniResol": {
            "title": "[TEAC Histórica] Unidad resolutoria",
            "type": "string",
            "description": "Código de Vocalía para TEAC Histórica. 'XX'=todas.",
            "default": "XX"
          },
          "dycteaUnidad": {
            "title": "[DYCTEA] Unidad resolutoria",
            "type": "string",
            "description": "Código de unidad para DYCTEA. Vacío=todas. Ej: '00'=TEAC, '12'=TEAR Andalucía, '28'=TEAR Madrid, '24'=TEAR Cataluña, '32'=TEAR Valencia.",
            "default": ""
          },
          "dycteaCriterio": {
            "title": "[DYCTEA] Tipo de criterio",
            "enum": [
              "0",
              "1",
              "2"
            ],
            "type": "string",
            "description": "Filtra por tipo de criterio en DYCTEA.",
            "default": "2"
          },
          "dycteaNorma": {
            "title": "[DYCTEA] Norma",
            "type": "string",
            "description": "Código de norma jurídica para DYCTEA (p.ej. '08:02:00:00:00' para el Código Civil). Vacío=todas.",
            "default": ""
          },
          "dycteaSede": {
            "title": "[DYCTEA] Sede de reclamación",
            "type": "string",
            "description": "Código de sede de la reclamación en DYCTEA (máx. 2 caracteres). Vacío=no filtrar.",
            "default": ""
          },
          "dycteaConcepto1": {
            "title": "[DYCTEA] Concepto nivel 1",
            "type": "string",
            "description": "Código de concepto nivel 1 para DYCTEA. Vacío=todos.",
            "default": ""
          },
          "dycteaConcepto2": {
            "title": "[DYCTEA] Concepto nivel 2",
            "type": "string",
            "description": "Código de concepto nivel 2 para DYCTEA. Vacío=todos.",
            "default": ""
          },
          "dycteaConcepto3": {
            "title": "[DYCTEA] Concepto nivel 3",
            "type": "string",
            "description": "Código de concepto nivel 3 para DYCTEA. Vacío=todos.",
            "default": ""
          },
          "dycteaMaxPages": {
            "title": "[DYCTEA] Máximo de páginas",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Número máximo de páginas de resultados de DYCTEA a recuperar (10 criterios/página).",
            "default": 5
          },
          "dycteaPlaywright": {
            "title": "[DYCTEA] Usar navegador si HTTP falla",
            "type": "boolean",
            "description": "Si se activa, usa el navegador (Playwright) como alternativa cuando la búsqueda HTTP de DYCTEA no devuelve resultados o falla. Más lento pero puede recuperar resultados si la página requiere JavaScript. Por defecto desactivado.",
            "default": false
          },
          "dycteaSearchResoluciones": {
            "title": "[DYCTEA] Buscar también en texto de resoluciones",
            "type": "boolean",
            "description": "Si se activa (por defecto), el texto libre se busca tanto en criterios como en el cuerpo de las resoluciones (parámetro tr=1). Desactívalo para limitar la búsqueda solo al texto del criterio.",
            "default": true
          },
          "dgtNumConsulta": {
            "title": "[DGT] Nº de consulta",
            "type": "string",
            "description": "Número de consulta DGT (p.ej. 'V0001-24' o '0237-05'). Vacío = no filtrar.",
            "default": ""
          },
          "dgtNormativa": {
            "title": "[DGT] Normativa",
            "type": "string",
            "description": "Texto de normativa para filtrar. Vacío = no filtrar.",
            "default": ""
          },
          "dgtCuestionPlanteada": {
            "title": "[DGT] Cuestión planteada",
            "type": "string",
            "description": "Palabras clave en la cuestión planteada. Vacío = no filtrar.",
            "default": ""
          },
          "dgtDescripcionHechos": {
            "title": "[DGT] Descripción de hechos",
            "type": "string",
            "description": "Palabras clave en la descripción de hechos. Vacío = no filtrar.",
            "default": ""
          },
          "dgtCriterioInteres": {
            "title": "[DGT] Solo criterio de interés",
            "type": "boolean",
            "description": "Si se activa, filtra únicamente consultas marcadas como criterio de interés (disponibles a partir de 01/01/2022).",
            "default": false
          },
          "dgtOrderBy": {
            "title": "[DGT] Ordenar por",
            "enum": [
              "NUM-CONSULTA",
              "ORGANO",
              "FECHA-SALIDA"
            ],
            "type": "string",
            "description": "Campo de ordenación de los resultados DGT.",
            "default": "NUM-CONSULTA"
          },
          "dgtOrderDir": {
            "title": "[DGT] Dirección de ordenación",
            "enum": [
              "0",
              "1"
            ],
            "type": "string",
            "description": "Dirección de ordenación de los resultados DGT.",
            "default": "0"
          },
          "dgtMaxPages": {
            "title": "[DGT] Máximo de páginas",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Número máximo de páginas de resultados DGT a recuperar (20 consultas/página).",
            "default": 5
          },
          "dgtMaxResults": {
            "title": "[DGT] Máximo de resultados",
            "minimum": 0,
            "type": "integer",
            "description": "Detiene la paginación DGT en cuanto se alcanzan este número de consultas. 0 = sin límite.",
            "default": 0
          },
          "dycteaMaxResults": {
            "title": "[DYCTEA] Máximo de resultados",
            "minimum": 0,
            "type": "integer",
            "description": "Detiene la paginación DYCTEA en cuanto se alcanzan este número de criterios. 0 = sin límite.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}