Sri Lanka River & Flood REST API
public REST API & Server-Sent Events stream for river water levels, rate-of-rise metrics, 24-hour rainfall accumulations, and real-time flood alert push notifications across Sri Lanka river basins.
Base URL:
Authentication: None required (Public access)
Rate Limit: 60 requests/min per IP (10 connections/min for SSE)
https://slwaterlevel.mevinu.comAuthentication: None required (Public access)
Rate Limit: 60 requests/min per IP (10 connections/min for SSE)
Endpoint Quick Reference
| Method | Path | Description | Example (Norwood) |
|---|---|---|---|
| GET | /api/history/{gauge}/daily |
Daily summaries with min/max peak times | /api/history/Norwood/daily?days=7 |
| GET | /api/history/{gauge} |
Hourly time-series filtered by days, week, or date | /api/history/Norwood?range=7d&detailed=true |
| GET | /api/gauges/{gauge} |
Live station snapshot, rate-of-rise & status | /api/gauges/Norwood |
| GET | /api/gauges |
Filterable & sortable list of all stations | /api/gauges?basin=Kelani+Ganga |
| GET | /api/alerts |
Active alerts with pre-formatted push notification copy | /api/alerts?level=all |
| GET | /api/rainfall/{gauge} |
Accurate 24h & 1h rainfall accumulation (ArcGIS SUM) | /api/rainfall/Norwood |
| GET | /api/readings |
Multi-station historical query with time filter | /api/readings?gauge=Norwood&range=1d |
| SSE | /stream |
Server-Sent Events real-time broadcast stream | /stream |
GET
/api/history/{gauge_name}/daily
Returns daily aggregated summaries for each calendar day, including min/max water levels and their exact peak occurrence times, daily rainfall total, average water level, and sample count.
📅 Permanent Retention
⏰ Sri Lanka Local Time (+05:30)
📈 Perfect for Charts & Calendars
Query Parameters
days optional
integer
Number of previous days to aggregate (default:
14). E.g. 7
range optional
string
Range alias:
1d, 7d, 14d, 30d, all
date optional
string
Specific calendar day in
YYYY-MM-DD format
curl -s "https://slwaterlevel.mevinu.com/api/history/Norwood/daily?days=7"
const res = await fetch('https://slwaterlevel.mevinu.com/api/history/Norwood/daily?days=7');
const { daily } = await res.json();
daily.forEach(day => {
console.log(`${day.date}: Min ${day.min_water_level}m at ${day.min_water_level_time}`);
console.log(` Max ${day.max_water_level}m at ${day.max_water_level_time}`);
});
import requests
res = requests.get('https://slwaterlevel.mevinu.com/api/history/Norwood/daily?days=7').json()
for day in res.get('daily', []):
print(f"{day['date']} -> Max: {day['max_water_level']}m @ {day['max_water_level_time']}")
{
"gauge": "Norwood",
"days_returned": 2,
"daily": [
{
"date": "2026-10-02",
"min_water_level": 0.76,
"min_water_level_time": "2026-10-02T12:03:32+05:30",
"min_water_level_ts": 1790922812776,
"max_water_level": 1.25,
"max_water_level_time": "2026-10-02T19:03:40+05:30",
"max_water_level_ts": 1790948020805,
"avg_water_level": 0.932,
"total_rainfall": 43.8,
"reading_count": 23
},
{
"date": "2026-10-03",
"min_water_level": 0.82,
"min_water_level_time": "2026-10-03T15:02:59+05:30",
"min_water_level_ts": 1791019979626,
"max_water_level": 1.24,
"max_water_level_time": "2026-10-03T21:02:46+05:30",
"max_water_level_ts": 1791041566761,
"avg_water_level": 1.027,
"total_rainfall": 24.4,
"reading_count": 24
}
]
}
Interactive Test Console
Norwood Station
GET
/api/history/{gauge_name}
Hourly water level and rainfall time-series with zero auto-pruning. Supports lightweight chart arrays
[{t, y, water_level, rain_fall}] or rich mobile detailed mode with thresholds.
Query Parameters
range optional
string
1d (24h), 7d (1 week), 14d (2 weeks), 30d, all
detailed optional
boolean
Set to
true to attach metadata, thresholds, coordinates & summary stats
date optional
string
Filter to single date (
YYYY-MM-DD)
curl -s "https://slwaterlevel.mevinu.com/api/history/Norwood?range=7d&detailed=true"
const res = await fetch('https://slwaterlevel.mevinu.com/api/history/Norwood?range=7d&detailed=true');
const data = await res.json();
console.log('Norwood Basin:', data.metadata.basin);
console.log('Peak Level:', data.summary.max_water_level, 'm');
{
"gauge": "Norwood",
"metadata": {
"basin": "Kelani Ganga",
"alertpull": 1.5,
"minorpull": 3.0,
"majorpull": 4.5,
"current_level": 0.82,
"status": "normal",
"coordinates": { "x": 80.6112, "y": 6.84026 }
},
"summary": {
"min_water_level": 0.76,
"max_water_level": 1.32,
"avg_water_level": 0.994,
"total_rainfall": 69.2
},
"readings": [
{
"ts": 1790922812776,
"time": "2026-10-02T12:03:32+05:30",
"water_level": 0.76,
"rain_fall": 0.0
}
]
}
Interactive Test ConsoleNorwood History
GET
/api/gauges/{gauge_name}
Returns live telemetry snapshot for a specific gauge station: current water level, rate-of-rise in m/hr (excluding rainfall), 1-hour and 24-hour rainfall, coordinates, and alert thresholds.
curl -s "https://slwaterlevel.mevinu.com/api/gauges/Norwood"
const res = await fetch('https://slwaterlevel.mevinu.com/api/gauges/Norwood');
const station = await res.json();
console.log(`Station: ${station.gauge} (${station.basin})`);
console.log(`Level: ${station.water_level}m | Status: ${station.status}`);
{
"gauge": "Norwood",
"basin": "Kelani Ganga",
"water_level": 0.82,
"rate_of_rise": 0.02,
"is_rising": true,
"rain_1h": 0.0,
"rain_24h": 24.4,
"alertpull": 1.5,
"minorpull": 3.0,
"majorpull": 4.5,
"status": "normal",
"coordinates": { "lat": 6.84026, "lng": 80.6112 },
"last_updated": 1791056012112,
"last_updated_time": "2026-10-04T01:03:32+05:30"
}
Interactive Test ConsoleNorwood Snapshot
GET
/api/gauges
Flat REST endpoint for mobile card lists and map marker initialization. Filterable by river basin, flood status, and search keywords.
Query Parameters
basin optional
string
Filter by river basin (e.g.
Kelani Ganga, Kalu Ganga)
status optional
string
normal, alert, minor_flood, major_flood, or flood
search optional
string
Keyword search matching station name or river basin (e.g.
Norwood)
sort optional
string
Sort order:
name, water_level, rain_24h, status
Interactive Test ConsoleStation Search
GET
/api/alerts
Feed designed specifically for real-time mobile push notifications. Returns all stations with active flood stages or rapid water rises, complete with ready-to-dispatch
notification.title and notification.body copy.
Query Parameters
level optional
string
all (default), flood (minor + major), or major
basin optional
string
Filter alerts to specific river basin
min_ror optional
float
Only include stations rising faster than N m/hr (e.g.
0.10)
curl -s "https://slwaterlevel.mevinu.com/api/alerts?level=all"
// Example Flutter / React Native background worker:
const res = await fetch('https://slwaterlevel.mevinu.com/api/alerts?level=flood');
const { alerts } = await res.json();
for (const alert of alerts) {
// Directly forward to Firebase Cloud Messaging (FCM) or Local Notifications:
sendNotification({
title: alert.notification.title,
body: alert.notification.body,
payload: { gauge: alert.gauge }
});
}
{
"total_alerts": 1,
"server_time": "2026-10-04T01:30:00+05:30",
"alerts": [
{
"gauge": "Norwood",
"basin": "Kelani Ganga",
"status": "alert",
"severity": "medium",
"water_level": 1.55,
"alertpull": 1.5,
"minorpull": 3.0,
"majorpull": 4.5,
"rate_of_rise": 0.16,
"is_rising": true,
"rain_1h": 8.0,
"rain_24h": 45.2,
"alert_reasons": [
"Alert threshold exceeded (1.55m >= 1.50m)",
"Rapid water rise (+0.16 m/hr)"
],
"notification": {
"title": "🔔 FLOOD ALERT: Norwood (Kelani Ganga)",
"body": "Water level 1.55m. Alert threshold reached (1.55m >= 1.50m) Rapid water rise (+0.16 m/hr)"
}
}
]
}
Interactive Test ConsoleActive Alerts
GET
/api/rainfall/{gauge_name}
Returns accurate 24-hour cumulative rainfall calculated directly via ArcGIS statistical engine aggregation (
SUM(rain_fall)), matching the official Department of Irrigation dashboard.
Interactive Test ConsoleNorwood 24h Rain
GET
/api/readings
Query readings across single or multiple stations (comma-separated gauge names). Filterable by date or predefined ranges.
Interactive Test ConsoleNorwood Readings (24h)
SSE
/stream
Server-Sent Events
Persistent HTTP event stream that immediately broadcasts full gauge updates whenever new data is polled (~15 minutes). Features automatic 30s heartbeats to prevent proxy timeouts.
const es = new EventSource('https://slwaterlevel.mevinu.com/stream');
es.onmessage = (event) => {
const gauges = JSON.parse(event.data);
const norwood = gauges.find(g => g.attributes.gauge === 'Norwood');
if (norwood) {
console.log('Norwood Updated:', norwood.attributes.water_level, 'm');
}
};
es.onerror = (err) => console.warn('SSE reconnecting...', err);
import json, sseclient
# pip install sseclient-py
messages = sseclient.SSEClient('https://slwaterlevel.mevinu.com/stream')
for msg in messages:
if msg.data:
data = json.loads(msg.data)
print(f"Received update for {len(data)} stations")
Mobile App Push Alerts Guide
To integrate background flood alerts into your mobile app (Flutter, React Native, iOS, Android):
// In your Flutter background task (e.g. workmanager):
Future<void> checkFloodAlerts() async {
final url = Uri.parse('https://slwaterlevel.mevinu.com/api/alerts?level=flood');
final response = await http.get(url);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
for (var alert in data['alerts']) {
// Dispatch local notification using flutter_local_notifications:
flutterLocalNotificationsPlugin.show(
alert['gauge'].hashCode,
alert['notification']['title'],
alert['notification']['body'],
NotificationDetails(android: AndroidNotificationDetails('flood_alerts', 'Flood Alerts')),
);
}
}
}
// In your React Native background fetch handler:
import notifee from '@notifee/react-native';
async function checkFloodAlerts() {
const res = await fetch('https://slwaterlevel.mevinu.com/api/alerts?level=flood');
const { alerts } = await res.json();
for (const alert of alerts) {
await notifee.displayNotification({
title: alert.notification.title,
body: alert.notification.body,
android: { channelId: 'flood_alerts' }
});
}
}
Flood Thresholds & Conventions
| Status | Severity | Condition | Visual Badge |
|---|---|---|---|
| normal | Normal | water_level < alertpull | Green |
| alert | Medium | alertpull ≤ water_level < minorpull | Amber |
| minor_flood | High | minorpull ≤ water_level < majorpull | Orange |
| major_flood | Critical | water_level ≥ majorpull | Red |
* Timestamps (ts) are Unix epoch milliseconds. Local ISO timestamps are formatted in Sri Lanka timezone (Asia/Colombo, +05:30). Water levels are measured in metres (m), rain in millimetres (mm), and rate of rise in m/hr.