---
title: "Water-scenario data for a parcel"
description: "Returns water-balance scenario values (runoff, infiltration, evaporation, drinking water, wastewater and their costs) for one parcel column of the `waterscenario2` table: the ten `S<scenario_num>_*` rows plus the ten `S0_*` baseline rows (ten rows in total when `scenario_num` is 0 or names no scenario).\n\nBoth inputs are validated before the database is queried: `scenario_num` must be a non-negative integer and `parcel_num` one of the table's parcel columns. Anything else is refused with 400."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.aireon.ch/llms.txt
> Use this file to discover all available pages before exploring further.

Path: RES API (public) › Parcel

`POST /res_api/fb_water`

Returns water-balance scenario values (runoff, infiltration, evaporation, drinking water, wastewater and their costs) for one parcel column of the `waterscenario2` table: the ten `S<scenario_num>_*` rows plus the ten `S0_*` baseline rows (ten rows in total when `scenario_num` is 0 or names no scenario).

Both inputs are validated before the database is queried: `scenario_num` must be a non-negative integer and `parcel_num` one of the table's parcel columns. Anything else is refused with 400.

## Authentication

- `ResApiToken`, apiKey, in header, header `token`

## Request body

_Required._

- `scenario_num` (`getWaterScenarioData.scenario_num`; integer | string, required): Scenario number: a non-negative integer, as a JSON number or a string of digits. Selects the `S<n>_*` rows; the table holds `S0` to `S351`.
  - min 0; pattern `^[0-9]+$`; example `7`
- `parcel_num` (`getWaterScenarioData.parcel_num`; string, required): Parcel column of `waterscenario2` to read `p_val` from: `p_1` to `p_106` (not every number has a column), `p_gesamtgebiet` or `p_industrie_gewerbe`. A name that is not a parcel column is refused with 400.
  - pattern `^[a-z_][a-z0-9_]{0,62}$`; example `"p_1"`

## Example request

```json
{
  "scenario_num": 7,
  "parcel_num": "p_1"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://res.aireon.ch/res_api/fb_water \
  --header 'Content-Type: application/json' \
  --header 'token: <token>' \
  --data '
{
  "scenario_num": 7,
  "parcel_num": "p_1"
}
'
```

### TypeScript

```typescript
const url = 'https://res.aireon.ch/res_api/fb_water';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', token: '<token>'},
  body: JSON.stringify({scenario_num: 7, parcel_num: 'p_1'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://res.aireon.ch/res_api/fb_water"

payload = {
    "scenario_num": 7,
    "parcel_num": "p_1"
}
headers = {
    "Content-Type": "application/json",
    "token": "<token>"
}

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

print(response.text)
```

## Responses

### 200

Water-scenario rows, or a plain-text error body (legacy error contract).

#### Body (application/json)

- `scenario_id` (`getWaterScenarioData.response.200.scenario_id`; string, required)
  - example `"S7_Abfluss_perc"`
- `p_val` (`getWaterScenarioData.response.200.p_val`; string | null, required): The value of `parcel_num` for this scenario row, as stored (text).
  - example `"1743.3891"`

##### Example

```json
[
  {
    "scenario_id": "S7_Abfluss_perc",
    "p_val": "1743.3891"
  }
]
```

#### Body (text/html)

##### Example

```text
Missing Token
```

### 400

`scenario_num` is not a non-negative integer, or `parcel_num` is not a parcel column of `waterscenario2`.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`getWaterScenarioData.response.400.error`; string, required): Human-readable error description.
- `message` (`getWaterScenarioData.response.400.message`; string, optional): Optional underlying error message.

### 401

Authentication missing or invalid.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`getWaterScenarioData.response.401.error`; string, required): Human-readable error description.
- `message` (`getWaterScenarioData.response.401.message`; string, optional): Optional underlying error message.

### 403

Wrong token.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`getWaterScenarioData.response.403.error`; string, required): Human-readable error description.
- `message` (`getWaterScenarioData.response.403.message`; string, optional): Optional underlying error message.

### 500

Database error (`/fb_water error, please contact admin.`).

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`getWaterScenarioData.response.500.error`; string, required): Human-readable error description.
- `message` (`getWaterScenarioData.response.500.message`; string, optional): Optional underlying error message.


Source: https://docs.aireon.ch/res/get-water-scenario-data/index.md
