FlowAi

Resources

Connect Delft-FEWS

FlowAi serves its observations and forecasts in the format Delft-FEWS imports natively, so your FEWS can read them like any other PI service: no scripts, no file transfers. This guide takes a FEWS administrator from an API key to FlowAi series in a FEWS plot.

Data Integration package. The FEWS feed and API keys come with the Data Integration package (sold from summer 2027). Want to test the feed with your FEWS before then? Email [email protected] and we will turn it on for your organisation. An admin of your organisation creates keys and downloads the kit in Profile › Integrations. Compare plans.

What you need

1. Create an API key

In Profile › Integrations, name the key (for example “FEWS import”) and choose Create key. Copy it straight away: FlowAi stores only a fingerprint of it and shows it once. The page also shows your feed address, https://api.flowai-forecast.com/rest/fewspiservice/v1/.

FlowAi Integrations page right after creating a key: the new key in a highlighted box with a Copy button and the warning that it won't be shown again
A new key is shown once. The key and the feed address are hidden in this screenshot.

A key reads what your organisation's members read: forecasts for your unlocked gauges and observations on any gauge. It can't change anything. Give each system its own key, so one can be revoked without stopping the others.

2. Download the FEWS kit

Download FEWS kit on the same page gives a zip of ready-made configuration for your organisation:

FlowAi Integrations page: the Delft-FEWS feed address, the list of API keys with one active key, and the Download FEWS kit button
Profile › Integrations for an organisation admin: feed address (hidden here), keys, and the kit.

3. Install the kit

  1. Copy the three XML files into the same folders of your configuration.
  2. Paste the location set into RegionConfigFiles/LocationSets.xml, and each registration into its file: the module instance and workflow descriptors next to the existing ones (before any rootNode), the node inside a group in Topology.xml, or schedule the workflow in the Master Controller.
  3. Put your API key in <password>. Once it works, replace it with <encryptedPassword> (F12 › clipboard utilities in a FEWS client).
  4. In the idMap, set each internal to your own parameter id, and drop the time series sets you don't need.
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" ...>
  <import>
    <general>
      <importType>pi_server</importType>
      <serverUrl>https://api.flowai-forecast.com/rest/fewspiservice/v1/</serverUrl>
      <user>flowai</user>
      <password>PASTE-YOUR-FLOWAI-API-KEY</password>
      <relativeViewPeriod unit="day" start="-3" end="10" startOverrulable="true" endOverrulable="false"/>
      <idMapId>IdImportFlowAi</idMapId>
      <dataFeedId>FlowAi</dataFeedId>
    </general>
    <timeSeriesSet>
      <moduleInstanceId>ImportFlowAi</moduleInstanceId>
      <valueType>scalar</valueType>
      <parameterId>Q.fcst.day</parameterId>
      <locationSetId>FlowAiLocations</locationSetId>
      <timeSeriesType>external forecasting</timeSeriesType>
      <timeStep unit="day"/>
      <readWriteMode>add originals</readWriteMode>
    </timeSeriesSet>
    <!-- ... one timeSeriesSet for each parameter -->
  </import>
</timeSeriesImportRun>
<idMap version="1.1" xmlns="http://www.wldelft.nl/fews" ...>
  <parameter internal="QR.obs" external="Q.obs"/>
  <parameter internal="HG.obs" external="H.obs"/>
  <parameter internal="QR.sim" external="Q.fcst.day"/>
  <enableOneToOneMapping/>  <!-- station ids are WSC ids on both sides -->
</idMap>

FEWS sends the user and password only after the feed asks for them: its first request gets a 401 with a Basic challenge, the second carries the key. That's why <user> can be anything.

4. Run the import

Run the Import FlowAi forecasts workflow from the forecast tree, or let the Master Controller run it. Hourly is plenty: forecasts are issued daily and real-time readings arrive every 5 to 15 minutes. The log says how many series it wrote; a Config.Error there points at the file to fix.

Each day's forecast has a published target issue time, a target and not a guarantee. The forecast status pagegives it in UTC and your time zone, and whether each of the last 90 days met it. The kit's README states it too.

