# UK Carbon Intensity Scraper (`parseforge/carbon-intensity-uk-scraper`) Actor

Export the UK National Grid carbon intensity feed in gCO2/kWh. Pull the current half-hour, the past 24 hours, a custom date range, the regional breakdown for all 14 GB DNO regions, or the live generation mix by fuel source (wind, solar, nuclear, gas, biomass, hydro, imports).

- **URL**: https://apify.com/parseforge/carbon-intensity-uk-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🌍 UK Carbon Intensity Scraper

> 🚀 **Export the UK National Grid's live carbon intensity feed in seconds.** Real-time and forecast gCO2/kWh for every 30-minute slot, regional breakdowns across 14 GB Distribution Network Operator regions, postcode lookups, and per-fuel generation mix. No sign-up.

> 🕒 **Last updated:** 2026-05-15 · **📊 15 fields** per record · **🌍 14 GB DNO regions + national** · **⚡ 30-minute time slots** · **🟢 Live every half-hour**

The **UK Carbon Intensity Scraper** exports the official **National Grid ESO Carbon Intensity** feed and returns **15 fields per record**, including forecast and actual gCO2/kWh, the human-readable intensity index (very low / low / moderate / high / very high), 14 regional breakdowns, postcode-level intensity, and per-fuel generation mix. The Carbon Intensity feed is the canonical reference for measuring grid carbon in Great Britain and powers smart-tariff providers, demand-response apps, and academic decarbonization research.

The catalogue covers **every 30-minute slot** with national, regional (per GB Distribution Network Operator region), and postcode-level views, plus forecast windows up to 48 hours ahead and historical statistics back through the start of the feed. This Actor makes the data downloadable as CSV, Excel, JSON, or XML in under a minute.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Smart-energy startups, EV charging apps, sustainability teams, climate researchers, demand-response platforms, journalism teams, ESG analysts | Carbon-aware computing, smart-tariff billing, EV-charging timing, ESG dashboards, demand-response triggers, academic decarbonization research |

---

### 📋 What the UK Carbon Intensity Scraper does

Eight data modes in a single Actor:

- ⚡ **Current half-hour (national).** The latest 30-minute slot, with forecast and actual gCO2/kWh.
- 🕒 **Past 24 hours (national).** 48 half-hourly observations.
- 📅 **Custom date range (national).** Up to a 14-day window.
- 🗺️ **Regional breakdown.** 14 GB Distribution Network Operator regions plus aggregates for England, Scotland, and Wales.
- 📮 **Postcode lookup.** Outcode-level (e.g. `SW1A`, `M1`, `EH1`) intensity and per-fuel mix.
- 🔌 **Generation mix (national).** Per-fuel percentages for the current half-hour (gas, coal, biomass, nuclear, hydro, imports, solar, wind).
- 📊 **Emission factors.** gCO2/kWh per fuel type used in the methodology.
- 📈 **Intensity statistics.** Min, max, and average across a chosen period.

> 💡 **Why it matters:** carbon-aware decisions need real-time grid data. Building your own pipeline means tracking a half-hourly feed and reconciling regional fuel mixes. This Actor skips all of that and emits one clean record per slot.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing carbon-aware EV charging triggered by Slack._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td><code>mode</code></td><td>string</td><td><code>"current"</code></td><td>Data slice (current, past-24h, date-range, regional, postcode, generation-mix, factors, stats).</td></tr>
<tr><td><code>startDate</code>, <code>endDate</code></td><td>string</td><td><code>""</code></td><td>YYYY-MM-DD or full ISO timestamp. Required for <code>date-range</code> mode (max 14 days).</td></tr>
<tr><td><code>regionFilter</code></td><td>string</td><td><code>"all"</code></td><td>Restrict to one of 14 GB DNO regions plus England, Scotland, and Wales aggregates.</td></tr>
<tr><td><code>postcode</code></td><td>string</td><td><code>""</code></td><td>UK outcode such as <code>SW1A</code>, <code>M1</code>, <code>EH1</code>, <code>CF10</code> for <code>postcode</code> mode.</td></tr>
<tr><td><code>includeGenerationMix</code></td><td>boolean</td><td><code>true</code></td><td>Include per-fuel generation mix on regional and postcode records.</td></tr>
</tbody>
</table>

**Example: current national half-hour with generation mix.**

