# Uk Electricity Elexon Scraper (`b2b_lead_generation/uk-electricity-elexon-scraper`) Actor

Export UK electricity generation, demand, and system prices effortlessly. Schedule runs on Apify and download clean datasets as JSON, CSV, or Excel for your spreadsheets and offline analysis.

- **URL**: https://apify.com/b2b_lead_generation/uk-electricity-elexon-scraper.md
- **Developed by:** [B2B Lead Generation](https://apify.com/b2b_lead_generation) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## UK Electricity Generation and Market Prices Scraper

<p align="center">
  <img src="https://imgur.com/X3AYTz4.png" alt="UK Electricity Generation and Market Prices" style="max-width:100%; border-radius:14px; width:680px;" />
</p>

Tired of manually checking UK power generation mixes, system prices, and demand reports? This actor handles the heavy lifting for you. It automatically pulls detailed electricity generation outturns, settlement prices, and system demand data directly into a clean, ready-to-use dataset. You can easily schedule it to run automatically on Apify and export everything straight to JSON, CSV, or Excel.

***

### What Data Does This Actor Extract?

Every saved row corresponds to a specific settlement period. Depending on the mode you choose, the output structures your data cleanly:

- **Generation Summary:** Captures fuel-by-fuel breakdowns (such as CCGT, biomass, wind, and more) along with timestamps.
- **System Prices:** Pulls buy and sell prices, net imbalance volumes, and price derivation codes for a given settlement date.
- **Demand Outturn:** Gathers initial demand and transmission system demand numbers over a chosen time window.

#### Example Output

```json
{
  "startTime": "2026-10-10T21:30:00Z",
  "settlementPeriod": 46,
  "data": [
    {"fuelType": "BIOMASS", "generation": 971},
    {"fuelType": "CCGT", "generation": 2743}
  ],
  "scrapeMode": "generation_summary",
  "scrapedAt": "2026-10-12T00:00:00+00:00"
}

```

#### Field Reference

| Field | Type | Description |
| --- | --- | --- |
| `startTime` | string | Period start timestamp |
| `settlementPeriod` | integer | Settlement period number |
| `settlementDate` | string | Settlement date for price and demand rows |
| `data` | array | Fuel mix breakdown for generation summary mode |
| `scrapeMode` | string | Mode used (`generation_summary`, `system_prices`, or `demand`) |
| `systemSellPrice` | number | System sell price |
| `systemBuyPrice` | number | System buy price |
| `netImbalanceVolume` | number | Net imbalance volume |
| `priceDerivationCode` | string | Indicator for how the price was derived |
| `initialDemandOutturn` | integer | Initial demand outturn in MW |
| `initialTransmissionSystemDemandOutturn` | integer | Initial transmission system demand outturn in MW |
| `publishTime` | string | Timestamp when demand figures were published |
| `scrapedAt` | string | UTC timestamp when the row was saved |
| `error` | string | Populated only when a row represents a failed request |

***

### Use Cases

- **Half-Hour Fuel Mix Tracking:** Quickly pull and compare generation shares across different fuel types without manually wrangling messy tables.
- **Imbalance Price Analysis:** Export system buy and sell prices for a single day or walk through a date range effortlessly.
- **Demand Monitoring:** Grab initial demand outturns and transmission numbers over specific windows.
- **Automated Daily Updates:** Set up a scheduled morning run to capture fresh updates and build historical trends over time.
- **Spreadsheet Workflow:** Download your dataset as a CSV or Excel spreadsheet for offline modeling and reports.

***

### Input Parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `mode` | string | `generation_summary` | The data feed to collect (`generation_summary`, `system_prices`, or `demand`). |
| `dataset` | string | empty | Optional alias for `mode`. If both are provided, `mode` takes precedence. |
| `dateFrom` | string | empty | First settlement date (`YYYY-MM-DD`). |
| `dateTo` | string | empty | Last settlement date (inclusive, `YYYY-MM-DD`). |
| `maxItems` | integer | 100 | Maximum row cap for the run (hard max is 1000). |
| `timeoutSecs` | integer | 300 | Maximum runtime in seconds before stopping new requests. |
| `requestTimeoutSecs` | integer | 30 | Per-request timeout in seconds. |

*Note on blank dates:* Leaving date fields empty will default to the most recent published records for generation summaries, or yesterday's date for system prices and demand modes.

***

### How Runs Work

Generation summaries pull the latest available half-hour blocks in one go. System prices fetch data day by day, while demand handles date windows seamlessly. Requests run sequentially with a brief pause between them to keep things running smoothly.

Failed requests are handled gracefully, turning into clean error rows rather than crashing your entire pipeline. Duplicate settlement periods are automatically filtered out, and the run stops as soon as it hits either your `maxItems` cap or the `timeoutSecs` limit.

***

### FAQ

- **Can I export to CSV, JSON, or Excel?**
  Yes, you can download your final dataset directly from Apify in your preferred format.
- **What happens if a date is invalid?**
  The actor will capture a clean error row describing the issue rather than crashing the run. The same behavior applies if a response returns an unexpected server status.
- **How many rows can a single run collect?**
  The default limit is 100 items, and it can scale up to 1,000 items per run.
- **Can it fetch multiple days of system prices?**
  Absolutely. Just specify your `dateFrom` and `dateTo` range and ensure `maxItems` is high enough to cover the span.

***

### Trademark Notice

UK Electricity Market and related names, logos, and trademarks belong to their respective owners. Their use in this documentation is solely to identify the source of the data and does not imply affiliation, sponsorship, endorsement, or partnership.

### Disclaimer

This Actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or otherwise officially associated with UK Electricity Market or its owners. All data is collected from publicly available sources. Users are responsible for complying with the source's terms of use, rate limits, and attribution or licensing requirements.

### Is Web Scraping Legal?

This Actor only collects publicly available data without interfering with secure environments or bypassing access controls. However, how you use the collected data matters:

- **Copyright:** Some content may be protected by copyright. Do not republish full copyrighted content without permission.
- **Terms of Use:** Respect the source's terms, stated rate limits, and any attribution or non-commercial-use requirements.
- **Legal Advice:** This is general information, not legal advice. If you're unsure about specific use cases, consult a qualified lawyer.

# Actor input Schema

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

Which public Elexon feed to collect. generation_summary is fuel outturn by settlement period, system_prices is imbalance prices for each settlement date, and demand is initial demand outturn.

## `dataset` (type: `string`):

Optional alias for mode. Accepted values are generation_summary, system_prices, and demand. When mode is set, mode wins.

## `dateFrom` (type: `string`):

First settlement date, YYYY-MM-DD. System prices request one day at a time from this date. Demand sends it as settlementDateFrom. Generation summary keeps periods whose start time falls on or after this date. Leave blank to use yesterday in UTC for prices and demand, or the API's current window for generation.

## `dateTo` (type: `string`):

Last settlement date, YYYY-MM-DD, inclusive. System prices walk each date through this day. Demand sends it as settlementDateTo. Generation summary drops periods that start after this date. Leave blank to match dateFrom, or yesterday in UTC when both dates are blank.

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

Maximum dataset rows for this run, including error rows. Default 100. Values above 1000 are clamped to 1000.

## `timeoutSecs` (type: `integer`):

Overall run limit in seconds. The actor stops starting new requests when this elapses. Default 300. Maximum 3600.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for a single Elexon response, in seconds. Default 30.

## `proxyConfiguration` (type: `object`):

Optional proxy for requests. Leave this off. The public Elexon API is called directly and does not need a proxy. Turn one on only if your network cannot reach data.elexon.co.uk.

## Actor input object example

```json
{
  "mode": "generation_summary",
  "dataset": "generation_summary",
  "dateFrom": "2026-10-10",
  "dateTo": "2026-10-10",
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetUrl` (type: `string`):

API URL for the default dataset of this run.

## `datasetItemsUrl` (type: `string`):

Item list for the default dataset.

## `overviewUrl` (type: `string`):

Overview table of settlement rows.

# 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 = {
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2b_lead_generation/uk-electricity-elexon-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 = { "proxyConfiguration": { "useApifyProxy": False } }

# Run the Actor and wait for it to finish
run = client.actor("b2b_lead_generation/uk-electricity-elexon-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 '{
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call b2b_lead_generation/uk-electricity-elexon-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,b2b_lead_generation/uk-electricity-elexon-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/kDKYWGYOYs70WEYee/builds/8mI1zTbbPMHA9xo0L/openapi.json
