SmartWater API

The SmartWater API provides a full-featured analytics engine for water utilities and developers. Access short-term forecasting, leakage detection, inflow & infiltration decomposition, water flow component analysis, pipe survival, and more — all via simple HTTPS POST requests.

Pricing (Per Request)

Tier Endpoint / Feature Price
Basic Sewer Blockage Detection $0.10 / 0.90 SEK
Leakage Anomaly Detection $0.10 / 0.90 SEK
Intermediate Level → Flow Conversion $0.30 / 2.80 SEK
Impute Missing Values $0.30 / 2.80 SEK
Inflow & Infiltration Decomposition $0.30 / 2.80 SEK
Water Flow Component Analysis $0.30 / 2.80 SEK
48-Hour Forecast $0.30 / 2.80 SEK
Advanced Pipe Survival & RUL $1.00 / 9.40 SEK

Volume Discounts:
1–100 API calls: standard rates
101–1,000: 10% discount
1,001+: 20% discount

Quickstart

Here’s how to call the SmartWater API in cURL or Python. Replace YOUR_API_KEY with your API key.

cURL

curl -X POST https://www.waterworks.ai/api/forecast \
-H "Content-Type: application/json" \
-d '{
  "api_key": "YOUR_API_KEY",
  "df": [{"ds":"2024-01-01 00:00:00","y":100}]
}'
  

Python

import requests

url = "https://www.waterworks.ai/api/forecast"
payload = {
    "api_key": "YOUR_API_KEY",
    "df": [{"ds":"2024-01-01 00:00:00","y":100}]
}

response = requests.post(url, json=payload)
print(response.json())
  

Authentication

All SmartWater API endpoints require HTTPS POST requests with a JSON body. Authentication is performed by including your api_key in the request payload:

Request Example

{
  "api_key": "YOUR_API_KEY",
  "df": [{"ds": "2024-01-01 00:00:00", "y": 100}]
}
  

Ensure your API key is kept secret. Each endpoint validates the key and will return an authentication error if missing or invalid.

Inflow & Infiltration

POST https://www.waterworks.ai/api/inflow

Separates measured wastewater flow into sewage, infiltration, and inflow components.

Request Schema

FieldTypeRequiredDescription
api_keystringYesAuthentication key
dfarray<object>YesTime series: ds (ISO datetime), y (flow)
populationnumberNoConnected population
usenumberNoSpecific sewage use per capita

Response Schema

FieldTypeDescription
dsstringTimestamp
sewagenumberSanitary sewage flow
infiltrationnumberGroundwater infiltration
inflownumberRainfall / fast inflow
ynumberTotal observed flow

Example Requests

curl -X POST https://www.waterworks.ai/api/inflow \
-H "Content-Type: application/json" \
-d '{
  "api_key": "YOUR_API_KEY",
  "df": [{"ds":"2026-03-24 00:00:00","y":150}],
  "population": 5000,
  "use": 150
}'
import requests
url = "https://www.waterworks.ai/api/inflow"
payload = {
  "api_key": "YOUR_API_KEY",
  "df": [{"ds":"2026-03-24 00:00:00","y":150}],
  "population": 5000,
  "use": 150
}
r = requests.post(url, json=payload)
print(r.json())

Example Response

[
 {"ds":"2026-03-24 00:00:00","sewage":80,"infiltration":40,"inflow":30,"y":150}
]

Water Flow Component Analysis

POST https://www.waterworks.ai/api/watercomponents

Decomposes network flow into night baseline, customer consumption, and leakage.

Request Schema

FieldTypeRequiredDescription
api_keystringYesAPI key
dfarray<object>YesHourly flow: ds, y
populationnumberNo
usenumberNo

Response Schema

FieldTypeDescription
nightnumberBaseline night flow
consumptionnumberCustomer demand
leaksnumberEstimated leakage
ynumberTotal observed flow

Example Requests

curl -X POST https://www.waterworks.ai/api/watercomponents \
-H "Content-Type: application/json" \
-d '{
  "api_key": "YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":200}],
  "population": 5000,
  "use": 150
}'
import requests
url = "https://www.waterworks.ai/api/watercomponents"
payload = {
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":200}],
  "population": 5000,
  "use":150
}
r=requests.post(url,json=payload)
print(r.json())