```json
{
    "maxItems": 1,
    "mode": "current"
}
````

**Example: London regional intensity with fuel mix.**

```json
{
    "maxItems": 1,
    "mode": "regional",
    "regionFilter": "13",
    "includeGenerationMix": true
}
```

> ⚠️ **Good to Know:** the National Grid ESO carbon intensity feed updates on the **half-hour boundary**. Forecast values cover slots up to 48 hours ahead; actual values are filled once the slot closes. Regional breakdowns use the 14 GB Distribution Network Operator regions plus England, Scotland, and Wales aggregates.

***

### 📊 Output

Each record contains **15 fields**. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🕒 `from` | ISO 8601 | `"2026-05-15T18:00Z"` |
| 🕒 `to` | ISO 8601 | `"2026-05-15T18:30Z"` |
| 📊 `forecastGCO2PerKwh` | number | null | `142` |
| 📊 `actualGCO2PerKwh` | number | null | `139` |
| 🚦 `intensityIndex` | string | null | `"moderate"` |
| 🆔 `regionId` | number | null | `13` |
| 📍 `regionName` | string | null | `"London"` |
| 🏢 `dnoOperator` | string | null | `"UK Power Networks"` |
| 🏷️ `shortName` | string | null | `"London"` |
| 📦 `generationMix` | array | null | `[{ "fuel": "gas", "perc": 41.2 }, ...]` |
| 🏷️ `fuel` | string | null | `"gas"` |
| 🏷️ `fuelLabel` | string | null | `"Natural Gas"` |
| 📊 `percentage` | number | null | `41.2` |
| 📂 `scope` | string | `"national"`, `"regional"`, `"postcode"`, `"generation-mix"`, `"factors"`, `"stats"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-15T18:32:11.000Z"` |

#### 📦 Sample records

<details>
<summary><strong>⚡ Current national half-hour</strong></summary>

```json
{
    "from": "2026-05-15T18:00Z",
    "to": "2026-05-15T18:30Z",
    "forecastGCO2PerKwh": 142,
    "actualGCO2PerKwh": 139,
    "intensityIndex": "moderate",
    "regionId": null,
    "regionName": null,
    "dnoOperator": null,
    "shortName": null,
    "generationMix": null,
    "fuel": null,
    "fuelLabel": null,
    "percentage": null,
    "scope": "national",
    "scrapedAt": "2026-05-15T18:32:11.000Z"
}
```

</details>

<details>
<summary><strong>🗺️ Regional breakdown: London</strong></summary>

```json
{
    "from": "2026-05-15T18:00Z",
    "to": "2026-05-15T18:30Z",
    "forecastGCO2PerKwh": 156,
    "actualGCO2PerKwh": null,
    "intensityIndex": "moderate",
    "regionId": 13,
    "regionName": "London",
    "dnoOperator": "UK Power Networks",
    "shortName": "London",
    "generationMix": [
        { "fuel": "gas", "perc": 41.2 },
        { "fuel": "wind", "perc": 22.4 },
        { "fuel": "nuclear", "perc": 14.1 },
        { "fuel": "imports", "perc": 12.6 },
        { "fuel": "biomass", "perc": 4.3 },
        { "fuel": "solar", "perc": 3.1 },
        { "fuel": "hydro", "perc": 1.8 },
        { "fuel": "coal", "perc": 0.5 }
    ],
    "fuel": null,
    "fuelLabel": null,
    "percentage": null,
    "scope": "regional",
    "scrapedAt": "2026-05-15T18:32:11.000Z"
}
```

</details>

<details>
<summary><strong>🔌 Generation mix per fuel: gas</strong></summary>

