# England River Levels: Measure-Day Reading Bundles (`thatmike1/uk-ea-river-levels`) Actor

Export bounded Environment Agency river-level readings for known measures and UTC dates, retaining published units, datum metadata, missing values and source evidence.

- **URL**: https://apify.com/thatmike1/uk-ea-river-levels.md
- **Developed by:** [Michal Pšenčík](https://apify.com/thatmike1) (community)
- **Categories:** Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## England River Levels: Measure-Day Reading Bundles

Export one UTC day of quarter-hour river-level readings for Environment Agency measures you already know, as one
bundle per measure. Each bundle keeps every reading the source returned for that day (sorted oldest first), the
published unit label (`mASD`, `mAOD`, `m`), the datum and qualifier the source states, missing values as `null`,
and the exact source URLs with a SHA-256 of each raw response. Useful for a nightly refresh of a known gauge's
previous day into a paddling-history page, an ecology notebook or a local river dashboard, without writing your
own ETL.

Data comes from the Environment Agency
[real-time flood-monitoring API](https://environment.data.gov.uk/flood-monitoring/doc/reference) (Beta, no key,
Open Government Licence). This uses Environment Agency flood and river level data from the real-time data API
(Beta).

**Not for safety decisions.** The source is a beta service with no safety-critical guarantee, and readings can
arrive late or in batches. This actor returns no flood warnings, thresholds or risk levels.

### Input

```json
{
    "measureIds": ["1029TH-level-stage-i-15_min-mASD"],
    "date": "2026-10-21",
    "maxItems": 100
}
```

- `measureIds`: 1 to 20 Environment Agency measure notations (the last part of a
  `.../flood-monitoring/id/measures/<notation>` link). Notation only, not URLs. Only quarter-hour (900-second)
  `level` measures are supported; rainfall, flow, temperature or other periods come back as free errors.
  Duplicates are removed and never cost extra. Default: `1029TH-level-stage-i-15_min-mASD`.
- `date`: one UTC calendar day, `YYYY-MM-DD`, from 27 days before today (UTC) through today. Leave it out for
  the previous UTC day, which is resolved once when the run starts. Today's date returns a partial day so far.
  The 27-day window bounds the query; it does not promise the source still holds that day.
- `maxItems`: the most bundles to store (1 to 100, default 100). Measures past this limit are not fetched.

Find measure notations on the source itself, for example
`https://environment.data.gov.uk/flood-monitoring/id/stations/1029TH/measures`. The actor never searches for
stations.

### Output

One dataset item per measure and day with at least one numeric reading (readings shortened here):

```json
{
    "schemaVersion": 1,
    "recordId": "ea-level-day:1029TH-level-stage-i-15_min-mASD:2026-10-21",
    "deliveryId": "a737dc7c69173ec5fe9e1b2c3fe31e732c5e156368b4fa82190222f8c7aad535",
    "observedAt": "2026-10-22T21:37:32.041Z",
    "contentHash": "16671cb190390993ca342eaf852a9dd37a7fd0b14bec2bcbeccdeedd6f0fbc05",
    "provenance": [
        {
            "url": "https://environment.data.gov.uk/flood-monitoring/id/measures/1029TH-level-stage-i-15_min-mASD",
            "sha256": "af2ea76ed8d032f5a20b4c5a2b0bc051015211f7f63891774a06fd93add87875"
        },
        {
            "url": "https://environment.data.gov.uk/flood-monitoring/id/measures/1029TH-level-stage-i-15_min-mASD/readings?date=2026-10-21&_sorted&_limit=201",
            "sha256": "11e4db4106e162822fa0194497508c24819c22ea8e78832de424b73f55b34922"
        }
    ],
    "measureId": "1029TH-level-stage-i-15_min-mASD",
    "stationReference": "1029TH",
    "date": "2026-10-21",
    "parameter": "level",
    "qualifier": "Stage",
    "unitName": "mASD",
    "datumType": "http://environment.data.gov.uk/flood-monitoring/def/core/datumASD",
    "periodSeconds": 900,
    "coverage": "bounded_source_snapshot_not_guaranteed_complete_day",
    "reportedReadingCount": 96,
    "numericReadingCount": 96,
    "readings": [
        {
            "sourceReadingId": "http://environment.data.gov.uk/flood-monitoring/data/readings/1029TH-level-stage-i-15_min-mASD/2026-10-21T00-00-00Z",
            "dateTime": "2026-10-21T00:00:00Z",
            "value": 0.084
        },
        {
            "sourceReadingId": "http://environment.data.gov.uk/flood-monitoring/data/readings/1029TH-level-stage-i-15_min-mASD/2026-10-21T00-15-00Z",
            "dateTime": "2026-10-21T00:15:00Z",
            "value": 0.084
        }
    ]
}
```

What the fields mean, and what they do not:

- `readings` holds what the source returned for that UTC day, deduplicated by time and sorted oldest first.
  `value` is the source's number unchanged (negative stages are kept); a missing source value is `null`, never 0.
- `reportedReadingCount` counts the readings in the bundle and `numericReadingCount` the non-null ones. There is
  no "expected" count: 96 quarter-hours is common but not guaranteed, and a short day is not proof of a gap,
  a dry river or a closed station. `coverage` always says so.
- `unitName`, `datumType` and `qualifier` are copied from the measure's metadata. No datum arithmetic or unit
  conversion happens: `mASD` (above station datum) and `mAOD` (above ordnance datum) stay different labels.
- `recordId` is the same for a measure and day in every run, so you can upsert on it. `contentHash` is a SHA-256
  of the bundle's source content (readings and unit context, not the timing fields), so a corrected historical
  reading changes it. `deliveryId` identifies this run's delivery of the bundle.
- `observedAt` is when the readings response finished; `provenance` lists both source requests in order with a
  hash of each raw response body.

### Pricing

Pay per event: **$0.002 per bundle stored** plus **$0.00005 per run start**. One bundle costs $0.00205 per run,
ten cost $0.02005, twenty $0.04005. Re-running the same measure and day bills it again: there is no change
detection. Platform usage may be billed on top, as shown on the pricing tab.

Free (no item event): days with no readings or only null readings, unknown measures, unsupported measures,
source errors, capped work and the run summary. Set a spending limit and the actor stops before a bundle the
limit cannot cover.

### Run summary and limits

Every run writes a free `SUMMARY` record to the default key-value store: the resolved input (including the
default date), run status (`complete`, `partial`, `failed`, `capped`), one outcome per measure (`delivered`,
`empty`, `missing`, `error`, `not_attempted`) with its error code, HTTP status and warnings, request and byte
counts, and `firstUndeliveredKey`, the first measure left unfetched when a cap stopped the run, so you can start
a manual rerun from there.

- Requests are sequential with at least 1.2 seconds between them, so 20 measures take about a minute or two.
- A day with 201 or more raw readings is refused as `unit_limit` rather than cut short.
- A 403, 429 or block page stops all source requests for the rest of the run; 5xx and timeouts are retried
  twice. Readings and metadata are separate requests, so a bundle is a snapshot and the source can change
  between them.
- Work stops after 300 seconds, 100 requests or 16 MiB of responses; anything not reached is listed as
  `not_attempted`.

### Support

Open an issue on the actor's Issues tab with the run ID. Source documentation:
[Environment Agency flood-monitoring API reference](https://environment.data.gov.uk/flood-monitoring/doc/reference).

# Actor input Schema

## `measureIds` (type: `array`):

Environment Agency measure notations for quarter-hour river level measures, for example 1029TH-level-stage-i-15_min-mASD. Notation only, never a URL. 1 to 20; duplicates are removed and cost nothing extra.

## `date` (type: `string`):

One UTC calendar day, YYYY-MM-DD, from 27 days ago through today. Leave empty for the previous UTC day, resolved once when the run starts.

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

Most measure-day bundles to store (one per measure). Measures past this limit are not fetched; the SUMMARY names the first one left.

## Actor input object example

```json
{
  "measureIds": [
    "1029TH-level-stage-i-15_min-mASD"
  ],
  "maxItems": 100
}
```

# Actor output Schema

## `rows` (type: `string`):

No description

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

No description

# 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 = {
    "measureIds": [
        "1029TH-level-stage-i-15_min-mASD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thatmike1/uk-ea-river-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 = { "measureIds": ["1029TH-level-stage-i-15_min-mASD"] }

# Run the Actor and wait for it to finish
run = client.actor("thatmike1/uk-ea-river-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 '{
  "measureIds": [
    "1029TH-level-stage-i-15_min-mASD"
  ]
}' |
apify call thatmike1/uk-ea-river-levels --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thatmike1/uk-ea-river-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/S4JFo2rhfSvNYnGZr/builds/Ano38R18ah7OQTyxq/openapi.json
