# UK Electricity Grid Scraper (Elexon BMRS) – Generation & Demand (`ninhothedev/elexon-grid-scraper`) Actor

$0.4/1K 🔥 UK grid scraper! Electricity generation by fuel type & national demand, half-hourly. No key. JSON, CSV, Excel or API in seconds. Power energy trading & grid analytics ⚡

- **URL**: https://apify.com/ninhothedev/elexon-grid-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## UK Electricity Grid Scraper (Elexon BMRS)

Scrape **UK national electricity grid data** — half-hourly generation by fuel type and national demand outturn — straight from the official **Elexon BMRS Insights API**. No API key, no login, no proxy required.

Every run gives you clean, flat rows (one fuel type per settlement period) with ISO-8601 timestamps, settlement dates and settlement periods, ready to export as **JSON, CSV, Excel or XML**, or to pull through the Apify API into your own model.

***

### What you get

**Generation mode** — how much electricity Great Britain produced, split by fuel type:

`WIND`, `NUCLEAR`, `CCGT`, `COAL`, `BIOMASS`, `NPSHYD`, `PS`, `OCGT`, `OIL`, `OTHER`, plus interconnector flows (`INTFR`, `INTNED`, `INTNEM`, `INTIFA2`, `INTNSL`, `INTVKL`, `INTELEC`, `INTEW`, `INTGRNL`).

**Demand mode** — Initial National Demand Outturn (INDO) and Initial Transmission System Demand Outturn (ITSDO) per settlement period.

***

### Use cases

- **Energy trading** — build half-hourly fuel-mix and demand features for power price models, spark/dark spread analysis and intraday position sizing.
- **Grid analytics** — monitor renewables penetration, interconnector flows and demand curves; spot ramping events and low-carbon records.
- **ESG & carbon reporting** — derive grid carbon intensity and Scope 2 market-based emissions from a real, auditable fuel mix instead of annual averages.
- **Renewables research** — quantify wind and solar output against capacity, study curtailment, and back-test forecasting models over historical settlement periods.

***

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select: `generation` | `demand` | `generation` | `generation` = output by fuel type. `demand` = national demand outturn. |
| `fromDate` | string `YYYY-MM-DD` | *(empty)* | Start of the settlement-date window. Empty = latest available data. |
| `toDate` | string `YYYY-MM-DD` | *(empty)* | End of the settlement-date window (inclusive). Empty = today. |
| `maxItems` | integer | `500` | Row cap. Max `5000`. |

#### Example input

```json
{
  "mode": "generation",
  "fromDate": "2026-07-20",
  "toDate": "2026-07-21",
  "maxItems": 2000
}
```

Leave `fromDate` and `toDate` empty to get the **latest rolling 24 hours** of generation.

> One day of generation data ≈ 48 settlement periods × ~18 fuel types ≈ **860 rows**. Size `maxItems` accordingly.

***

### Output

#### `mode: "generation"`

```json
{
  "start_time": "2026-07-19T23:00:00+00:00",
  "settlement_date": "2026-07-20",
  "settlement_period": 1,
  "fuel_type": "CCGT",
  "generation_mw": 3678.0,
  "publish_time": "2026-07-19T23:30:00+00:00",
  "dataset": "FUELHH",
  "type": "generation",
  "source": "elexon",
  "scraped_at": "2026-07-28T13:35:04.948298+00:00"
}
```

#### `mode: "demand"`

```json
{
  "start_time": "2026-07-26T23:00:00+00:00",
  "settlement_date": "2026-07-27",
  "settlement_period": 1,
  "demand_mw": 20760.0,
  "transmission_demand_mw": 22905.0,
  "publish_time": "2026-07-26T23:30:00+00:00",
  "dataset": "INDO",
  "type": "demand",
  "source": "elexon",
  "scraped_at": "2026-07-28T13:35:05.406625+00:00"
}
```

All fields are **nullable** — the upstream API omits values for some periods, and the scraper never fails a row because of a missing field.

**Field notes**

