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

# Filter every operator

> Start from what a tariff is, and get every operator that publishes one.

`GET /api/map/tariffs` is the other entrance to the same data. Instead of "what
does this operator charge", it answers "**who offers a tariff like this, and how
much**".

It is what colours the public map, and it returns one figure per operator, so
you can render \~500 supply areas from a single request.

## A request

```bash theme={null}
curl "$TARIFF_API/api/map/tariffs?\
period=2026&voltage=7&type=electricity&eco=true"
```

| Parameter | | |
| - | - | - |
| `period` | required | Tariff year. |
| `voltage` | optional | Grid level: `7`, `5` or `3`. Omitting it pools levels, which is rarely what you want. |
| `type` | optional | `electricity`, `grid`, `regional_fees`, `metering`. |
| `dynamic` | optional | `true` / `false` on `has_dynamic`. |
| `eco` | optional | `true` / `false` on `is_eco`. |

## The response

```json theme={null}
{
  "period": 2026,
  "filters": { "voltage": 7, "type": "electricity", "dynamic": null, "eco": true },
  "n_total": 502,
  "n_matched": 110,
  "n_priced": 110,
  "median": 12.48,
  "operators": {
    "486": {
      "rate_rp": 13.2,
      "priced": true,
      "n_tariffs": 3,
      "verified": true,
      "example": "Naturstrom"
    }
  }
}
```

Keys of `operators` are **ElCom operator ids**, which match the
`operator_id` property on the GeoJSON features from `/api/geo/dso_areas` — so
joining prices to geometry is a dictionary lookup.

| Field | Means |
| - | - |
| `rate_rp` | Median energy price of that operator's matching tariffs, Rp/kWh. `null` when none has a fixed rate. |
| `priced` | Whether `rate_rp` is a number. See below. |
| `n_tariffs` | How many of the operator's tariffs matched. |
| `verified` | `false` when *every* matching tariff was machine-read. Computed over the matches, not over the operator. |
| `example` | The cheapest matching tariff's name, for a tooltip. |

## Read `n_matched` against `n_total`

> [!WARNING]
>
> `n_matched` on its own is meaningless. `110` operators offer an eco product —
> out of `502` that publish any NE7 consumption tariff at all. Always show the
> denominator, or your reader will read a sparse market as missing data.

This matters most exactly where the filter is narrowest:

| Filter | Matched | Priced |
| - | - | - |
| electricity, any product | 480 / 502 | 477 |
| electricity, eco only | 110 / 502 | 110 |
| electricity, dynamic only | 6 / 502 | 1 |

## Matches without a price

Five of those six dynamic operators return `rate_rp: null, priced: false`. A
dynamic tariff has no fixed rate — that is the definition, not a defect.

They are still matches and are still counted. `median` is taken over the priced
ones only, and `n_priced` tells you how many that was.

If you are drawing a map, give unpriced matches their own shade rather than
dropping them or colouring them as "no data" — they are the opposite of no data.

> [!NOTE]
>
> Feed-in tariffs are excluded from this endpoint entirely. A remuneration paid to
> a producer averaged into a price charged to a consumer would be a meaningless
> number. Use [`/api/v1/feedin`](https://docs.tariffs.nlead.ch/guides/feed-in) instead.

## Handing off to the single-tariff view

The two paths share a selector, so a click on a coloured area can carry straight
into [Path A](https://docs.tariffs.nlead.ch/guides/find-a-tariff.md) with the filter preserved:

```
/api/tariff/find?dso=486&period=2026&voltage=7&type=electricity
```

The reader lands on the tariff that caused the match, rather than at the top of
the operator's list.

## Drawing the map

```js theme={null}
const BASE = "https://ch-el-tarif-db.azurewebsites.net";
const [geo, prices] = await Promise.all([
  fetch(`${BASE}/api/geo/dso_areas`).then(r => r.json()),
  fetch(`${BASE}/api/map/tariffs?period=2026&voltage=7&type=electricity`)
    .then(r => r.json()),
]);

for (const f of geo.features) {
  const op = prices.operators[f.properties.operator_id];
  f.properties.rate = op?.rate_rp ?? null;        // null → its own shade
  f.properties.unverified = op ? !op.verified : false;   // → hatch it
}
```

The geometry is 2.8 MB and changes once a year; it is served gzipped with a
day-long `Cache-Control`, so fetch it once and keep it. See [Caching and
limits](https://docs.tariffs.nlead.ch/limits.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.