# Rhine & German River Water Levels (PEGELONLINE) (`adamplaenitz/pegelonline-water-levels`) Actor

Water levels of German federal waterways from PEGELONLINE (WSV): Rhine, Elbe, Danube, Moselle and 740 gauges. Current reading with trend, low/high water state and discharge, or 30-day history. Threshold alerts for low or high water.

- **URL**: https://apify.com/adamplaenitz/pegelonline-water-levels.md
- **Developed by:** [Adam Plänitz](https://apify.com/adamplaenitz) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 station readings

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Rhine & German River Water Levels (PEGELONLINE)

**Current water levels and 30-day history of about 740 gauging stations on German federal waterways – Rhine, Elbe, Danube, Moselle, Main, Neckar, Weser, Oder, canals and coast – from PEGELONLINE as clean JSON, CSV or Excel. With trend, change over 24 hours, state relative to mean low and high water, discharge, and alert thresholds for low or high water.**

*Deutsche Kurzfassung weiter unten.*

### What does it do?

The Actor reads the **official PEGELONLINE REST API** of the German Federal Waterways and Shipping Administration (WSV) and returns:

- **Current mode** – one record per station: latest water level (gauge reading in cm), timestamp, **trend** (rising / falling / steady) with change over the last hour and the last 24 hours, **state relative to MNW/MHW** (mean low / mean high water) and to the highest navigable water level (HSW), the characteristic values NNW, MNW, MW, MHW, HHW, GlW (equivalent water level for shipping) and HSW, difference to mean water, gauge zero and absolute level above datum (m ü. NHN), current **discharge** (m³/s) where measured, and station data (number, water, river km, WSV office, coordinates).
- **History mode** – one record per measurement (usually every 15 minutes) for the last 1–30 days.
- **Alerts** – only stations (or measurements) at or above / at or below a level in cm, or only stations in state *low* or *high*.

### Who is it for?

- **Inland shipping and logistics** – watch Kaub, Duisburg-Ruhrort, Maxau or Magdeburg for low water and loading limits.
- **Commodity, energy and freight analysts** – Rhine levels drive barge freight rates and coal, oil and chemicals supply.
- **Flood monitoring, municipalities, insurers, outdoor and water sports** – high-water alerts via e-mail, Slack or webhook.
- **Data teams** – historical series for dashboards and models without writing an API client.

### How to use it

**Low-water alert for the Rhine (example):** waters `RHEIN`, *Alert: at or below* `80`, schedule every hour, integration e-mail or Slack. Only stations below 80 cm are delivered (and charged); an empty run means no alert.

**Daily table of the big Rhine gauges:** stations `KÖLN`, `KAUB`, `BONN`, `MAXAU`, `DUISBURG-RUHRORT`, schedule daily, integration Google Sheets.

**Time series:** mode *History*, stations `KAUB`, *History days* `30`.

### Input

| Field | Example | Notes |
|---|---|---|
| Stations | `KÖLN` (or `KOELN`), `KAUB`, `2730010`, `a6ee8177-107b-47dd-bcfd-30960ccc6e9c` | name, station number or UUID; `DUISBURG` also finds `DUISBURG-RUHRORT` |
| Waters | `RHEIN`, `ELBE`, `DONAU`, `MOSEL`, `MAIN`, `NECKAR`, `WESER`, `MLK` | all stations on these waters |
| All stations | `true` | about 740 stations with a water level |
| Mode | `current` / `history` | |
| History days | `7` | 1–30 |
| Include trend | `true` | current mode, one extra request per station |
| Alert: at or above / at or below (cm) | `600` / `80` | gauge reading in cm; both together work as OR |
| Only states (MNW/MHW) | `low`, `high` | current mode |
| Max items | `1000` | charged items per run |

Stations that are not found, or waters without stations, are reported as free rows with an `error` field.

### Output example (current mode, shortened)

```json
{
  "uuid": "1d26e504-7f9e-480a-b52c-5932be6549ab",
  "number": "25700100",
  "name": "KAUB",
  "water": "RHEIN",
  "km": 546.23,
  "agency": "STANDORT BINGEN",
  "latitude": 50.085438,
  "longitude": 7.764962,
  "timestamp": "2026-11-18T19:45:00+01:00",
  "value": 101,
  "unit": "cm",
  "trend": "steady",
  "change1hCm": 0,
  "change24hCm": 28,
  "stateMnwMhw": "normal",
  "stateNswHsw": "normal",
  "dataAgeMinutes": 11,
  "nnw": 25, "mnw": 65, "mw": 208, "mhw": 544, "hhw": 825, "glw": 77, "hsw": 640,
  "differenceToMwCm": -107,
  "gaugeZero": 67.669,
  "gaugeZeroUnit": "m. ü. NHN",
  "waterLevelAboveDatum": 68.679,
  "discharge": 898,
  "dischargeUnit": "m³/s",
  "stationUrl": "https://www.pegelonline.wsv.de/gast/stammdaten?pegelnr=25700100",
  "license": "Datenlizenz Deutschland – Zero – Version 2.0 (dl-de/zero-2-0)",
  "attribution": "Source: PEGELONLINE, Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV), raw data (not validated)"
}
```

History records contain the station fields plus `timestamp`, `value` and `unit` (and `alert` when thresholds are set). With thresholds, current records carry `alert: "above"` or `"below"`. A `RUN-SUMMARY` record in the key-value store lists selected stations, stations not found, alert counts and API statistics.

**State values:** `stateMnwMhw` is `low` (below MNW), `normal`, `high` (above MHW), `unknown` (no MNW/MHW defined for the station), `commented` or `out-dated`; `stateNswHsw` relates the level to the highest navigable water level (HSW).

### Pricing and speed

See the **Pricing** tab for the current price. Current readings and history measurements are charged as separate events; a history measurement costs a fraction of a station reading. Error rows are free, and with alert thresholds only matching stations are charged. A few stations take about 5 seconds, a whole river about 10 seconds, all ~740 stations with trend about 1–3 minutes (without trend about 10 seconds), and 30 days of history for one station (about 2,900 measurements) a few seconds.

### Data source, licence and privacy

- **Source:** [PEGELONLINE](https://www.pegelonline.wsv.de) of the Wasserstraßen- und Schifffahrtsverwaltung des Bundes (WSV), operated by ITZBund – [REST API v2](https://www.pegelonline.wsv.de/webservice/dokuRestapi).
- **Licence:** According to the PEGELONLINE terms of use, the data may be reused on the basis of the [Datenlizenz Deutschland – Zero – Version 2.0](https://www.govdata.de/dl-de/zero-2-0), including commercial use, without restrictions. No attribution is required; the Actor still adds `license` and `attribution` fields.
- **Raw data:** the measurements are raw data that have not been validated. The WSV and ITZBund accept no liability for correctness, completeness or timeliness. Do not use this Actor as the only basis for safety-relevant decisions (flood warnings, navigation); official warnings come from the responsible authorities and flood forecasting centres.
- A few stations outside Germany (e.g. Basel, Lobith) are shown in PEGELONLINE with data of partner authorities.
- **No personal data:** only stations and measurements; the service phone numbers in the station list are not output.
- This Actor is an independent tool and is **not affiliated with or endorsed by the WSV, the GDWS or ITZBund**.

### Limits

- Only the water level time series (`W`) is output; discharge is added to current readings where the station measures it. Water temperature, conductivity and other parameters are not included.
- PEGELONLINE keeps raw measurements for about 30 days; longer history (validated data) is available from the Federal Institute of Hydrology (BfG), not from this Actor.
- Levels are gauge readings in cm relative to the gauge zero, not water depth. Tidal gauges on the coast change by several metres per day, so their trend is usually *rising* or *falling*.
- Characteristic values (MNW, MHW …) are not defined for every station; the related fields are then empty and the state is `unknown`.

Questions or feature requests? Please open an issue in the **Issues** tab – usually answered within 1–2 working days.

***

### Deutsch (Kurzfassung)

**Aktuelle Wasserstände und 30-Tage-Verlauf von rund 740 Pegeln an Bundeswasserstraßen (Rhein, Elbe, Donau, Mosel, Main, Neckar, Weser, Oder, Kanäle, Küste) aus PEGELONLINE – mit Tendenz, Änderung in 24 Stunden, Lage zu MNW/MHW und HSW, Abfluss und Alarmschwellen für Niedrig- oder Hochwasser.**

- Auswahl über Pegelname (z. B. `KÖLN`, `KAUB`, `MAXAU`), Pegelnummer, UUID, Gewässer (`RHEIN`, `ELBE` …) oder alle Pegel.
- Modus „aktuell“ (ein Datensatz je Pegel) oder „Verlauf“ (ein Datensatz je Messwert, 1–30 Tage).
- Alarm: nur Pegel unter/über einer Schwelle in cm oder nur Zustand „low“/„high“ – ideal stündlich mit E-Mail-, Slack- oder Webhook-Integration, z. B. für Niedrigwasser am Pegel Kaub.
- Quelle: PEGELONLINE der WSV (ITZBund), Datenlizenz Deutschland – Zero – Version 2.0. Rohdaten ohne Gewähr, keine amtliche Hochwasserwarnung. Keine Verbindung zur WSV.

# Actor input Schema

## `stations` (type: `array`):

Gauging stations by name (e.g. KÖLN or KOELN, KAUB, MAXAU, DRESDEN, PASSAU DONAU), station number (e.g. 2730010) or UUID as listed on pegelonline.wsv.de. A name without suffix also finds stations starting with it (DUISBURG → DUISBURG-RUHRORT).

## `waters` (type: `array`):

All stations on these waters, e.g. RHEIN, ELBE, DONAU, MOSEL, MAIN, NECKAR, WESER, ODER, SAALE, EMS, MLK (Mittellandkanal), NORDSEE, OSTSEE.

## `allStations` (type: `boolean`):

Use all about 740 PEGELONLINE stations that measure the water level (combine with alert thresholds to get only stations above/below a level).

## `mode` (type: `string`):

current = latest reading per station with trend and state relative to mean low/high water. history = all raw measurements of the last N days (one item per measurement).

## `historyDays` (type: `integer`):

History mode: number of days back (1–30; PEGELONLINE keeps raw data for about 30 days). 1 day ≈ 96 measurements per station (15-minute steps).

## `includeTrend` (type: `boolean`):

Current mode: compute trend (rising/falling/steady) and the change over the last hour and 24 hours from the last 25 hours of data (one extra request per station).

## `alertAboveCm` (type: `integer`):

Output only stations (current mode) or measurements (history mode) with a water level at or above this value in cm (gauge reading). Combined with 'at or below' as OR.

## `alertBelowCm` (type: `integer`):

Output only stations/measurements with a water level at or below this value in cm, e.g. low water for shipping.

## `onlyStates` (type: `array`):

Current mode: keep only stations whose current level has one of these states relative to mean low water (MNW) and mean high water (MHW): low = below MNW, high = above MHW. Empty = all.

## `maxItems` (type: `integer`):

Upper limit of charged items per run (station readings or measurements).

## Actor input object example

```json
{
  "stations": [
    "KÖLN",
    "KAUB",
    "BONN"
  ],
  "allStations": false,
  "mode": "current",
  "historyDays": 1,
  "includeTrend": true,
  "maxItems": 100000
}
```

# Actor output Schema

## `results` (type: `string`):

One item per station (current mode) or per measurement (history mode).

## `summary` (type: `string`):

Selected stations, stations not found, alerts, items saved and API statistics.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "stations": [
        "KÖLN",
        "KAUB",
        "BONN"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("adamplaenitz/pegelonline-water-levels").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "stations": [
        "KÖLN",
        "KAUB",
        "BONN",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("adamplaenitz/pegelonline-water-levels").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "stations": [
    "KÖLN",
    "KAUB",
    "BONN"
  ]
}' |
apify call adamplaenitz/pegelonline-water-levels --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,adamplaenitz/pegelonline-water-levels"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CzXW5qWmzgPZfnTKm/builds/44mUDEoaVXw8Nb7jz/openapi.json
