# Marktstammdatenregister (MaStR) Scraper: Solar, Battery & Wind (`pegton/mastr-energy-units`) Actor

Official German Marktstammdatenregister (MaStR) data: Photovoltaik, Batteriespeicher, Balkonkraftwerke, wind and more by PLZ, Gemeinde, Bundesland, date and kW. Weekly 'only new units' monitor, battery-on-site flag and market statistics. Privacy-safe, dl-de/by-2-0.

- **URL**: https://apify.com/pegton/mastr-energy-units.md
- **Developed by:** [Rafael Iovi](https://apify.com/pegton) (community)
- **Categories:** Lead generation, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 energy units

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## MaStR Solar, Battery & Wind Units Germany – Marktstammdatenregister Monitor

**Get every new Photovoltaik system, Batteriespeicher, Balkonkraftwerk, wind turbine and power plant from Germany's official Marktstammdatenregister (MaStR) – filtered by PLZ, Gemeinde, Landkreis, Bundesland, date and kW – as clean JSON, CSV or Excel. Run it weekly and receive only the units you have not seen yet.**

The Marktstammdatenregister of the Bundesnetzagentur is the official register of all ~9.8 million electricity generation and storage units in Germany. This Actor turns its public unit overview into analysis-ready data, adds lead signals the register does not show directly, and keeps private persons private.

🇩🇪 *Kurz auf Deutsch: Neue Solaranlagen, Stromspeicher und Windräder aus dem Marktstammdatenregister nach Postleitzahl, Gemeinde, Bundesland, Inbetriebnahme- oder Registrierungsdatum und Leistung exportieren – als wöchentlicher Monitor „nur neue Anlagen“, mit Speicher-Nachrüst-Signal und Marktstatistik. Datenschutzkonform, Datenlizenz Deutschland (dl-de/by-2-0).*

### What makes this Actor different

| | This Actor |
|---|---|
| 🔁 **Monitor mode** | `onlyNew` remembers every unit you already received (per monitor) – schedule it weekly and get only fresh entries. Filter by **registration date**, the date a unit actually appears in the register (commissioning dates are often months earlier). |
| 🔋 **Battery-retrofit signal** | `addStorageMatch` checks the register's own location IDs and flags every solar unit with `hasStorageAtSameLocation: true/false`. In our Munich test, 50 of 58 new rooftop systems already had a battery – the other 8 are your leads. |
| 📊 **Market statistics** | `outputMode: "summary"` returns one row per PLZ, Gemeinde, Landkreis, Bundesland or month with unit count, kW, kWh and private/organisation split – a full year for Munich in ~1 minute. |
| 🛡️ **Privacy by default** | Private persons are anonymised by the register; we additionally drop free-text unit names (they often contain names and addresses), and withhold operator names that look like a sole trader (no legal form). |
| 🎯 **Precise filters** | Energy source, solar type (rooftop, ground-mounted, **Balkonkraftwerk**), status, PLZ or PLZ prefix, AGS/Gemeindeschlüssel prefix, Gemeinde, Landkreis, Bundesland, commissioning date, registration date, kW range, operator type. |
| ✅ **Official source & licence** | Data from the Bundesnetzagentur under *Datenlizenz Deutschland – Namensnennung 2.0* (commercial use allowed with attribution). Every row carries a source note. |

### Auf Deutsch: MaStR-Export für Solarteure, Speicher-Anbieter und Stadtwerke

- **Neue PV-Anlagen nach PLZ:** wöchentliche Liste neuer Solaranlagen (Dachanlagen, Freiflächen, Balkonkraftwerke) in deinem Postleitzahlgebiet, Landkreis oder Bundesland.
- **Speicher-Nachrüstung:** `addStorageMatch` markiert jede PV-Anlage, an deren Standort laut Register bereits ein Batteriespeicher gemeldet ist. Die übrigen Anlagen sind Kandidaten für eine Nachrüstung.
- **Gewerbliche Anlagen ab x kW:** nur Organisationen, mit Betreibername und Netzbetreiber, gefiltert nach Leistung und Registrierungsdatum.
- **Marktstatistik:** Zubau pro Monat, Gemeinde oder Landkreis (Anzahl, kW, kWh) in einem Lauf.
- **Monitor „nur neue Anlagen“:** als Task mit Zeitplan speichern und nur noch neue Einträge erhalten und bezahlen.

Quelle: Marktstammdatenregister der Bundesnetzagentur, Datenlizenz Deutschland – Namensnennung 2.0. Private Betreiber bleiben anonym.

### Use cases

- **Solar & battery installers (Solarteure, Speicher-Anbieter):** weekly list of new PV systems without a battery in your PLZ area → targeted, compliant marketing (letters, local ads, partner programs).
- **Energy service companies & Direktvermarkter:** new commercial and ground-mounted PV ≥ 100 kW in your Bundesland, with operator name and grid operator.
- **Stadtwerke & grid operators:** monitor PV, storage and Balkonkraftwerk growth per Gemeinde.
- **Analysts, consultants, journalists:** monthly expansion statistics per region in one run.
- **Proptech / real estate:** which buildings in a district already produce solar power.
- **AI agents / MCP:** compact, well-typed rows that an agent can query by PLZ and date.

### Input examples

**New solar systems in Munich (PLZ 80xxx), commissioned in the last 30 days, with battery flag**

```json
{
  "energySources": ["solar"],
  "postcodes": ["80"],
  "commissionedLastDays": 30,
  "addStorageMatch": true,
  "maxItems": 5000
}
```

**Weekly B2B monitor: new commercial solar & battery units ≥ 30 kW in Bavaria**

```json
{
  "energySources": ["solar", "storage"],
  "states": ["Bayern"],
  "registeredLastDays": 14,
  "minCapacityKw": 30,
  "operatorType": "organisations",
  "statuses": ["in_operation", "planned"],
  "onlyNew": true,
  "monitorId": "bayern-commercial-30kw"
}
```

Save it as a **Task**, add a **Schedule** (e.g. every Monday 07:00) and connect Google Sheets, Slack, Make, Zapier or n8n.

**Market statistics: solar & storage per month in Munich (AGS 09162000)**

```json
{
  "energySources": ["solar", "storage"],
  "municipalityKeys": ["09162000"],
  "commissionedFrom": "2025-11-01",
  "commissionedTo": "2026-10-31",
  "outputMode": "summary",
  "summaryGroupBy": ["commissioningMonth"]
}
```

#### Filter tips

- **PLZ:** 5 digits = exact; fewer digits = prefix (`"80"` = 80000–80999). Several entries are queried one by one and merged without duplicates.
- **AGS (Gemeindeschlüssel):** 8 digits = one municipality; `"09162"` = kreisfreie Stadt München; `"09"` = Bayern.
- **Dates are inclusive.** Use `registered…` for monitoring, `commissioned…` for market analysis.
- **Capacity** is gross capacity (Bruttoleistung) in kW; for batteries this is power, the storage size is in `usableStorageCapacityKwh`.

### Output

One row per unit (example: a rooftop system of a municipal utility, shortened):

```json
{
  "mastrNumber": "SEE991442337758",
  "unitUrl": "https://www.marktstammdatenregister.de/MaStR/Einheit/Detail/IndexOeffentlich/8390846",
  "unitName": "PV-Dach RigiRutschn",
  "energySource": "solar",
  "solarType": "rooftop",
  "status": "in_operation",
  "grossCapacityKw": 156.0,
  "netCapacityKw": 130.0,
  "commissioningDate": "2024-05-14",
  "registrationDate": "2026-11-06",
  "postcode": "82380",
  "municipality": "Peißenberg",
  "municipalityKey": "09190139",
  "district": "Weilheim-Schongau",
  "state": "Bayern",
  "street": "Pestalozzistraße",
  "houseNumber": "8",
  "latitude": 47.784083,
  "longitude": 11.06335,
  "operatorType": "organisation",
  "operatorName": "Gemeindewerke Peißenberg KU",
  "gridOperatorName": "Kommunalunternehmen Gemeindewerke Peißenberg",
  "solarModuleCount": 354,
  "solarOrientation": "Süd",
  "buildingUse": "Öffentliches Gebäude",
  "feedIn": "Teileinspeisung (einschließlich Eigenverbrauch)",
  "eegInstalledCapacityKw": 156.0,
  "source": "Marktstammdatenregister (Bundesnetzagentur), dl-de/by-2-0, modified"
}
```

A private home system looks the same, but `operatorName`, `operatorMastrNumber`, `unitName`, `street`, `houseNumber`, `latitude` and `longitude` are `null` and `operatorType` is `natural_person`.

Statistics row (`outputMode: "summary"`):

```json
{"commissioningMonth": "2026-07", "energySource": "solar", "unitCount": 592, "grossCapacityKw": 5194.98, "avgGrossCapacityKw": 8.775, "unitsOperatedByOrganisations": 8, "unitsOperatedByPrivatePersons": 584}
```

Each run also stores `RUN_SUMMARY` (matching units per filter, rows scanned and skipped) and `ATTRIBUTION` in the key-value store.

### Pricing (pay per result)

| Event | Price |
|---|---|
| Unit row (`unit-result`) | **$2.00 per 1,000 units** ($0.002 each) |
| Statistics row (`statistics-row`) | $0.01 per row |
| Actor start | Apify default (fractions of a cent) |

Examples: weekly Bavarian B2B monitor with ~120 new units → about **$0.24 per week**. A full year of monthly statistics for one city (24 rows) → **$0.24**. Units skipped by `onlyNew` or `operatorType` are **not** charged. Each run also has Apify's standard start event ($0.00005). You pay no platform usage on top. Set *Maximum cost per run* to cap your spend.

### Data protection (GDPR / DSGVO)

- The register itself publishes units of natural persons only in anonymised form ("natürliche Person"), without street, house number or coordinates (for small units).
- This Actor additionally removes **free-text fields of private units** (unit name, park name), because owners often type their own name or address there, and never outputs the operator number of a private person.
- MaStR lists sole traders as "organisations". By default an operator name is only published if it contains a **legal form** (GmbH, AG, KG, eG, e.V., SE …) or denotes a **public body** (Stadt, Gemeinde, Landratsamt, Stadtwerke …). All others (e.g. "Max Mustermann", "Bäckerei Muster e.K.", "… GbR") are withheld and marked `sole_trader_or_unclear`.
- E-mail addresses and phone numbers are stripped from all free-text fields. The register publishes **no contact details**.
- You are the controller for what you do with the data. Unsolicited advertising by e-mail or phone is restricted in Germany (§ 7 UWG); postal marketing to businesses and aggregated analysis are the typical compliant uses.

### Source, licence and attribution

Data: **Marktstammdatenregister der Bundesnetzagentur**, https://www.marktstammdatenregister.de – licensed under **Datenlizenz Deutschland – Namensnennung – Version 2.0** (https://www.govdata.de/dl-de/by-2-0), which allows commercial use. If you publish or pass on the data, include this source note, e.g.:

> Datenquelle: Marktstammdatenregister der Bundesnetzagentur (www.marktstammdatenregister.de), dl-de/by-2-0 (www.govdata.de/dl-de/by-2-0); Daten verändert.

The Actor reads the same public unit overview that powers the register's website table and its CSV export, sequentially and with pauses between requests, as the register's terms of use require. It is not affiliated with or endorsed by the Bundesnetzagentur.

### Limitations

- **Private wallboxes / charge points are not part of the MaStR** (they are reported to the grid operator, not to the register). Public charge points are a separate BNetzA dataset.
- The register is updated continuously, but owners often register late: a unit commissioned in May can appear in November. Use `registeredFrom`/`registeredLastDays` for monitoring.
- Coordinates and street addresses exist mainly for larger units and organisations.
- Very large exports (e.g. all 5+ million solar units) are possible but slow because the register is queried politely; for nationwide raw dumps, the official Gesamtdatenexport (XML, ~3 GB) is the better tool.
- If the register changes its website, the Actor may need an update – we run a daily health check.

### FAQ

**Is scraping the MaStR legal?** The data are official open data under dl-de/by-2-0; commercial use with attribution is expressly permitted. The Actor uses only publicly available data, no login and no circumvention of any protection.

**Can I get e-mail addresses or phone numbers?** No. The register does not publish them, and we do not enrich private persons.

**Which German keywords does this cover?** Marktstammdatenregister, MaStR Export, Solaranlagen Liste PLZ, neue PV-Anlagen, Photovoltaik Register, Batteriespeicher Register, Stromspeicher, Balkonkraftwerk Register, Windkraftanlagen Liste, Anlagenregister, EEG-Anlagen, Bundesnetzagentur Daten, Solarteur Leads.

### Ready-made templates

A pay-once companion, the [Ü20-Solar-Atlas](https://pegton.gumroad.com/l/ue20-solar-atlas), aggregates 417,003 German solar units whose EEG tariff has ended or will end soon, broken down to PLZ, with a report and sales playbook. It is separate from this Actor's live queries.

# Actor input Schema

## `energySources` (type: `array`):

Which unit types to return. 'solar' = Photovoltaik incl. Balkonkraftwerke, 'storage' = Batteriespeicher/Stromspeicher.

## `solarTypes` (type: `array`):

Only when energySources is \['solar']. Leave empty for all.

## `postcodes` (type: `array`):

5-digit PLZ for an exact match, or 1-4 digits as prefix (e.g. '80' = all 80xxx). Each entry is queried separately and merged.

## `states` (type: `array`):

Filter by one or more German states (Bundesländer).

## `municipalities` (type: `array`):

Exact municipality name as in the register, e.g. 'München'.

## `municipalityKeys` (type: `array`):

8-digit AGS for one municipality or a prefix: 2 digits = Bundesland, 5 digits = Landkreis/kreisfreie Stadt (e.g. '09162' = München).

## `districts` (type: `array`):

Exact Landkreis name as in the register, e.g. 'Rhein-Sieg-Kreis'.

## `statuses` (type: `array`):

Operating status (Betriebs-Status)

## `commissionedFrom` (type: `string`):

YYYY-MM-DD, inclusive.

## `commissionedTo` (type: `string`):

YYYY-MM-DD, inclusive.

## `commissionedLastDays` (type: `integer`):

Overrides 'Commissioned from'.

## `registeredFrom` (type: `string`):

YYYY-MM-DD, inclusive. Best field for lead monitoring: units appear in the register when they are registered, often weeks after commissioning.

## `registeredTo` (type: `string`):

YYYY-MM-DD, inclusive.

## `registeredLastDays` (type: `integer`):

Overrides 'Registered from'. Typical for weekly monitors: 14.

## `minCapacityKw` (type: `number`):

Bruttoleistung, inclusive. For batteries this is power (kW), not capacity (kWh).

## `maxCapacityKw` (type: `number`):

Bruttoleistung, inclusive.

## `operatorType` (type: `string`):

Private persons are always anonymised by the register and by this Actor.

## `onlyNew` (type: `boolean`):

Remembers every MaStR number returned before (named key-value store 'mastr-monitor-state') and returns only units you have not received yet. Combine with a schedule.

## `monitorId` (type: `string`):

Optional name for the monitor state, so you can change other inputs without losing history.

## `addStorageMatch` (type: `boolean`):

Adds 'hasStorageAtSameLocation'. Uses the register's location IDs (one extra request per postcode). Great for battery retrofit leads.

## `outputMode` (type: `string`):

Raw units or aggregated market statistics.

## `summaryGroupBy` (type: `array`):

Grouping for the statistics output. Each group is also split by energy source.

## `maxUnitsToScan` (type: `integer`):

Safety limit for statistics runs (all matching units must be scanned).

## `includeTechnicalDetails` (type: `boolean`):

Module count, orientation, feed-in type, EEG data, wind turbine data …

## `redactPersonalOrganisationNames` (type: `boolean`):

MaStR lists sole traders as 'organisations', e.g. 'Daniel Lange' or 'Brauerei Muster e.K.'. With this on (recommended, GDPR), an operator name is only published if it contains a legal form (GmbH, AG, KG, eG, e.V. …) or denotes a public body (Stadt, Gemeinde, Landratsamt …). Withheld rows get operatorType 'sole_trader_or_unclear'.

## `maxItems` (type: `integer`):

Maximum number of dataset rows (units or statistic rows).

## Actor input object example

```json
{
  "energySources": [
    "solar"
  ],
  "postcodes": [
    "10115"
  ],
  "statuses": [
    "in_operation"
  ],
  "operatorType": "all",
  "onlyNew": false,
  "addStorageMatch": false,
  "outputMode": "units",
  "summaryGroupBy": [
    "postcode"
  ],
  "maxUnitsToScan": 100000,
  "includeTechnicalDetails": true,
  "redactPersonalOrganisationNames": true,
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

All rows (views: units, statistics).

## `runSummary` (type: `string`):

Matching units per slice, rows saved, requests.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "energySources": [
        "solar"
    ],
    "postcodes": [
        "10115"
    ],
    "statuses": [
        "in_operation"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("pegton/mastr-energy-units").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "energySources": ["solar"],
    "postcodes": ["10115"],
    "statuses": ["in_operation"],
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("pegton/mastr-energy-units").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "energySources": [
    "solar"
  ],
  "postcodes": [
    "10115"
  ],
  "statuses": [
    "in_operation"
  ],
  "maxItems": 100
}' |
apify call pegton/mastr-energy-units --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pegton/mastr-energy-units"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/eHLXaOe95c2qmYaJz/builds/OLVSF2PD9dmQ5F8sC/openapi.json
