# UK Carbon Intensity Scraper - Grid CO2, Fuel Mix, Regions (`ninhothedev/carbon-intensity-scraper`) Actor

$0.5/1K 🔥 UK carbon intensity scraper! Grid CO2 forecasts, fuel mix & regional data. No key. JSON, CSV, Excel or API in seconds. Power ESG reporting & smart-charging apps ⚡

- **URL**: https://apify.com/ninhothedev/carbon-intensity-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.50 / 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 Carbon Intensity Scraper — Grid CO₂, Fuel Mix & Regional Data

Scrape the **carbon intensity of the UK electricity grid** straight from the official National Grid ESO / Carbon Intensity API — **no API key, no login, no proxy required**.

Get half-hourly **gCO₂/kWh** forecasts and actuals, the live **generation fuel mix** (wind, solar, gas, nuclear, biomass, hydro, coal, imports), and **per-region carbon intensity for all 18 UK DNO areas** — as clean, flat rows ready for BI tools, dashboards and ESG models.

***

### What you get

| Mode | What it returns | Typical row count |
|---|---|---|
| `intensity` | National half-hourly carbon intensity (forecast, actual, index) | 1 (current) or 48 per day |
| `generation` | National generation fuel mix, one row per fuel | 9 per settlement period |
| `regional` | Carbon intensity + full fuel mix per DNO region | 18 per settlement period |

All three modes accept an optional **date range** for historical back-fill.

***

### Use cases

- **ESG & carbon reporting** — attribute location-based Scope 2 emissions to the actual half-hour your load ran, instead of an annual grid average.
- **Smart EV / battery charging** — shift charging into "low" and "very low" intensity windows, or into the greenest DNO region.
- **Energy apps & dashboards** — power a live "how green is the grid right now?" widget with wind/solar share and a colour-coded index.
- **Climate research** — build multi-year half-hourly datasets of UK grid carbon intensity and fuel mix for decarbonisation studies.

***

### Input

```json
{
  "mode": "regional",
  "fromDate": "2026-07-01T00:00Z",
  "toDate": "2026-07-02T00:00Z",
  "maxItems": 500
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `intensity` | `intensity`, `generation` or `regional` |
| `fromDate` | string | – | Optional ISO 8601 UTC start, e.g. `2026-07-01T00:00Z` |
| `toDate` | string | – | Optional ISO 8601 UTC end. Set both or neither. Max 14 days per run. |
| `maxItems` | integer | `500` | Row cap (max `5000`) |

Leave `fromDate` / `toDate` empty to fetch the **current settlement period** — ideal for a scheduled run every 30 minutes.

***

### Output samples

**`intensity`**

```json
{
  "type": "intensity",
  "period_from": "2026-07-28T11:30:00Z",
  "period_to": "2026-07-28T12:00:00Z",
  "forecast_gco2_kwh": 48,
  "actual_gco2_kwh": 51,
  "index": "low",
  "source": "carbonintensity",
  "scraped_at": "2026-07-28T12:03:35Z"
}
```

**`generation`**

```json
{
  "type": "generation",
  "period_from": "2026-07-28T11:30:00Z",
  "period_to": "2026-07-28T12:00:00Z",
  "fuel": "wind",
  "percentage": 34.9,
  "source": "carbonintensity",
  "scraped_at": "2026-07-28T12:03:36Z"
}
```

**`regional`**

```json
{
  "type": "regional",
  "period_from": "2026-07-28T11:30:00Z",
  "period_to": "2026-07-28T12:00:00Z",
  "region_id": 1,
  "region": "North Scotland",
  "dno_region": "Scottish Hydro Electric Power Distribution",
  "forecast_gco2_kwh": 0,
  "index": "very low",
  "top_fuel": "wind",
  "top_fuel_pct": 94.6,
  "generation_mix": [{ "fuel": "wind", "perc": 94.6 }, { "fuel": "solar", "perc": 5.4 }],
  "source": "carbonintensity",
  "scraped_at": "2026-07-28T12:03:37Z"
}
```

The `index` field uses the official bands: `very low`, `low`, `moderate`, `high`, `very high`.

***

### Pricing

Roughly **$0.5 per 1,000 rows**. A run that fetches the current national intensity costs a fraction of a cent; a full day of regional data (48 periods × 18 regions = 864 rows) costs well under a dollar.

***

### Tips

- **Schedule it every 30 minutes** to build your own half-hourly time series — the grid settles in 30-minute periods.
- `regional` mode is the cheapest way to find the greenest place in the UK to run a flexible workload right now.
- `forecast_gco2_kwh` is available for future periods; `actual_gco2_kwh` fills in retrospectively, so re-scrape recent windows if you need settled values.
- Data is published by National Grid ESO under the terms of the Carbon Intensity API — check their licence before redistributing.

***

### Related actors

- [Energy Charts Scraper](https://apify.com/ninhothedev/energy-charts-scraper) — European power generation, prices and load
- [Air Quality Scraper](https://apify.com/ninhothedev/air-quality-scraper) — global air quality and pollutant readings
- [World Bank Scraper](https://apify.com/ninhothedev/worldbank-scraper) — macro, energy and climate indicators by country
- [NOAA Weather Alerts Scraper](https://apify.com/ninhothedev/noaa-weather-alerts-scraper) — live US weather alerts and warnings

***

### FAQ

**Do I need an API key?** No. The Carbon Intensity API is open and free.

**Do I need proxies?** No. The API is datacenter friendly, so the actor runs without any proxy configuration.

**How far back does history go?** The upstream API serves data back to 2017, in windows of up to 14 days per request.

**How accurate is it?** Forecasts come from National Grid ESO's own model; actuals are derived from settlement data.

# Actor input Schema

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

What to scrape. 'intensity' returns national half-hourly carbon intensity (forecast, actual, index). 'generation' returns the national generation fuel mix with one row per fuel. 'regional' returns carbon intensity plus fuel mix for each of the 18 UK DNO regions.

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

Optional start of the historical window, in ISO 8601 UTC, e.g. 2026-07-01T00:00Z. Must be set together with 'To date'. Leave both empty to fetch the current settlement period only.

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

Optional end of the historical window, in ISO 8601 UTC, e.g. 2026-07-02T00:00Z. Must be set together with 'From date'. The upstream API serves a maximum of 14 days per request.

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

Maximum number of dataset rows to push. Use it to cap cost and runtime on long date ranges. Default 500, maximum 5000.

## Actor input object example

```json
{
  "mode": "intensity",
  "fromDate": "2026-07-01T00:00Z",
  "toDate": "2026-07-02T00:00Z",
  "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/carbon-intensity-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/carbon-intensity-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/carbon-intensity-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/carbon-intensity-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/4AfdlckD0e5bdqSqt/builds/RmeMnNNSRNxNZrNJg/openapi.json
