{
  "openapi": "3.0.1",
  "info": {
    "title": "Marktstammdatenregister (MaStR) Scraper: Solar, Battery & Wind",
    "description": "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.",
    "version": "1.0",
    "x-build-id": "OLVSF2PD9dmQ5F8sC"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pegton~mastr-energy-units/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pegton-mastr-energy-units",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/pegton~mastr-energy-units/runs": {
      "post": {
        "operationId": "runs-sync-pegton-mastr-energy-units",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/pegton~mastr-energy-units/run-sync": {
      "post": {
        "operationId": "run-sync-pegton-mastr-energy-units",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "energySources"
        ],
        "properties": {
          "energySources": {
            "title": "Energy sources (Energieträger)",
            "type": "array",
            "description": "Which unit types to return. 'solar' = Photovoltaik incl. Balkonkraftwerke, 'storage' = Batteriespeicher/Stromspeicher.",
            "items": {
              "type": "string",
              "enum": [
                "solar",
                "storage",
                "wind",
                "biomass",
                "hydro",
                "natural_gas",
                "hydrogen",
                "solar_thermal",
                "geothermal",
                "other_gases",
                "mine_gas",
                "sewage_sludge",
                "non_biogenic_waste",
                "heat",
                "mineral_oil",
                "lignite",
                "hard_coal",
                "nuclear",
                "gas_pressure",
                "water_pressure"
              ],
              "enumTitles": [
                "Solar PV (Solare Strahlungsenergie)",
                "Battery / storage (Speicher)",
                "Wind (Wind)",
                "Biomass (Biomasse)",
                "Hydro (Wasser)",
                "Natural gas (Erdgas)",
                "Hydrogen (Wasserstoff)",
                "Solar thermal (Solarthermie)",
                "Geothermal (Geothermie)",
                "Other gases (andere Gase)",
                "Mine gas (Grubengas)",
                "Sewage sludge (Klärschlamm)",
                "Non-biogenic waste (nicht biogener Abfall)",
                "Heat (Wärme)",
                "Mineral oil products (Mineralölprodukte)",
                "Lignite (Braunkohle)",
                "Hard coal (Steinkohle)",
                "Nuclear (Kernenergie)",
                "Pressure from gas pipelines (Druck aus Gasleitungen)",
                "Pressure from water pipelines (Druck aus Wasserleitungen)"
              ]
            },
            "default": [
              "solar"
            ]
          },
          "solarTypes": {
            "title": "Solar type (Art der Solaranlage)",
            "type": "array",
            "description": "Only when energySources is ['solar']. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "ground_mounted",
                "rooftop",
                "balcony",
                "other"
              ],
              "enumTitles": [
                "Freiflächensolaranlage",
                "Gebäudesolaranlage",
                "Steckerfertige Solaranlage (Balkonkraftwerk)",
                "Sonstige Solaranlage"
              ]
            }
          },
          "postcodes": {
            "title": "Postcodes (PLZ)",
            "type": "array",
            "description": "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.",
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "Bundesland",
            "type": "array",
            "description": "Filter by one or more German states (Bundesländer).",
            "items": {
              "type": "string",
              "enum": [
                "Baden-Württemberg",
                "Bayern",
                "Berlin",
                "Brandenburg",
                "Bremen",
                "Hamburg",
                "Hessen",
                "Mecklenburg-Vorpommern",
                "Niedersachsen",
                "Nordrhein-Westfalen",
                "Rheinland-Pfalz",
                "Saarland",
                "Sachsen",
                "Sachsen-Anhalt",
                "Schleswig-Holstein",
                "Thüringen",
                "Ausschließliche Wirtschaftszone"
              ]
            }
          },
          "municipalities": {
            "title": "Municipality names (Gemeinde)",
            "type": "array",
            "description": "Exact municipality name as in the register, e.g. 'München'.",
            "items": {
              "type": "string"
            }
          },
          "municipalityKeys": {
            "title": "Municipality keys (AGS / Gemeindeschlüssel)",
            "type": "array",
            "description": "8-digit AGS for one municipality or a prefix: 2 digits = Bundesland, 5 digits = Landkreis/kreisfreie Stadt (e.g. '09162' = München).",
            "items": {
              "type": "string"
            }
          },
          "districts": {
            "title": "Districts (Landkreis)",
            "type": "array",
            "description": "Exact Landkreis name as in the register, e.g. 'Rhein-Sieg-Kreis'.",
            "items": {
              "type": "string"
            }
          },
          "statuses": {
            "title": "Operating status (Betriebs-Status)",
            "type": "array",
            "description": "Operating status (Betriebs-Status)",
            "items": {
              "type": "string",
              "enum": [
                "in_operation",
                "planned",
                "temporarily_decommissioned",
                "permanently_decommissioned"
              ],
              "enumTitles": [
                "In Betrieb",
                "In Planung",
                "Vorübergehend stillgelegt",
                "Endgültig stillgelegt"
              ]
            },
            "default": [
              "in_operation"
            ]
          },
          "commissionedFrom": {
            "title": "Commissioned from (Inbetriebnahme ab)",
            "type": "string",
            "description": "YYYY-MM-DD, inclusive."
          },
          "commissionedTo": {
            "title": "Commissioned until",
            "type": "string",
            "description": "YYYY-MM-DD, inclusive."
          },
          "commissionedLastDays": {
            "title": "…or commissioned in the last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Overrides 'Commissioned from'."
          },
          "registeredFrom": {
            "title": "Registered from (Registrierung ab)",
            "type": "string",
            "description": "YYYY-MM-DD, inclusive. Best field for lead monitoring: units appear in the register when they are registered, often weeks after commissioning."
          },
          "registeredTo": {
            "title": "Registered until",
            "type": "string",
            "description": "YYYY-MM-DD, inclusive."
          },
          "registeredLastDays": {
            "title": "…or registered in the last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Overrides 'Registered from'. Typical for weekly monitors: 14."
          },
          "minCapacityKw": {
            "title": "Min. gross capacity (kW)",
            "minimum": 0,
            "type": "number",
            "description": "Bruttoleistung, inclusive. For batteries this is power (kW), not capacity (kWh)."
          },
          "maxCapacityKw": {
            "title": "Max. gross capacity (kW)",
            "minimum": 0,
            "type": "number",
            "description": "Bruttoleistung, inclusive."
          },
          "operatorType": {
            "title": "Operator type",
            "enum": [
              "all",
              "organisations",
              "natural_persons"
            ],
            "type": "string",
            "description": "Private persons are always anonymised by the register and by this Actor.",
            "default": "all"
          },
          "onlyNew": {
            "title": "Only new units since the last run (monitor mode)",
            "type": "boolean",
            "description": "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.",
            "default": false
          },
          "monitorId": {
            "title": "Monitor ID",
            "type": "string",
            "description": "Optional name for the monitor state, so you can change other inputs without losing history."
          },
          "addStorageMatch": {
            "title": "Flag solar units with/without a battery at the same location",
            "type": "boolean",
            "description": "Adds 'hasStorageAtSameLocation'. Uses the register's location IDs (one extra request per postcode). Great for battery retrofit leads.",
            "default": false
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "units",
              "summary"
            ],
            "type": "string",
            "description": "Raw units or aggregated market statistics.",
            "default": "units"
          },
          "summaryGroupBy": {
            "title": "Group statistics by",
            "type": "array",
            "description": "Grouping for the statistics output. Each group is also split by energy source.",
            "items": {
              "type": "string",
              "enum": [
                "postcode",
                "municipality",
                "district",
                "state",
                "commissioningMonth",
                "registrationMonth"
              ]
            },
            "default": [
              "postcode"
            ]
          },
          "maxUnitsToScan": {
            "title": "Max. units to scan for statistics",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Safety limit for statistics runs (all matching units must be scanned).",
            "default": 100000
          },
          "includeTechnicalDetails": {
            "title": "Include technical details",
            "type": "boolean",
            "description": "Module count, orientation, feed-in type, EEG data, wind turbine data …",
            "default": true
          },
          "redactPersonalOrganisationNames": {
            "title": "Withhold operator names that may identify a person",
            "type": "boolean",
            "description": "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'.",
            "default": true
          },
          "maxItems": {
            "title": "Max. results",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of dataset rows (units or statistic rows).",
            "default": 1000
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}