Delft-FEWS forecast tree with the Import FlowAi forecasts workflow under Import Station Observations, run successfully
Detail of the Delft-FEWS forecast tree after the run (Delft-FEWS 2023.02 demo).

Reading the values

FlowAi FEWS parameters
Parameter idWhat it isFEWS typeUnits
Q.obsObserved discharge: the provider's real-time readings, about the last three days, at their own timesinstantaneousm³/s
H.obsObserved water level (stage): the provider's real-time readings, at their own timesinstantaneousm
Q.obs.dayObserved daily mean flow, as far back as your plan's observed history. At a reservoir it is the dam's release (or, behind a natural flow, the station's measured flow), never its natural or total inflowmean, dailym³/s
H.obs.dayObserved daily mean water levelmean, dailym
QIN.obs.dayObserved daily natural inflow: a reservoir's computed natural inflow, or a computed natural flow; no values elsewheremean, dailym³/s
QINT.obs.dayObserved daily total inflow of a reservoir, including releases from upstream dams; no values elsewheremean, dailym³/s
Q.fcst.dayFlowAi's daily mean flow forecast from the latest issue, forecastDate = the issue timemean, dailym³/s
QIN.fcst.dayThe same, for a gauge whose forecast is of its natural inflow (daily only)mean, dailym³/s
QINT.fcst.dayThe same, for a gauge whose forecast is of its total inflow (daily only)mean, dailym³/s
Q.fcst.6hThe same issue's 6-hour mean discharge forecast, four values a day (your plan's horizon on your unlocked gauges)mean, 6-hourlym³/s
H.fcst.dayThe same issue's daily mean forecast as a water level, in metres above the gauge datum: each flow through the station's rating curve. Only for a gauge with a published rating, and none while ice withholds itmean, dailym
H.fcst.6hThe 6-hour mean level forecast: each 6-hour mean flow through the same rating curve (your plan's horizon on your unlocked gauges)mean, 6-hourlym
Delft-FEWS plot for the Mississippi River at the outlet of Dalhousie Lake: observed discharge (blue) and stage (green) imported from FlowAi up to now, and FlowAi's 10-day discharge forecast as a dashed red line
FlowAi in Delft-FEWS (2023.02 demo): Mississippi River at the outlet of Dalhousie Lake (02KF019), real sandbox data of 2 October 2026. Observed discharge and stage up to now; the dashed line is the forecast issued that day, mapped to the demo's QR.sim. The demo's title bar is part of the screenshot.

The feed format

The feed is the part of the FEWS PI REST service the PI Webservice Import uses: one request per run, for the stations and parameters it imports. You don't need to build these requests yourself; FEWS does. They're here so you can test the feed, or read it from another system.

GET /rest/fewspiservice/v1/timeseries?convertDatum=false&useDisplayUnits=false
    &startTime=2026-09-29T20:00:00Z&endTime=2026-10-12T20:00:00Z
    &parameterIds=Q.obs&parameterIds=Q.fcst.day
    &filterId=flowai&locationIds=02KF019
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="FlowAi"

{"detail": "api_key_required", "status_code": 401}
HTTP/1.1 200 OK
Content-Type: application/xml
X-FlowAi-Disclaimer: https://flowai-forecast.com/disclaimer; version=2026-10-10

<TimeSeries xmlns="http://www.wldelft.nl/fews/PI" version="1.24">
  <timeZone>0.0</timeZone>
  <series>
    <header>
      <type>instantaneous</type>
      <moduleInstanceId>FlowAi</moduleInstanceId>
      <locationId>02KF019</locationId>
      <parameterId>Q.obs</parameterId>
      <timeStep unit="nonequidistant"/>
      <startDate date="2026-10-01" time="00:00:00"/>
      <endDate date="2026-10-02" time="17:30:00"/>
      <missVal>NaN</missVal>
      <longName>Observed discharge, provider real-time readings (UTC time stamps)</longName>
      <stationName>Mississippi River at Outlet of Dalhousie</stationName>
      <units>m3/s</units>
    </header>
    <event date="2026-10-01" time="00:00:00" value="6.735" flag="0"/>
    <event date="2026-10-01" time="00:15:00" value="6.728" flag="0"/>
    <!-- ... -->
    <event date="2026-10-02" time="17:30:00" value="6.851" flag="0"/>
    <comment>Forecasts are for information only and may be inaccurate. FlowAi is not responsible for the consequences of inaccurate forecasts. Not for life-safety decisions. Follow official flood messages from the flood forecasting or emergency management authority for your area (such as your conservation authority, municipality or provincial government). Data Source: Environment and Climate Change Canada (...). Contains information provided by the Ontario Surface Water Monitoring Centre, Ministry of Natural Resources.</comment>
  </series>
  <series>
    <header>
      <type>mean</type>
      <locationId>02KF019</locationId>
      <parameterId>Q.fcst.day</parameterId>
      <timeStep unit="day" multiplier="1"/>
      <startDate date="2026-10-03" time="00:00:00"/>
      <endDate date="2026-10-12" time="00:00:00"/>
      <forecastDate date="2026-10-02" time="00:00:00"/>
      <units>m3/s</units>
      <!-- ... -->
    </header>
    <event date="2026-10-03" time="00:00:00" value="6.660457" flag="0"/>
    <event date="2026-10-04" time="00:00:00" value="6.601323" flag="0"/>
    <!-- ... -->
    <event date="2026-10-12" time="00:00:00" value="6.381788" flag="0"/>
  </series>
</TimeSeries>

PI-XML is the default. Add documentFormat=PI_JSON (or send Accept: application/json) for PI-JSON:

{
  "version": "1.24",
  "timeZone": "0.0",
  "timeSeries": [
    {
      "header": {
        "type": "mean",
        "locationId": "02KF019",
        "parameterId": "Q.fcst.day",
        "timeStep": { "unit": "day", "multiplier": "1" },
        "forecastDate": { "date": "2026-10-02", "time": "00:00:00" },
        "units": "m3/s"
      },
      "events": [
        { "date": "2026-10-03", "time": "00:00:00", "value": "6.660457", "flag": "0" },
        { "date": "2026-10-04", "time": "00:00:00", "value": "6.601323", "flag": "0" }
      ]
    }
  ]
}

To try the feed from a terminal:

curl -u "fews:YOUR-API-KEY" \
  "https://api.flowai-forecast.com/rest/fewspiservice/v1/timeseries?locationIds=02KF019&parameterIds=Q.obs&parameterIds=Q.fcst.day&startTime=2026-09-29T00:00:00Z&endTime=2026-10-12T00:00:00Z"

Every response carries the forecast disclaimer: its link and version in the X-FlowAi-Disclaimer header, and its short text in each series' comment. A Public Agency's key gets the Public Agency version. After the disclaimer, the comment carries the credits of the series' data: the station's data providers, and for a forecast also the weather data behind it. Keep them with the values wherever you show or pass them on (the full list is on Data Sources).

Troubleshooting

Feed errors
StatusCodeWhat it means
401api_key_requiredNo key was sent. FEWS always gets this first: it is the challenge that makes FEWS send its user and password. Nothing to fix.
401invalid_api_keyThe key is wrong, incomplete or revoked. Check the password in the import module, or create a new key.
403integration_requiredYour organisation does not hold the Data Integration package (or it has ended). The feed and keys stop at once.
429api_key_rate_limitedMore than 60 requests a minute or 10,000 a day on this key. Wait for the time in Retry-After. An hourly import is far below the limit.
400unknown_location_idsA station id FlowAi doesn't carry (the response lists them). Check the location set and idMap.
400unknown_parameter_idsA parameter id that isn't one of those above. Check the external ids in the idMap.

Data sources and attribution

FlowAi's forecasts are built on public data. When you republish values you got from FlowAi, credit those sources as their licences ask (both allow commercial use):

  • Observed flow and level (Water Survey of Canada): “Contains information licensed under the Open Government Licence – Canada.”
  • Weather forecasts and observed precipitation: “Data Source: Environment and Climate Change Canada.”

The full list is on Data Sources. These credits are for the original data; none of them suggests that the source endorses FlowAi or your use.

Disclaimer

FlowAi forecasts are for information only and may be inaccurate. They are not official flood warnings. Read the Forecast Disclaimer (for a Public Agency, its Public Agency version) and the Terms of Service.