{
  "openapi": "3.0.1",
  "info": {
    "title": "Spain De Minimis & State Aid Scraper (BDNS)",
    "description": "Ayudas de minimis y ayudas de estado notificadas a la UE desde la Base de Datos Nacional de Subvenciones (BDNS/SNPSAP). Spanish de minimis and notified state aid grants, by beneficiary NIF, for due diligence.",
    "version": "0.1",
    "x-build-id": "OyMhi3A5Fppc4kpeO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xamto1987~spain-de-minimis-aid/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xamto1987-spain-de-minimis-aid",
        "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/xamto1987~spain-de-minimis-aid/runs": {
      "post": {
        "operationId": "runs-sync-xamto1987-spain-de-minimis-aid",
        "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/xamto1987~spain-de-minimis-aid/run-sync": {
      "post": {
        "operationId": "run-sync-xamto1987-spain-de-minimis-aid",
        "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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Modo / Mode",
            "enum": [
              "minimis",
              "ayudas_estado"
            ],
            "type": "string",
            "description": "Que registro se extrae. `minimis` = ayudas de minimis (Reg. UE 2023/2831 y anteriores), el instrumento mas comun para pymes. `ayudas_estado` = ayudas de estado notificadas a la Comision Europea (incluye numero de caso SA.xxxxx). / Which register to scrape.",
            "default": "minimis"
          },
          "nifs": {
            "title": "NIF/CIF de beneficiarios / Beneficiary tax IDs",
            "type": "array",
            "description": "Lista de NIF/CIF a buscar (p. ej. \"B12345678\"). IMPORTANTE: la API oficial de BDNS no permite filtrar por NIF en el servidor, asi que el filtro se aplica EN CLIENTE recorriendo paginas recientes (ver \"maxPaginasEscaneadas\"). Combinalo con \"keywords\" o \"fechaDesde\" para acotar mejor. Vacio = sin filtro por beneficiario. / Server-side NIF filtering is not supported by BDNS; this is a bounded client-side scan.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Palabras clave / Keywords",
            "type": "array",
            "description": "Lista de terminos a buscar en el titulo de la convocatoria de origen. Una busqueda por termino, resultados deduplicados; cada termino se busca por TODAS sus palabras. Vacio = sin filtro de texto. / One search per term; empty = no text filter.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "fechaDesde": {
            "title": "Fecha desde / Date from",
            "type": "string",
            "description": "Solo concesiones con fecha de concesion a partir de esta fecha. Formato ISO `AAAA-MM-DD`. Recomendado para ejecuciones incrementales diarias y para acotar busquedas por NIF. / ISO date; recommended for incremental runs and to bound NIF scans."
          },
          "maxItems": {
            "title": "Maximo de resultados / Max items",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Numero maximo de items a guardar en el dataset. El actor para limpiamente al alcanzarlo. / Hard cap on dataset items.",
            "default": 200
          },
          "maxPaginasEscaneadas": {
            "title": "Paginas a escanear (solo con NIF) / Pages to scan (NIF search only)",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Solo aplica cuando usas \"nifs\" sin \"keywords\": tope de paginas (100 filas cada una) que el actor recorre buscando coincidencias antes de rendirse, para no escanear el pool completo (millones de filas). Subelo si tu beneficiario tiene poca actividad reciente. / Only relevant for NIF search without keywords: bounds the client-side scan.",
            "default": 50
          },
          "includePersonalData": {
            "title": "Incluir beneficiarios persona fisica / Include individual beneficiaries",
            "type": "boolean",
            "description": "DESACTIVADO POR DEFECTO. Con esta opcion desactivada se excluyen los beneficiarios que son personas fisicas (DNI/NIE, o NIF enmascarado por la propia fuente) y el dataset contiene unicamente empresas, entidades y administraciones. En una muestra de 100 filas verificada en fase 5, un 32-42% de los beneficiarios de minimis/ayudas de estado eran personas fisicas enmascaradas. Activarlo hace que el dataset incluya datos personales: su tratamiento posterior es responsabilidad tuya (RGPD / LOPDGDD). / OFF by default: individual (natural person) beneficiaries are excluded.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}