{
  "openapi": "3.0.1",
  "info": {
    "title": "France Town Natural Risks: CatNat Disasters & Risk Plans",
    "description": "Official Géorisques GASPAR open data for every French town: natural disaster (CatNat) declarations since 1982, exposed risks (flood, clay subsidence, earthquake, forest fire, radon, industrial…) and risk prevention plans (PPRN, PPRT). Pay per town.",
    "version": "1.0",
    "x-build-id": "CIQVCqnqv91Euyw3i"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datacraft-studio~france-town-natural-risks/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datacraft-studio-france-town-natural-risks",
        "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/datacraft-studio~france-town-natural-risks/runs": {
      "post": {
        "operationId": "runs-sync-datacraft-studio-france-town-natural-risks",
        "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/datacraft-studio~france-town-natural-risks/run-sync": {
      "post": {
        "operationId": "run-sync-datacraft-studio-france-town-natural-risks",
        "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": {
          "communeCodes": {
            "title": "Town INSEE codes",
            "type": "array",
            "description": "Official INSEE town codes, e.g. 69123 (Lyon). Old codes of merged towns and Paris/Lyon/Marseille districts are mapped to the current town.",
            "items": {
              "type": "string"
            }
          },
          "postalCodes": {
            "title": "Postal codes",
            "type": "array",
            "description": "5-digit postal codes, resolved to towns with geo.api.gouv.fr.",
            "items": {
              "type": "string"
            }
          },
          "departments": {
            "title": "Departments",
            "type": "array",
            "description": "Department codes (e.g. 69, 2A, 974). Returns all their towns. Ignored when town codes or postal codes are given.",
            "items": {
              "type": "string"
            }
          },
          "epciCodes": {
            "title": "Intercommunalities (EPCI SIREN)",
            "type": "array",
            "description": "9-digit EPCI SIREN codes, e.g. 200046977 (Métropole de Lyon). Ignored when town codes or postal codes are given.",
            "items": {
              "type": "string"
            }
          },
          "risks": {
            "title": "Required risks",
            "type": "array",
            "description": "Keep only towns exposed to these risks (official departmental risk list, DDRM).",
            "items": {
              "type": "string",
              "enum": [
                "flood",
                "riverFlood",
                "runoffMudflow",
                "groundwaterFlood",
                "coastalFlood",
                "groundMovement",
                "clayShrinkSwell",
                "cavities",
                "landslideRockfall",
                "coastalErosion",
                "earthquake",
                "avalanche",
                "volcano",
                "forestFire",
                "extremeWeather",
                "radon",
                "industrial",
                "nuclear",
                "damFailure",
                "dangerousGoodsTransport",
                "warExplosives",
                "mining"
              ],
              "enumTitles": [
                "Flood (any type)",
                "River flood",
                "Runoff and mudflow",
                "Groundwater flooding",
                "Coastal submersion",
                "Ground movement (any type)",
                "Clay shrink-swell (subsidence)",
                "Underground cavities / collapse",
                "Landslide or rockfall",
                "Coastal and cliff erosion",
                "Earthquake",
                "Avalanche",
                "Volcanic eruption",
                "Forest fire",
                "Extreme weather",
                "Radon",
                "Industrial risk",
                "Nuclear",
                "Dam failure",
                "Dangerous goods transport",
                "Unexploded war ordnance",
                "Mining risk"
              ]
            }
          },
          "riskMatch": {
            "title": "Risk match",
            "enum": [
              "all",
              "any"
            ],
            "type": "string",
            "description": "How the required risks are combined.",
            "default": "all"
          },
          "catnatTypes": {
            "title": "CatNat types counted",
            "type": "array",
            "description": "Disaster types counted for the minimum CatNat filter (empty = all types).",
            "items": {
              "type": "string",
              "enum": [
                "flood",
                "drought",
                "groundMovement",
                "storm",
                "coastal",
                "earthquake",
                "other"
              ],
              "enumTitles": [
                "Flood / mudflow",
                "Drought (clay subsidence)",
                "Ground movement",
                "Storm / cyclone",
                "Coastal (waves, tidal)",
                "Earthquake",
                "Other (snow, hail, avalanche…)"
              ]
            }
          },
          "catnatSinceYear": {
            "title": "Count CatNat since year",
            "minimum": 1982,
            "type": "integer",
            "description": "Only count disaster declarations whose event started this year or later (for the filter and the catnatSinceCount field)."
          },
          "minCatnat": {
            "title": "Minimum CatNat declarations",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only towns with at least this many declarations (using the types and year above)."
          },
          "onlyWithActivePprn": {
            "title": "Only towns with an active natural risk plan (PPRN)",
            "type": "boolean",
            "description": "Approved or prescribed PPRN.",
            "default": false
          },
          "minPopulation": {
            "title": "Minimum population",
            "minimum": 0,
            "type": "integer",
            "description": "Municipal population (INSEE via geo.api.gouv.fr)."
          },
          "maxPopulation": {
            "title": "Maximum population",
            "minimum": 0,
            "type": "integer",
            "description": "Municipal population (INSEE via geo.api.gouv.fr)."
          },
          "includeCatnatEvents": {
            "title": "Include the list of CatNat declarations",
            "type": "boolean",
            "description": "Adds catnatEvents (most recent first) to each town.",
            "default": false
          },
          "maxEventsPerTown": {
            "title": "Max CatNat declarations per town",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Used with the option above.",
            "default": 50
          },
          "includePlans": {
            "title": "Include the list of risk plans",
            "type": "boolean",
            "description": "Adds plans: every PPRN, PPRT and PPRM procedure with status and dates.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "catnat_desc",
              "recent_catnat",
              "risks_desc",
              "population_desc",
              "code"
            ],
            "type": "string",
            "description": "Order of the towns.",
            "default": "catnat_desc"
          },
          "maxItems": {
            "title": "Max towns",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of towns delivered (and charged).",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}