Example Response

[
 {"ds":"2026-03-24 00:00:00","night":50,"consumption":120,"leaks":30,"y":200}
]

48-Hour Forecast

POST https://www.waterworks.ai/api/forecast

Generates short-term forecasts for water or wastewater flow time series. Optional weather integration can improve accuracy.

Request Schema

FieldTypeRequiredDescription
api_keystringYesAPI key
dfarray<object>YesTime series: ds (datetime), y (flow)
latnumberNoLatitude (optional, for weather)
lonnumberNoLongitude (optional, for weather)

Response Schema

FieldTypeDescription
forecastarray<object>Forecast for next 48h with ds, yhat, hi_90, lo_90
historicalarray<object>Observed data with ds, y, yhat
MAEnumberMean absolute error vs historical

Example Requests

curl -X POST https://www.waterworks.ai/api/forecast \
-H "Content-Type: application/json" \
-d '{
  "api_key": "YOUR_API_KEY",
  "df": [{"ds":"2026-03-24 00:00:00","y":120}],
  "lat": 59.3293,
  "lon": 18.0686
}'
import requests
url = "https://www.waterworks.ai/api/forecast"
payload = {
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":120}],
  "lat":59.3293,
  "lon":18.0686
}
r=requests.post(url,json=payload)
print(r.json())

Example Response

{
  "forecast":[
    {"ds":"2026-03-24 01:00:00","yhat":123,"hi_90":130,"lo_90":116}
  ],
  "historical":[
    {"ds":"2026-03-24 00:00:00","y":120,"yhat":119}
  ],
  "MAE": 3.5
}

Leakage Anomaly Detection

POST https://www.waterworks.ai/api/leakage

Detects abnormal increases in flow indicative of leaks, near-real-time or retrospective.

Request Schema

FieldTypeRequiredDescription
api_keystringYes
dfarray<object>YesHourly flow: ds, y
unitstringYesMeasurement unit

Response Schema

FieldTypeDescription
dfarray<object>Time series with anomaly (boolean) and alarm (boolean)
night_quotenumberNight flow baseline estimate
night_trendstring"increasing" | "decreasing" | "stable"

Example Requests

curl -X POST https://www.waterworks.ai/api/leakage \
-H "Content-Type: application/json" \
-d '{
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":120}],
  "unit":"m3/h"
}'
import requests
url="https://www.waterworks.ai/api/leakage"
payload={
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":120}],
  "unit":"m3/h"
}
r=requests.post(url,json=payload)
print(r.json())

Example Response

{
  "df":[{"ds":"2026-03-24 00:00:00","y":120,"anomaly":false,"alarm":false}],
  "night_quote":100,
  "night_trend":"stable"
}

Blockage Detection

POST /api/blockage

Detects abnormal drops in sewer flow (inverse anomaly logic).

Request/Response

Same schema as /api/leakage.

Example Request

curl -X POST https://www.waterworks.ai/api/blockage \
-H "Content-Type: application/json" \
-d '{
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","y":100}],
  "unit":"m3/h"
}'
import requests
url="https://www.waterworks.ai/api/blockage"
payload={"api_key":"YOUR_API_KEY","df":[{"ds":"2026-03-24 00:00:00","y":100}],"unit":"m3/h"}
r=requests.post(url,json=payload)
print(r.json())

Level → Flow Conversion

POST /api/leveltoflow

Converts high-resolution level measurements to hourly flow estimates.

Request Schema

api_keystringYes
dfarray<object>Yes (minute-level)

Example Requests

curl -X POST https://www.waterworks.ai/api/leveltoflow \
-H "Content-Type: application/json" \
-d '{
  "api_key":"YOUR_API_KEY",
  "df":[{"ds":"2026-03-24 00:00:00","level":2.5}]
}'
import requests
url="https://www.waterworks.ai/api/leveltoflow"
payload={"api_key":"YOUR_API_KEY","df":[{"ds":"2026-03-24 00:00:00","level":2.5}]}
r=requests.post(url,json=payload)
print(r.json())

