{
  "openapi": "3.1.1",
  "info": {
    "title": "Energy Grid Explorer API",
    "version": "1.0.0",
    "summary": "Generation mix, load, renewable share, cross-border flows and power prices for European grids.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://energygridexplorer.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Generation mix, load, renewable share, cross-border flows and power prices for European grids.",
        "description": "Pulls public net electricity generation per source, load, cross-border physical flows and day-ahead prices from the Energy-Charts API by Fraunhofer ISE for a country and date range, then computes energy per source, renewable share, peak and minimum load, net imports per neighbour and price statistics. Paste saved Energy-Charts JSON to analyse offline.\n\nMethodology:\n- Live data: GET https://api.energy-charts.info/public_power?country=…&start=…&end=… (net public generation per source in MW, usually 15-minute steps), /cbpf (cross-border physical flows in GW, positive = import) and /price?bzn=… (day-ahead price, EUR/MWh). Dates are local (Central European) calendar days, end inclusive.\n- Energy per source = Σ(MW × step) using the median sampling step; load, residual load, share series, scheduled trading and pumped-storage charging are excluded from generation.\n- Renewable share = renewable energy ÷ total generation, counting hydro run-of-river, reservoir, biomass, geothermal, wind and solar fully and waste at 50 % (biogenic share). This reproduces Energy-Charts' own \"Renewable share of generation\" series, whose plain mean is shown for comparison.\n- Peak / minimum load are the highest and lowest samples of the \"Load\" series with their UTC timestamps; prices report mean, extremes and the number of negative-price intervals.\n- Prices are only requested for bidding zones Energy-Charts publishes under CC BY 4.0 (SMARD.de data: DE-LU, AT, BE, CH, CZ, DK1, FR, HU, IT-North, NL, NO2, PL, SE4, SI); other zones are marked private/internal use by the API terms.\n- Outages: no keyless public outage API was verified (ENTSO-E Transparency requires a registered security token), so outage data is not provided.",
        "tags": [
          "public-data"
        ],
        "x-mcp-tool": "energy_grid_explorer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnergyGridExplorerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Germany, 1 Oct 2026 midday (pasted Energy-Charts JSON)",
                  "value": {
                    "source": "pasted",
                    "country": "de",
                    "pastedPower": "{\"unix_seconds\":[1790848800,1790849700,1790850600,1790851500,1790852400,1790853300,1790854200,1790855100,1790856000,1790856900,1790857800,1790858700,1790859600],\"production_types\":[{\"name\":\"Hydro pumped storage consumption\",\"data\":[-1589.9,-2220.2,-2488.5,-3176.3,-3006.0,-2738.7,-3014.6,-2900.1,-2477.4,-1063.5,-530.4,-436.8,-732.1]},{\"name\":\"Cross border electricity trading\",\"data\":[2048.2,1843.7,2148.2,2703.1,3983.9,4178.4,4904.4,5045.5,5272.9,5347.4,5075.1,5226.4,7183.6]},{\"name\":\"Hydro Run-of-River\",\"data\":[1122.5,1111.9,1109.8,1113.8,1111.1,1118.2,1104.1,1101.1,1102.8,1097.9,1078.9,1060.1,1056.6]},{\"name\":\"Biomass\",\"data\":[3721.5,3715.5,3698.3,3688.7,3663.6,3667.1,3659.5,3660.0,3653.3,3659.2,3658.9,3668.0,3667.5]},{\"name\":\"Fossil brown coal / lignite\",\"data\":[8913.6,8918.4,8918.4,8930.0,8926.5,8968.8,9014.4,9023.2,9052.5,9012.6,9053.1,9093.8,9086.2]},{\"name\":\"Fossil hard coal\",\"data\":[3481.9,3383.1,3203.2,2974.7,2894.4,2888.0,2931.5,2946.8,3034.8,3173.1,3322.9,3343.2,3170.0]},{\"name\":\"Fossil oil\",\"data\":[230.7,230.8,230.9,230.3,230.2,230.0,230.1,230.7,232.0,231.7,231.2,222.9,119.1]},{\"name\":\"Fossil coal-derived gas\",\"data\":[347.7,347.4,338.8,342.7,340.4,333.4,332.6,388.4,423.9,426.2,430.7,435.8,440.1]},{\"name\":\"Fossil gas\",\"data\":[5622.5,5602.2,5592.2,5562.9,5511.9,5499.8,5456.2,5462.9,5560.2,5708.7,5675.1,5708.7,5645.4]},{\"name\":\"Geothermal\",\"data\":[13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2,13.2]},{\"name\":\"Hydro water reservoir\",\"data\":[4.7,3.5,3.8,4.8,4.7,5.1,5.3,7.4,6.9,6.7,4.4,5.0,4.7]},{\"name\":\"Hydro pumped storage\",\"data\":[11.8,9.5,9.5,9.5,9.6,9.9,14.7,58.9,130.9,34.6,153.7,94.6,38.2]},{\"name\":\"Others\",\"data\":[132.7,132.4,132.4,132.4,132.4,132.4,132.4,132.4,132.4,132.4,132.7,132.4,132.4]},{\"name\":\"Waste\",\"data\":[1267.3,1269.8,1271.7,1275.2,1275.0,1270.6,1270.0,1267.8,1268.1,1263.0,1261.6,1264.2,1261.1]},{\"name\":\"Wind offshore\",\"data\":[2587.1,2725.8,2791.7,2695.3,2342.7,2244.7,2341.6,2251.5,2478.8,2584.7,2668.5,2657.9,3229.2]},{\"name\":\"Wind onshore\",\"data\":[5458.9,5368.5,5325.4,5267.3,5132.2,4930.4,4911.5,4796.6,4735.9,4691.6,4583.5,4598.6,4485.3]},{\"name\":\"Solar\",\"data\":[26884.6,27149.8,27194.6,26952.3,26494.0,25820.4,24943.3,24151.8,23060.4,22124.0,20922.8,19650.5,18329.3]},{\"name\":\"Load\",\"data\":[64505.5,64119.0,63860.0,63954.7,64183.1,63568.0,63056.5,63155.2,62686.6,63541.9,62723.3,61936.9,62818.8]},{\"name\":\"Residual load\",\"data\":[29574.8,28874.8,28548.3,29039.8,30214.1,30572.6,30860.1,31955.3,32411.5,34141.7,34548.5,35030.0,36775.0]},{\"name\":\"Renewable share of load\",\"data\":[62.6,63.5,63.8,63.1,61.3,60.4,59.6,57.9,56.9,54.7,53.5,52.1,50.0]},{\"name\":\"Renewable share of generation\",\"data\":[67.6,67.8,68.1,68.2,67.8,67.2,66.7,66.0,65.1,64.2,63.2,62.2,62.0]}],\"deprecated\":false}",
                    "pastedPrice": "{\"license_info\":\"CC BY 4.0 (creativecommons.org/licenses/by/4.0) from Bundesnetzagentur | SMARD.de\",\"unix_seconds\":[1790848800,1790849700,1790850600,1790851500,1790852400,1790853300,1790854200,1790855100,1790856000,1790856900,1790857800,1790858700,1790859600],\"price\":[160.89,164.01,160.45,163.41,153.31,152.45,151.37,150.96,152.14,147.09,150.64,151.47,150.03],\"unit\":\"EUR / MWh\",\"deprecated\":false}",
                    "pastedFlows": "{\"unix_seconds\":[1790848800,1790849700,1790850600,1790851500,1790852400,1790853300,1790854200,1790855100,1790856000,1790856900,1790857800,1790858700,1790859600],\"countries\":[{\"name\":\"Austria\",\"data\":[-0.936,-1.08,-1.037,-0.885,-0.44,-0.402,-0.366,-0.332,-0.105,-0.031,-0.002,-0.044,0.012]},{\"name\":\"Belgium\",\"data\":[0.548,0.428,0.228,0.312,-0.094,-0.348,-0.106,-0.366,-0.552,-0.46,-0.654,-0.426,-0.313]},{\"name\":\"Czech Republic\",\"data\":[0.97,0.904,0.968,1.078,1.617,1.753,1.781,1.874,2.088,2.146,2.145,2.353,2.605]},{\"name\":\"Denmark\",\"data\":[2.692,2.751,2.584,2.48,2.429,2.377,2.279,2.298,1.73,1.533,1.123,1.115,2.533]},{\"name\":\"France\",\"data\":[-0.914,-0.901,-0.93,-0.553,-0.579,-0.582,-0.378,-0.292,-0.484,-0.554,-0.529,-0.393,-0.464]},{\"name\":\"Luxembourg\",\"data\":[-0.53,-0.546,-0.512,-0.487,-0.481,-0.461,-0.459,-0.428,-0.412,-0.421,-0.382,-0.386,-0.416]},{\"name\":\"Netherlands\",\"data\":[0.522,0.881,1.218,1.201,1.407,1.709,1.63,1.625,1.951,1.885,2.026,1.96,1.958]},{\"name\":\"Norway\",\"data\":[0.925,0.965,1.006,1.002,0.953,0.874,0.826,0.852,0.819,0.872,1.063,1.191,1.195]},{\"name\":\"Poland\",\"data\":[0.581,0.549,0.648,0.697,1.152,1.286,1.34,1.442,1.599,1.516,1.408,1.644,1.828]},{\"name\":\"Sweden\",\"data\":[0.413,0.414,0.413,0.414,0.421,0.421,0.421,0.422,0.431,0.431,0.431,0.432,0.432]},{\"name\":\"Switzerland\",\"data\":[-1.446,-1.607,-1.417,-1.096,-0.88,-0.981,-0.782,-0.665,-0.975,-0.938,-0.955,-0.933,-0.98]},{\"name\":\"sum\",\"data\":[2.825,2.757,3.17,4.162,5.505,5.646,6.187,6.43,6.089,5.98,5.674,6.512,8.388]}],\"deprecated\":false}",
                    "includePrices": true,
                    "includeFlows": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnergyGridExplorerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "EnergyGridExplorerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "source": {
            "title": "Data source",
            "type": "string",
            "enum": [
              "live",
              "pasted"
            ],
            "default": "live"
          },
          "country": {
            "title": "Country",
            "type": "string",
            "enum": [
              "de",
              "at",
              "be",
              "bg",
              "ch",
              "cy",
              "cz",
              "dk",
              "ee",
              "es",
              "fi",
              "fr",
              "gr",
              "hr",
              "hu",
              "ie",
              "it",
              "lt",
              "lu",
              "lv",
              "nl",
              "no",
              "pl",
              "pt",
              "ro",
              "se",
              "si",
              "sk",
              "uk",
              "ba",
              "ge",
              "md",
              "me",
              "mk",
              "rs",
              "ua",
              "xk",
              "eu"
            ],
            "default": "de"
          },
          "startDate": {
            "title": "From (local date)",
            "description": "Default: yesterday. Energy-Charts interprets dates in Central European time.",
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "title": "To (local date, inclusive)",
            "description": "Max 31 days per request.",
            "type": "string",
            "format": "date"
          },
          "includePrices": {
            "title": "Day-ahead prices",
            "type": "boolean",
            "default": true
          },
          "includeFlows": {
            "title": "Cross-border physical flows",
            "type": "boolean",
            "default": true
          },
          "pastedPower": {
            "title": "Pasted /public_power JSON",
            "type": "string",
            "maxLength": 3000000
          },
          "pastedPrice": {
            "title": "Pasted /price JSON (optional)",
            "type": "string",
            "maxLength": 1000000
          },
          "pastedFlows": {
            "title": "Pasted /cbpf JSON (optional)",
            "type": "string",
            "maxLength": 2000000
          }
        },
        "required": []
      },
      "EnergyGridExplorerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "country",
              "countryName",
              "period",
              "generation",
              "mix",
              "load",
              "prices",
              "flows",
              "outages"
            ],
            "properties": {
              "country": {
                "type": "string"
              },
              "countryName": {
                "type": "string"
              },
              "period": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "requestedStart",
                  "requestedEnd",
                  "firstSample",
                  "lastSample",
                  "samples",
                  "stepMinutes"
                ],
                "properties": {
                  "requestedStart": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "requestedEnd": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "firstSample": {
                    "type": "string"
                  },
                  "lastSample": {
                    "type": "string"
                  },
                  "samples": {
                    "type": "integer"
                  },
                  "stepMinutes": {
                    "type": "number"
                  }
                }
              },
              "generation": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "totalGWh",
                  "renewableGWh",
                  "renewableSharePct",
                  "apiRenewableShareOfGenerationPct",
                  "apiRenewableShareOfLoadPct",
                  "netTradingGWh",
                  "pumpedStorageChargingGWh",
                  "residualLoadPeakMW"
                ],
                "properties": {
                  "totalGWh": {
                    "type": "number"
                  },
                  "renewableGWh": {
                    "type": "number"
                  },
                  "renewableSharePct": {
                    "type": "number"
                  },
                  "apiRenewableShareOfGenerationPct": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Unweighted mean of the Energy-Charts series."
                  },
                  "apiRenewableShareOfLoadPct": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "netTradingGWh": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Scheduled cross-border trading balance (positive = import)."
                  },
                  "pumpedStorageChargingGWh": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "residualLoadPeakMW": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                }
              },
              "mix": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "gwh",
                    "sharePct",
                    "peakMW",
                    "renewableWeight"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "gwh": {
                      "type": "number"
                    },
                    "sharePct": {
                      "type": "number"
                    },
                    "peakMW": {
                      "type": "number"
                    },
                    "renewableWeight": {
                      "type": "number"
                    }
                  }
                }
              },
              "load": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "avgMW",
                  "peakMW",
                  "peakAt",
                  "minMW",
                  "minAt",
                  "energyGWh"
                ],
                "properties": {
                  "avgMW": {
                    "type": "number"
                  },
                  "peakMW": {
                    "type": "number"
                  },
                  "peakAt": {
                    "type": "string"
                  },
                  "minMW": {
                    "type": "number"
                  },
                  "minAt": {
                    "type": "string"
                  },
                  "energyGWh": {
                    "type": "number"
                  }
                }
              },
              "prices": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "zone",
                  "unit",
                  "avg",
                  "max",
                  "maxAt",
                  "min",
                  "minAt",
                  "negativeIntervals",
                  "intervals",
                  "license"
                ],
                "properties": {
                  "zone": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "unit": {
                    "type": "string"
                  },
                  "avg": {
                    "type": "number"
                  },
                  "max": {
                    "type": "number"
                  },
                  "maxAt": {
                    "type": "string"
                  },
                  "min": {
                    "type": "number"
                  },
                  "minAt": {
                    "type": "string"
                  },
                  "negativeIntervals": {
                    "type": "integer"
                  },
                  "intervals": {
                    "type": "integer"
                  },
                  "license": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "flows": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "netImportGWh",
                  "neighbours"
                ],
                "properties": {
                  "netImportGWh": {
                    "type": "number"
                  },
                  "neighbours": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "name",
                        "netImportGWh",
                        "maxImportGW",
                        "maxExportGW"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "netImportGWh": {
                          "type": "number"
                        },
                        "maxImportGW": {
                          "type": "number"
                        },
                        "maxExportGW": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              },
              "outages": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "available",
                  "note"
                ],
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}