{
  "openapi": "3.0.1",
  "info": {
    "title": "NL Waterstanden & Watertemperatuur Monitor",
    "description": "Real-time water levels, water temperature and other Rijkswaterstaat measurements for Dutch waterways. Filters out decades-old zombie readings and flags stations whose feed has gone stale.",
    "version": "0.1",
    "x-build-id": "nDAmsd2945VPghMje"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/codeclouds~nl-waterstanden-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-codeclouds-nl-waterstanden-monitor",
        "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/codeclouds~nl-waterstanden-monitor/runs": {
      "post": {
        "operationId": "runs-sync-codeclouds-nl-waterstanden-monitor",
        "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/codeclouds~nl-waterstanden-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-codeclouds-nl-waterstanden-monitor",
        "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": {
          "locationCodes": {
            "title": "Location codes",
            "type": "array",
            "description": "Exact RWS location codes to fetch, e.g. \"hoekvanholland\". Skips the name search entirely. Leave empty to search by name/query instead.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Name search",
            "type": "string",
            "description": "Case-insensitive text match against the location name, e.g. \"Rotterdam\" or \"IJssel\". Ignored if Location codes is set. Leave empty to browse all locations."
          },
          "grootheden": {
            "title": "Parameters to fetch",
            "type": "array",
            "description": "RWS \"Grootheid\" codes to fetch per location. Common ones: WATHTE (water level), T (temperature), WINDSHD (wind speed), WINDRTG (wind direction), SALNTT (salinity), ZICHT (visibility).",
            "default": [
              "WATHTE"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxLocations": {
            "title": "Max locations",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Caps how many locations are queried per run (1-500).",
            "default": 25
          },
          "staleAfterMinutes": {
            "title": "Stale after (minutes)",
            "minimum": 1,
            "maximum": 1440,
            "type": "integer",
            "description": "A location+parameter reading older than this is flagged \"stale\" instead of reported as current -- useful for detecting a station whose feed has gone offline.",
            "default": 120
          },
          "alertThresholds": {
            "title": "Value threshold alerts",
            "type": "array",
            "description": "Optional: alert when a fresh reading itself crosses a threshold (not just its age). Each item: { \"grootheid\": \"WATHTE\", \"drempel\": 250, \"richting\": \"boven\" }. \"boven\" alerts when value >= drempel (e.g. high water), \"onder\" when value <= drempel (e.g. low water, or a minimum swim temperature).",
            "items": {
              "type": "object",
              "properties": {
                "grootheid": {
                  "title": "Grootheid code",
                  "type": "string",
                  "description": "Grootheid code this threshold applies to, e.g. \"WATHTE\" or \"T\"."
                },
                "drempel": {
                  "title": "Threshold value",
                  "type": "number",
                  "description": "Threshold value to compare the fresh reading against."
                },
                "richting": {
                  "title": "Direction",
                  "type": "string",
                  "enum": [
                    "boven",
                    "onder"
                  ],
                  "description": "\"boven\" alerts when value >= drempel, \"onder\" when value <= drempel."
                }
              },
              "required": [
                "grootheid",
                "drempel",
                "richting"
              ]
            },
            "default": []
          },
          "includeAirTemperature": {
            "title": "Include air temperature alongside water temperature",
            "type": "boolean",
            "description": "When grootheid \"T\" is requested: by default only the water variant (OW) is returned and the air variant (LT) is filtered out. Enable to get both variants, plus a temperatureDifference field (water minus air) on each.",
            "default": false
          },
          "refreshCatalog": {
            "title": "Force a fresh metadata catalog",
            "type": "boolean",
            "description": "The RWS metadata catalog (all locations + parameters/units/compartments) is cached in the key-value store for 24 hours instead of being fully re-fetched every run. Enable to bypass the cache and force a fresh catalog (e.g. after an RWS change).",
            "default": false
          },
          "trackTrend": {
            "title": "Track trend between runs",
            "type": "boolean",
            "description": "Compares each fresh reading against the previous run (via the actor's key-value store) and flags a trend (rising/falling/unchanged) plus delta. New charged event trend-signaal ($0.01), only when a reading is actually flagged rising or falling. On the very first call (no previous snapshot yet) no location+parameter combination has a known prior value, so nothing is flagged/charged; the current fresh values are simply saved as the baseline. Uses a shared, persistent key-value store that scheduled monitoring runs also read/write, so an ad-hoc call in between can shift the baseline seen by the next scheduled run.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}