Response Schema

dsstringHourly timestamp
ynumberEstimated flow

Impute Missing Values

POST /api/impute

Fills missing values in time series based on historical patterns. Returns imputed values, outage duration, and outage type.

Request Schema

FieldTypeRequiredDescription
api_keystringYesAPI key
dfarray<object>YesTime series with ds (timestamp) and y (value). Missing values are null.

Example Requests

curl -X POST https://www.waterworks.ai/api/impute \
-H "Content-Type: application/json" \
-d '{
  "api_key":"YOUR_API_KEY",
  "df":[
    {"ds":"2026-03-24 00:00:00","y":100},
    {"ds":"2026-03-24 00:01:00","y":null}
  ]
}'
import requests
url="https://www.waterworks.ai/api/impute"
payload={"api_key":"YOUR_API_KEY","df":[{"ds":"2026-03-24 00:00:00","y":100},{"ds":"2026-03-24 00:01:00","y":None}]}
r=requests.post(url,json=payload)
print(r.json())

Response Schema

FieldTypeDescription
dsstringTimestamp
ynumberImputed or original value
missingbooleanTrue if value was missing
outage_hoursintegerDuration of missing data in hours
outage_typestringClassification: signal loss / mechanical / none

Example Response

[
 {"ds":"2026-03-24 00:00:00","y":100,"missing":false,"outage_hours":0,"outage_type":"none"},
 {"ds":"2026-03-24 00:01:00","y":103.5,"missing":true,"outage_hours":1,"outage_type":"signal loss"}
]

Pipe Survival & Remaining Useful Life (RUL)

POST /api/survival

Estimates pipe failure probability and remaining lifespan using pipe attributes, material, age, renovations, and environmental data.

Request Schema

FieldTypeRequiredDescription
api_keystringYesAPI key
dataarray<object>YesPipe attributes
material_columnstringYesName of material column in data
construction_year_columnstringYesName of construction year column
renovation_year_columnstringNoName of last renovation year column
soil_type_columnstringNoName of soil type column

Example Requests

curl -X POST https://www.waterworks.ai/api/survival \
-H "Content-Type: application/json" \
-d '{
  "api_key":"YOUR_API_KEY",
  "data":[{"material":"PVC","construction_year":2000}],
  "material_column":"material",
  "construction_year_column":"construction_year"
}'
import requests
url="https://www.waterworks.ai/api/survival"
payload={"api_key":"YOUR_API_KEY","data":[{"material":"PVC","construction_year":2000}],"material_column":"material","construction_year_column":"construction_year"}
r=requests.post(url,json=payload)
print(r.json())

Response Schema

FieldTypeDescription
LoFnumberLikelihood of failure
RULnumberRemaining Useful Life (years)

Example Response

[
 {"material":"PVC","LoF":0.02,"RUL":28}
]

Earth Observation Data

POST /api/earth

Returns geospatial datasets such as terrain depressions, NDVI, impervious surfaces, and flow accumulation.

Request Schema

api_keystringYes

Example Requests

curl -X POST https://www.waterworks.ai/api/earth \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_API_KEY"}'
import requests
url="https://www.waterworks.ai/api/earth"
payload={"api_key":"YOUR_API_KEY"}
r=requests.post(url,json=payload)
print(r.json())

Response Schema

Example Response

{
 "depressions": [...],
 "ndvi": [...],
 "impervious": [...],
 "flow_accumulation": [...]
}

Geospatial Consequence & Risk

POST /api/georisk

Calculates consequence-of-failure scores for pipes based on street network, critical infrastructure, and spatial exposure.

Request Schema

api_keystringYes

Example Requests

curl -X POST https://www.waterworks.ai/api/georisk \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_API_KEY"}'
import requests
url="https://www.waterworks.ai/api/georisk"
payload={"api_key":"YOUR_API_KEY"}
r=requests.post(url,json=payload)
print(r.json())

Response Schema

Example Response

{
 "pipe_scores": [...],
 "critical_infra_proximity": [...],
 "street_ranking": [...]
}