- `start_time` / `publish_time` — normalised from Elexon's `startTime` / `publishTime` (`...Z`) to ISO-8601 UTC.
- `settlement_period` — 1–48; each UK settlement period is 30 minutes.
- `generation_mw` — Elexon's `generation`, in megawatts. `0` is meaningful (e.g. coal off) and is preserved, never dropped.
- `demand_mw` — Elexon's `initialDemandOutturn` (INDO).
- `transmission_demand_mw` — Elexon's `initialTransmissionSystemDemandOutturn` (ITSDO).
- `dataset` — which upstream dataset the row came from, so you can trace provenance.

***

### Endpoints used

All under `https://data.elexon.co.uk/bmrs/api/v1` — the open Elexon Insights (BMRS) API, **no key required**:

| Endpoint | Used for | Response shape |
|---|---|---|
| `/datasets/FUELHH?settlementDateFrom=&settlementDateTo=` | Generation by fuel type for a date window (half-hourly) | `{"data": [...]}` |
| `/generation/outturn/summary` | Latest rolling generation summary when no dates are given | bare array with nested `data[]` per period |
| `/datasets/FUELINST?publishDateTimeFrom=&publishDateTimeTo=` | Fallback 5-minute instantaneous fuel mix | `{"data": [...]}` |
| `/demand/outturn?settlementDateFrom=&settlementDateTo=` | National demand outturn (INDO + ITSDO) | `{"data": [...]}` |

The scraper handles **both** shapes and flattens the nested summary payload (parent `startTime` / `settlementPeriod` are inherited by each fuel-type child row).

***

### Pricing

Roughly **$0.5 per 1,000 rows** on the Apify pay-per-result model. A full day of UK fuel-mix data (~860 rows) costs well under a dollar; there are no Elexon fees on top, since the Insights API is free and open.

***

### Notes & limits

- Runs on 512 MB — cheap enough to schedule every 30 minutes alongside settlement periods.
- Data is published by Elexon with a short lag; the newest settlement period may not be available yet.
- Requesting a very wide date window is capped by `maxItems`; split long back-fills into several runs by date range.
- Times are UTC. UK settlement periods 1–48 run from 23:00 UTC the previous day.

***

### Related actors

- [Energy Charts Scraper](https://apify.com/ninhothedev/energy-charts-scraper) — European power generation, prices and load.
- [Carbon Intensity Scraper](https://apify.com/ninhothedev/carbon-intensity-scraper) — UK grid carbon intensity forecasts and regional data.
- [World Bank Scraper](https://apify.com/ninhothedev/worldbank-scraper) — global energy, emissions and macro indicators.
- [Eurostat Scraper](https://apify.com/ninhothedev/eurostat-scraper) — EU energy statistics and datasets.

***

### Data source & licensing

Data comes from **Elexon's BMRS Insights API**, published under Elexon's open data terms. This actor is an unofficial client and is not affiliated with or endorsed by Elexon or NESO. Check Elexon's terms before redistributing raw data.

# Actor input Schema

## `mode` (type: `string`):

What to scrape. 'generation' returns half-hourly electricity generation broken down by fuel type (wind, nuclear, CCGT, biomass, interconnectors...). 'demand' returns the national demand outturn (INDO/ITSDO) per settlement period.

## `fromDate` (type: `string`):

Start of the settlement-date window in YYYY-MM-DD format (e.g. 2026-07-20). Leave empty to get the latest available data: the rolling 24h generation summary, or yesterday-to-today for demand.

## `toDate` (type: `string`):

End of the settlement-date window in YYYY-MM-DD format (inclusive). Leave empty to run up to today. Keep the window short - each day holds 48 settlement periods per fuel type.

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

Maximum number of rows to push to the dataset. One row = one fuel type in one settlement period (generation) or one settlement period (demand).

## Actor input object example

```json
{
  "mode": "generation",
  "fromDate": "2026-07-20",
  "toDate": "2026-07-21",
  "maxItems": 500
}
```

# Actor output Schema

## `records` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/elexon-grid-scraper").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/elexon-grid-scraper").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 '{}' |
apify call ninhothedev/elexon-grid-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/elexon-grid-scraper"
        }
    }
}

```

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/3j54C2AoUKZsezk54/builds/8UqquDVZzfq3nMXrj/openapi.json
