# Grid Carbon Intensity Forecast: Greenest Time to Run (`wooden_scanner_c1n/eu-grid-carbon-window`) Actor

When is electricity greenest? Give a grid zone (Denmark, France, Germany), job length and deadline. Get the lowest-carbon (gCO2/kWh) or cheapest window from the carbon intensity forecast, % CO2 saved vs now, and sources. Carbon-aware scheduling for CI, AI training, EV charging. No API key.

- **URL**: https://apify.com/wooden_scanner_c1n/eu-grid-carbon-window.md
- **Developed by:** [Sean](https://apify.com/wooden_scanner_c1n) (community)
- **Categories:** Developer tools, AI, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 recommended windows

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/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

## EU Grid Carbon & Price Window Finder (Denmark, France, Germany)

**When should this job run?** Give a grid zone, a job length and a deadline. You get back the cleanest (lowest gCO₂/kWh) or cheapest N-hour window before the deadline, the average carbon intensity and day-ahead price for that window, how much you save compared with starting right away, and the source and licence for every figure.

No API key and no sign-up. All the data comes from official, open-licence publishers: Energinet (Denmark), RTE (France) and the Bundesnetzagentur's SMARD platform (Germany).

### Who it's for

- **Carbon-aware CI/CD, ML training and batch schedulers.** Shift a 3-hour nightly job to the greenest hours in DK, FR or DE.
- **EV charging, heat-pump and battery apps.** In Denmark you can pick the cheapest or the cleanest hours.
- **AI agents and sustainability tools** that need one answer ("start at 11:00 local, 22% less CO₂") rather than a raw time series.
- **Teams comparing regions.** `crossZoneCarbonRank` ranks the zones you asked for by the carbon intensity of their best window.

This is a cheaper alternative to commercial carbon-intensity APIs for these three countries.

### Input

| Field | What it does | Default |
|---|---|---|
| `zones` | Any of `DK1` (West Denmark), `DK2` (East Denmark), `FR`, `DE` | `["DK1","FR","DE"]` |
| `jobHours` | Job length in whole hours (1–24) | `3` |
| `deadlineHours` | The job must finish within this many hours (1–48) | `24` |
| `deadline` | Exact finish-by time in ISO 8601, e.g. `2026-11-05T07:00:00Z`. Overrides `deadlineHours`. A time with no zone is read as UTC. | – |
| `earliestStart` | The job can't start before this ISO 8601 time | now |
| `optimiseFor` | `carbon`, `price` (DK1/DK2 only) or `both` | `carbon` |
| `alternatives` | Number of non-overlapping windows per zone, best first (1–5) | `1` |
| `includeHourly` | Adds the hour-by-hour figures behind each window | `false` |

Example:

```json
{ "zones": ["DK2", "DE"], "jobHours": 4, "deadline": "2026-11-05T06:00:00+01:00", "optimiseFor": "both" }
```

### Output (one record per window)

```json
{
  "zone": "DK2", "zoneName": "Denmark East (DK2)", "objective": "carbon", "rank": 1, "jobHours": 2,
  "windowStartUtc": "2026-11-04T10:00:00+00:00", "windowEndUtc": "2026-11-04T12:00:00+00:00",
  "windowStartLocal": "2026-11-04T11:00:00+01:00", "localTimezone": "Europe/Copenhagen",
  "avgCarbonIntensityGPerKWh": 105.0, "avgPriceEurPerMWh": 257.53,
  "earliestStartCarbonIntensityGPerKWh": 138.4, "earliestStartPriceEurPerMWh": 311.01,
  "carbonSavingPct": 24.2, "priceSavingPct": 17.2,
  "dataKinds": {"forecast": 2}, "candidateWindows": 11, "horizonLimited": false,
  "dataHorizonUtc": "2026-11-04T23:00:00+00:00", "crossZoneCarbonRank": 1,
  "latestActual": {"timeUtc": "2026-11-03T22:10:00+00:00", "carbonIntensity": 129.0},
  "method": "Energinet's own CO2 intensity: CO2EmisProg forecast ...",
  "sources": [{"name": "Energinet, Energi Data Service", "licence": "CC BY 4.0", "licenceUrl": "https://www.energidataservice.dk/terms-and-conditions", "attribution": "Source: Energinet (www.energidataservice.dk) ..."}],
  "licence": "Energinet, Energi Data Service ...: CC BY 4.0 (...)",
  "generatedAtUtc": "2026-11-03T22:10:41+00:00"
}
```

- `carbonSavingPct` and `priceSavingPct` compare the window with starting at your earliest allowed time (now, by default).
- `dataKinds` says whether each hour is an official `forecast`, a statistical `estimate`, or `actual` measured data.
- `horizonLimited: true` means the published forecasts end before your deadline, so later hours couldn't be considered.
- If a zone can't be answered (no price for that zone, a source is down, or no window fits), you get a record with an `error` field and **no charge**.

### How the figures are made

| Zone | Carbon intensity | Price |
|---|---|---|
| DK1 / DK2 | Energinet's own CO₂ intensity: the `CO2EmisProg` forecast (5-min data averaged per hour) and `CO2Emis` actuals | Energinet `DayAheadPrices` (15-min data averaged per hour) |
| FR | RTE éCO2mix `taux_co2`. RTE publishes **no CO₂ forecast**, so future hours are an estimate: the 7-day average for that hour of day, scaled toward the latest measured level. | Not available under an open licence |
| DE | Calculated from the SMARD generation mix using IPCC AR5 lifecycle median emission factors. The forecast uses SMARD's wind + solar forecast and its forecast of other generation; the factor for other generation is calibrated on the last 48 h of actuals. | Not offered. SMARD asks users not to reuse wholesale prices while its HEDWIG licensing review is running. |

Each country's figures follow that country's own method. Denmark and France publish their own intensity numbers, while Germany's is lifecycle-based, so treat comparisons across zones as indicative. Windows are aligned to whole hours. If your earliest start falls partway through an hour, the first window starts at that exact time and uses that hour's figures.

### Pricing (pay per event)

- **$0.005** per run (Actor start)
- **$0.01** per window returned

The default run returns 3 windows (DK1, FR, DE) and costs about $0.035. Notices that carry an `error` are free.

### Data sources & licences

- **Denmark:** Energinet, Energi Data Service, [CC BY 4.0](https://www.energidataservice.dk/terms-and-conditions). "Users may copy, change and distribute data freely, even for commercial purposes." Source: Energinet (www.energidataservice.dk).
- **France:** RTE éCO2mix via ODRÉ, [Licence Ouverte v2.0 (Etalab)](https://odre.opendatasoft.com/explore/dataset/eco2mix-national-tr/).
- **Germany:** Bundesnetzagentur | SMARD.de, [CC BY 4.0](https://www.smard.de/en/datennutzung).

The GB Carbon Intensity API and Spain's REE data are left out on purpose, because their terms forbid resale or commercial reuse. Source responses are cached for 5–60 minutes, matching each source's update rate, so heavy use doesn't hammer the publishers. The data is grid-level only and contains no personal data.

### Limits

- Forecast horizons are set by the publishers. Denmark and Germany usually run to the end of the next day (24–34 h ahead). France's estimate is capped at 48 h.
- The output is decision support, not a guarantee. Forecasts change during the day.
- Energinet rate-limits its API. If it's busy, the run waits up to about a minute once, then returns a free `error` record for the Danish zones.

### Use from AI agents (MCP)

This Actor works as a tool through the [Apify MCP server](https://mcp.apify.com). An agent can call it with `{"zones":["FR","DE"],"jobHours":2,"deadlineHours":12}` and read `windowStartLocal` and `carbonSavingPct` from the first record. Every record carries its own `sources` and `licence`, so the agent can cite them.

# Actor input Schema

## `zones` (type: `array`):

Where the job will draw power. DK1 = West Denmark, DK2 = East Denmark, FR = France, DE = Germany. One result per zone (per objective and alternative).

## `jobHours` (type: `integer`):

How many consecutive hours the job runs.

## `deadlineHours` (type: `integer`):

The job must finish within this many hours. Ignored if 'Deadline (exact time)' is set. Forecasts usually reach 24-34 hours ahead.

## `deadline` (type: `string`):

ISO 8601 date-time the job must finish by, e.g. 2026-11-05T07:00:00Z or 2026-11-05T08:00:00+01:00. No time zone means UTC. Capped at 48 h ahead.

## `earliestStart` (type: `string`):

ISO 8601 date-time before which the job cannot start. Defaults to now.

## `optimiseFor` (type: `string`):

'carbon' = lowest average gCO2/kWh; 'price' = lowest average day-ahead price (DK1 and DK2 only); 'both' = one result for each.

## `alternatives` (type: `integer`):

How many non-overlapping windows to return per zone and objective, best first. You pay per window returned.

## `includeHourly` (type: `boolean`):

Add the hourly carbon intensity, price and data kind (forecast / estimate / actual) for each window. No extra charge.

## Actor input object example

```json
{
  "zones": [
    "DK1",
    "FR",
    "DE"
  ],
  "jobHours": 3,
  "deadlineHours": 24,
  "optimiseFor": "carbon",
  "alternatives": 1,
  "includeHourly": false
}
```

# Actor output Schema

## `results` (type: `string`):

All windows returned by the run, with source attribution on each.

# 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 = {
    "zones": [
        "DK1",
        "FR",
        "DE"
    ],
    "jobHours": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("wooden_scanner_c1n/eu-grid-carbon-window").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 = {
    "zones": [
        "DK1",
        "FR",
        "DE",
    ],
    "jobHours": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("wooden_scanner_c1n/eu-grid-carbon-window").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 '{
  "zones": [
    "DK1",
    "FR",
    "DE"
  ],
  "jobHours": 3
}' |
apify call wooden_scanner_c1n/eu-grid-carbon-window --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wooden_scanner_c1n/eu-grid-carbon-window"
        }
    }
}
```

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/JQTLfm5rpCDhvX2A6/builds/YdwgKTiZy5TGafXZH/openapi.json