```json
{
    "from": "2026-05-15T18:00Z",
    "to": "2026-05-15T18:30Z",
    "forecastGCO2PerKwh": null,
    "actualGCO2PerKwh": null,
    "intensityIndex": null,
    "regionId": null,
    "regionName": null,
    "dnoOperator": null,
    "shortName": null,
    "generationMix": null,
    "fuel": "gas",
    "fuelLabel": "Natural Gas",
    "percentage": 41.2,
    "scope": "generation-mix",
    "scrapedAt": "2026-05-15T18:32:11.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| ⚡ | **30-minute granularity.** Every half-hour slot of the GB grid. |
| 🌍 | **Regional + postcode.** 14 GB Distribution Network Operator regions plus outcode-level lookups. |
| 🔌 | **Per-fuel mix.** Gas, coal, biomass, nuclear, hydro, imports, solar, wind. |
| 📅 | **Forecast + actual.** Forecast covers slots up to 48 hours ahead, actuals fill in once the slot closes. |
| 📊 | **Eight data modes.** From current half-hour to multi-day stats from one Actor. |
| ⚡ | **Fast.** A 24-hour national pull completes in under 10 seconds. |
| 🚫 | **No sign-up.** Works against the public National Grid Carbon Intensity feed. |

> 📊 The Carbon Intensity feed underpins smart-tariff providers, EV-charging schedulers, and academic decarbonization research across the UK.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ UK Carbon Intensity Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **National + regional + postcode** | **Live every half-hour** | mode, region, postcode, generation mix | ⚡ 2 min |
| Manual data feed downloads | Free | Same coverage | Manual | None | 🐢 Hours |
| Smart-meter consumer dashboards | Free with provider | Personal usage | Live | None | 🚫 Not bulk-friendly |
| Commercial energy data feeds | $1k+/month | Multi-grid | Live | Many | ⏳ Integration |

Pick this Actor when you want filtered, structured UK grid carbon data without writing a custom integration.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the UK Carbon Intensity Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick a mode (current, past-24h, regional, postcode, etc.) and any filters.
4. 🚀 **Run it.** Click **Start** and let the Actor pull the live feed.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded carbon dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 🔌 Smart Energy & Tariffs

- Bill smart-tariff customers by half-hourly carbon intensity
- Trigger smart-meter device actions on low-carbon slots
- Offer carbon-aware EV charging windows
- Provide demand-response signals to industrial loads

</td>
<td width="50%" valign="top">

#### 🚗 EV Charging & Mobility

- Schedule charge sessions during low-intensity slots
- Surface "greenest time to charge" in mobile apps
- Build carbon-aware fleet-charging schedulers
- Calculate per-trip carbon for EV journey planners

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 📊 ESG, Sustainability & Reporting

- Generate scope-2 emissions disclosures with grid factors
- Build sustainability dashboards by region
- Audit corporate energy consumption against grid carbon
- Power CDP and TCFD reporting workflows

</td>
<td width="50%" valign="top">

#### 🔬 Climate Research & Journalism

- Track decarbonization progress over years
- Compare regional fuel mixes for academic studies
- Power public-interest dashboards on grid greening
- Investigate seasonal coal and gas patterns

</td>
</tr>
</table>

***

### 🔌 Automating UK Carbon Intensity Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor every 30 minutes to track every half-hour slot in real time, or daily to archive yesterday's grid history.

***

### 🌟 Beyond business use cases

Grid-carbon data powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Decarbonization studies across regions and seasons
- Replicate published carbon-aware computing papers
- Teach energy-systems courses with real grid data
- Train ML models on half-hourly fuel mix dynamics

</td>
<td width="50%">

#### 🎨 Personal and creative

- Build a personal "is the grid green right now" widget
- Visualize a year of UK grid carbon as data art
- Power a smart-home rule that runs the dishwasher when carbon is low
- Curate a hobbyist regional-comparison archive

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Provide free carbon data to climate journalism collectives
- Score regional grid greening for advocacy briefs
- Support community-energy programmes with hyperlocal data
- Power civic dashboards on the energy transition

</td>
<td width="50%">

#### 🧪 Experimentation

- Train a forecast-improvement model on actual versus forecast slots
- Validate carbon-aware computing schedulers
- Prototype a postcode-level carbon-aware app
- Test smart-home rules that respond to grid carbon

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20UK%20Carbon%20Intensity%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20UK%20Carbon%20Intensity%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20UK%20Carbon%20Intensity%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20UK%20Carbon%20Intensity%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick a mode (current, past-24h, date-range, regional, postcode, generation-mix, factors, stats), set any filters, and run. The Actor pulls the National Grid Carbon Intensity feed and writes one clean record per 30-minute slot.

#### 📏 How accurate is the data?

Data mirrors the National Grid ESO Carbon Intensity feed exactly. Forecast values cover slots up to 48 hours ahead; actual values backfill once each slot closes. Methodology is documented by the National Grid ESO.

#### 🔁 How fresh is the feed?

Live every 30 minutes. The grid publishes a new half-hourly slot on the boundary; back-to-back Actor runs return updated forecast and actual values.

#### 🗺️ Which regions are covered?

The 14 GB Distribution Network Operator regions plus aggregates for England, Scotland, and Wales: North Scotland, South Scotland, North West England, North East England, Yorkshire, North Wales & Merseyside, South Wales, West Midlands, East Midlands, East England, South West England, South England, London, South East England.

#### 📮 What postcode format does the lookup expect?

Use the UK outcode (the first part of a postcode), such as <code>SW1A</code>, <code>M1</code>, <code>EH1</code>, or <code>CF10</code>. The full postcode is not needed.

#### 🔌 How is the generation mix structured?

Eight fuel types: gas, coal, biomass, nuclear, hydro, imports, solar, wind. Percentages sum to roughly 100% per slot.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to refresh every 30 minutes (live), hourly, or daily.

#### ⚖️ Is this data legal to use?

Yes. The National Grid ESO publishes the Carbon Intensity feed under permissive open-data terms. Attribution is encouraged.

#### 💼 Can I use this data commercially?

Yes. The Carbon Intensity open-data license allows commercial use including in smart-tariff and EV-charging products.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and unlocks scheduling.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

UK Carbon Intensity Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Push low-carbon alerts to channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe carbon data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh half-hourly carbon intensity into a smart-tariff billing system, or trigger an EV-charging session when the index turns very low.

***

### 🔗 Recommended Actors

- [**🚦 TfL London Live Status Scraper**](https://apify.com/parseforge/tfl-london-status-scraper) - Live London transport status and disruptions
- [**🇬🇧 Hansard UK Debates Scraper**](https://apify.com/parseforge/hansard-uk-debates-scraper) - Search the UK Parliament debate record
- [**📰 Guardian Article Search Scraper**](https://apify.com/parseforge/guardian-content-search-scraper) - Search The Guardian's full article archive
- [**📊 Federal Reserve H.15 Rates Scraper**](https://apify.com/parseforge/federalreserve-h15-rates-scraper) - U.S. Treasury yield-curve history
- [**🗺️ OSRM Routing Scraper**](https://apify.com/parseforge/osrm-routing-scraper) - Driving, cycling, and walking routes anywhere

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more energy and UK-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by National Grid ESO or any of its affiliates. All trademarks mentioned are the property of their respective owners. Only publicly available open-energy data is collected.

# Actor input Schema

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

What slice of the carbon intensity feed to fetch.

## `startDate` (type: `string`):

Start of the window in YYYY-MM-DD format.

## `endDate` (type: `string`):

End of the window in YYYY-MM-DD format. Maximum 14 days from startDate.

## `regionFilter` (type: `string`):

Select a single region or fetch all 14.

## `postcode` (type: `string`):

UK outcode such as 'SW1A', 'M1', 'EH1', 'CF10'. The full postcode is not needed.

## `includeGenerationMix` (type: `boolean`):

Include the per-fuel generation mix array on regional / postcode records when available.

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

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## Actor input object example

```json
{
  "mode": "current",
  "regionFilter": "all",
  "postcode": "",
  "includeGenerationMix": true,
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview of scraped data

## `fullData` (type: `string`):

Complete dataset

# 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 = {
    "postcode": "",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/carbon-intensity-uk-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 = {
    "postcode": "",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/carbon-intensity-uk-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "postcode": "",
  "maxItems": 10
}' |
apify call parseforge/carbon-intensity-uk-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/carbon-intensity-uk-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "UK Carbon Intensity Scraper",
        "description": "Export the UK National Grid carbon intensity feed in gCO2/kWh. Pull the current half-hour, the past 24 hours, a custom date range, the regional breakdown for all 14 GB DNO regions, or the live generation mix by fuel source (wind, solar, nuclear, gas, biomass, hydro, imports).",
        "version": "0.0",
        "x-build-id": "ibwAli10S09FhW1VW"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~carbon-intensity-uk-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-carbon-intensity-uk-scraper",
                "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/parseforge~carbon-intensity-uk-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-carbon-intensity-uk-scraper",
                "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/parseforge~carbon-intensity-uk-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-carbon-intensity-uk-scraper",
                "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",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "current",
                            "past-24h",
                            "date-range",
                            "regional",
                            "postcode",
                            "generation-mix",
                            "factors",
                            "stats"
                        ],
                        "type": "string",
                        "description": "What slice of the carbon intensity feed to fetch.",
                        "default": "current"
                    },
                    "startDate": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Start of the window in YYYY-MM-DD format."
                    },
                    "endDate": {
                        "title": "End Date",
                        "type": "string",
                        "description": "End of the window in YYYY-MM-DD format. Maximum 14 days from startDate."
                    },
                    "regionFilter": {
                        "title": "Region Filter",
                        "enum": [
                            "all",
                            "1",
                            "2",
                            "3",
                            "4",
                            "5",
                            "6",
                            "7",
                            "8",
                            "9",
                            "10",
                            "11",
                            "12",
                            "13",
                            "14",
                            "15",
                            "16",
                            "17"
                        ],
                        "type": "string",
                        "description": "Select a single region or fetch all 14.",
                        "default": "all"
                    },
                    "postcode": {
                        "title": "Postcode (Outcode)",
                        "type": "string",
                        "description": "UK outcode such as 'SW1A', 'M1', 'EH1', 'CF10'. The full postcode is not needed.",
                        "default": ""
                    },
                    "includeGenerationMix": {
                        "title": "Include Generation Mix",
                        "type": "boolean",
                        "description": "Include the per-fuel generation mix array on regional / postcode records when available.",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    }
                }
            },
            "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
                                    }
                                }
                            },
                            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
