{
  "openapi": "3.0.1",
  "info": {
    "title": "Spanish Tax Rulings Scraper (DGT Binding Consultations)",
    "description": "Search and export binding tax rulings from the Spanish Tax Directorate (DGT): full answer, facts, laws and articles cited. Monitor new rulings for advisors.",
    "version": "0.1",
    "x-build-id": "m6paAGAoyx5aS5htQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/flets_sv~dgt-consultas-vinculantes/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-flets_sv-dgt-consultas-vinculantes",
        "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/flets_sv~dgt-consultas-vinculantes/runs": {
      "post": {
        "operationId": "runs-sync-flets_sv-dgt-consultas-vinculantes",
        "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/flets_sv~dgt-consultas-vinculantes/run-sync": {
      "post": {
        "operationId": "run-sync-flets_sv-dgt-consultas-vinculantes",
        "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": {
          "textoLibre": {
            "title": "Texto libre",
            "type": "string",
            "description": "Palabras a buscar en todo el texto de la consulta. Si no pones ningun filtro se buscan los ultimos 30 dias."
          },
          "numeroConsulta": {
            "title": "Numero de consulta",
            "type": "string",
            "description": "Numero exacto, por ejemplo V1000-25. Util para localizar una consulta concreta.",
            "default": ""
          },
          "normativa": {
            "title": "Normativa",
            "type": "string",
            "description": "Texto que debe aparecer en la normativa citada, por ejemplo Ley 37/1992.",
            "default": ""
          },
          "cuestionPlanteada": {
            "title": "Cuestion planteada",
            "type": "string",
            "description": "Texto que debe aparecer en la cuestion planteada.",
            "default": ""
          },
          "descripcionHechos": {
            "title": "Descripcion de los hechos",
            "type": "string",
            "description": "Texto que debe aparecer en la descripcion de los hechos (solo consultas vinculantes).",
            "default": ""
          },
          "fechaDesde": {
            "title": "Fecha desde",
            "type": "string",
            "description": "Fecha minima de salida en formato AAAA-MM-DD.",
            "default": ""
          },
          "fechaHasta": {
            "title": "Fecha hasta",
            "type": "string",
            "description": "Fecha maxima de salida en formato AAAA-MM-DD.",
            "default": ""
          },
          "tipos": {
            "title": "Tipos de consulta",
            "uniqueItems": true,
            "type": "array",
            "description": "Que tipos buscar: vinculantes y/o generales.",
            "items": {
              "type": "string",
              "enum": [
                "vinculantes",
                "generales"
              ]
            },
            "default": [
              "vinculantes"
            ]
          },
          "soloCriterioInteres": {
            "title": "Solo criterio de interes",
            "type": "boolean",
            "description": "Si se activa, solo se devuelven las consultas marcadas por la DGT como de interes.",
            "default": false
          },
          "incluirContestacion": {
            "title": "Incluir contestacion",
            "type": "boolean",
            "description": "Descarga el texto completo de la contestacion (evento consulta). Si se desactiva solo se devuelven los datos de la lista (evento consulta-metadatos).",
            "default": true
          },
          "maxResultados": {
            "title": "Maximo de resultados",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Numero maximo de consultas que se recuperaran (1 a 5000).",
            "default": 100
          },
          "soloNuevas": {
            "title": "Solo nuevas",
            "type": "boolean",
            "description": "Si se activa, solo se emiten las consultas no vistas en ejecuciones anteriores.",
            "default": false
          },
          "diasRetencion": {
            "title": "Dias de retencion",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Dias que se recuerdan las consultas ya vistas antes de olvidarlas.",
            "default": 365
          },
          "pausaMs": {
            "title": "Pausa entre peticiones",
            "minimum": 500,
            "maximum": 10000,
            "type": "integer",
            "description": "Milisegundos de espera entre peticiones al buscador (500 a 10000), para ser respetuosos con el servidor.",
            "default": 1000
          },
          "resumenIA": {
            "title": "Resumen con IA",
            "type": "boolean",
            "description": "Anade un resumen a cada consulta. Opcional, desactivado por defecto y solo funciona si el Actor tiene IA configurada.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}