{
  "openapi": "3.0.1",
  "info": {
    "title": "Spain Green Public Tenders Radar (PLACSP)",
    "description": "Spanish public tenders on waste, forestry, wildfire, water and street cleaning from official PLACSP open data. Licitaciones verdes con enlace oficial.",
    "version": "1.1",
    "x-build-id": "bsp39MPSCScm74d6w"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rubenpa~placsp-green-radar/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rubenpa-placsp-green-radar",
        "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/rubenpa~placsp-green-radar/runs": {
      "post": {
        "operationId": "runs-sync-rubenpa-placsp-green-radar",
        "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/rubenpa~placsp-green-radar/run-sync": {
      "post": {
        "operationId": "run-sync-rubenpa-placsp-green-radar",
        "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": {
          "categorias": {
            "title": "Sectores (categorías)",
            "type": "array",
            "description": "Sectores a buscar. Por defecto los 6 sectores verdes principales. Opcionales (desactivados por defecto): zonas verdes y jardinería, limpieza de edificios (CPV 9091/9092) y protección contra incendios de edificios (extintores, PCI).",
            "items": {
              "type": "string",
              "enum": [
                "residuos",
                "incendios",
                "forestal",
                "agua_saneamiento",
                "limpieza_viaria",
                "medio_ambiente",
                "zonas_verdes",
                "limpieza_edificios",
                "proteccion_incendios_edificios"
              ],
              "enumTitles": [
                "Residuos y economía circular",
                "Incendios forestales y emergencias",
                "Forestal y desbroce",
                "Agua y saneamiento",
                "Limpieza viaria y espacios naturales",
                "Medio ambiente general",
                "Zonas verdes y jardinería (opcional)",
                "Limpieza de edificios (opcional, no verde)",
                "Protección contra incendios de edificios (opcional, no verde)"
              ]
            },
            "default": [
              "residuos",
              "incendios",
              "forestal",
              "agua_saneamiento",
              "limpieza_viaria",
              "medio_ambiente"
            ]
          },
          "puntuacionMinima": {
            "title": "Relevancia mínima (0-100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Solo se entregan licitaciones con puntuación de relevancia igual o superior. 40 (por defecto) equilibra precisión y cobertura; 60+ solo casos muy claros.",
            "default": 40
          },
          "cpvPrefijos": {
            "title": "Prefijos CPV adicionales",
            "type": "array",
            "description": "Opcional: prefijos CPV propios que cuentan como evidencia fuerte (categoría \"personalizado\"). Los sectores seleccionados ya incluyen sus CPV.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "palabrasClave": {
            "title": "Palabras clave adicionales",
            "type": "array",
            "description": "Opcional: palabras o expresiones propias (sin tildes ni mayúsculas) que cuentan como evidencia fuerte (categoría \"personalizado\"). Los sectores ya incluyen su vocabulario.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "palabrasExcluidas": {
            "title": "Palabras a excluir",
            "type": "array",
            "description": "Se descartan las licitaciones cuyo título contenga alguna de estas palabras (por ejemplo \"colegios\" si no te interesa la limpieza de centros escolares).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "estado": {
            "title": "Estado de la licitación",
            "enum": [
              "abiertas",
              "abiertas_y_previas",
              "todas"
            ],
            "type": "string",
            "description": "\"Solo abiertas\" devuelve licitaciones en plazo (estado PUB y plazo de presentación no vencido).",
            "default": "abiertas"
          },
          "provincias": {
            "title": "Provincias",
            "type": "array",
            "description": "Nombres de provincia o isla (p. ej. \"León\", \"Valencia\", \"Las Palmas\", \"Mallorca\"). Se compara con el lugar de ejecución (NUTS) y con la jerarquía territorial del órgano de contratación. Vacío = toda España.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "nuts": {
            "title": "Códigos NUTS (prefijos)",
            "type": "array",
            "description": "Prefijos NUTS 2021 del lugar de ejecución, p. ej. \"ES41\" (Castilla y León), \"ES613\" (Córdoba). Vacío = sin filtro.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "presupuestoMin": {
            "title": "Presupuesto mínimo (€, sin IVA)",
            "minimum": 0,
            "type": "integer",
            "description": "Compara con el presupuesto base de licitación sin IVA (o, si falta, con el valor estimado). Las licitaciones sin importe se descartan si se usa este filtro, salvo que se active incluirImporteDesconocido."
          },
          "presupuestoMax": {
            "title": "Presupuesto máximo (€, sin IVA)",
            "minimum": 0,
            "type": "integer",
            "description": "Ver presupuesto mínimo."
          },
          "incluirImporteDesconocido": {
            "title": "Incluir licitaciones sin importe publicado",
            "type": "boolean",
            "description": "Por defecto no. Si hay filtro de presupuesto mínimo o máximo, las licitaciones sin importe publicado se descartan y no se cobran (pago por evento). Actívalo solo si quieres recibirlas, marcadas como importeDesconocido.",
            "default": false
          },
          "fechaDesde": {
            "title": "Actualizadas desde (AAAA-MM-DD)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Solo licitaciones publicadas o actualizadas en el feed desde esta fecha. Si se deja vacío se usa \"Días hacia atrás\". Cuanto más atrás, más páginas del feed hay que leer (cada una pesa unos 5-15 MB y la PLACSP responde despacio)."
          },
          "diasAtras": {
            "title": "Días hacia atrás (si no hay fecha)",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "Ventana de búsqueda cuando no se indica \"Actualizadas desde\".",
            "default": 7
          },
          "maxItems": {
            "title": "Máximo de licitaciones",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Límite de licitaciones a entregar (y a cobrar si el actor usa pago por evento).",
            "default": 100
          },
          "maxPaginas": {
            "title": "Máximo de páginas del feed",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Tope de seguridad de peticiones a la PLACSP en esta ejecución. Cada página contiene ~500 anuncios. Se aplica POR FEED. Si se alcanza, el actor lo avisa en el registro RUN_SUMMARY (truncated: true).",
            "default": 60
          },
          "pausaMs": {
            "title": "Pausa entre peticiones (ms)",
            "minimum": 1000,
            "maximum": 60000,
            "type": "integer",
            "description": "Pausa mínima de cortesía entre peticiones a la PLACSP (mínimo 1000 ms).",
            "default": 2000
          },
          "usarCache": {
            "title": "Usar caché de páginas archivadas",
            "type": "boolean",
            "description": "Las páginas archivadas del feed no cambian: se guardan en un Key-Value Store con nombre (placsp-feed-cache) y no se vuelven a descargar entre ejecuciones; la página inicial se revalida con ETag (HTTP 304).",
            "default": true
          },
          "usarZipMensual": {
            "title": "Usar el ZIP mensual oficial si compensa",
            "type": "boolean",
            "description": "Si hay que recorrer muchos días, el actor descarga el ZIP mensual de datos abiertos de la PLACSP (mismo contenido, comprimido ~10:1) en vez de decenas de páginas de 15 MB. Se guarda en la caché.",
            "default": true
          },
          "fuentes": {
            "title": "Conjuntos de datos oficiales",
            "type": "array",
            "description": "Feeds oficiales de datos abiertos a leer. Por defecto perfiles + plataformas agregadas (Cataluña, Madrid, Euskadi, Galicia, Andalucía, Navarra, La Rioja…). Los contratos menores son opcionales.",
            "items": {
              "type": "string",
              "enum": [
                "perfiles",
                "agregadas",
                "menores"
              ],
              "enumTitles": [
                "Perfiles alojados en la PLACSP (sindicación 643)",
                "Plataformas autonómicas agregadas (sindicación 1044)",
                "Contratos menores (sindicación 1143)"
              ]
            },
            "default": [
              "perfiles",
              "agregadas"
            ]
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}