# Carbon Monitor Scraper (`codingfrontend/carbon-monitor-scraper`) Actor

Extract daily country- and sector-level CO2 estimates from Carbon Monitor public data; independent and not endorsed by Carbon Monitor.

- **URL**: https://apify.com/codingfrontend/carbon-monitor-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Other, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

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

## Carbon Monitor Scraper

Extract real daily CO2-emissions estimates from Carbon Monitor's public global dataset. Filter the data by country or region, sector, and inclusive date range, then receive normalized JSON records ready for analysis, dashboards, research pipelines, spreadsheets, or data warehouses.

Carbon Monitor is an international scientific initiative that publishes regularly updated daily estimates of fossil-fuel and cement-production CO2 emissions. Its website states that the data are freely available under a fair-use open-data policy and encourages users to cite the Carbon Monitor research. This Actor is an independent community integration and is not affiliated with or endorsed by Carbon Monitor or its supporting institutions.

### What it extracts

Every result contains:

- stable `recordId` built from country, ISO date, and sector;
- `country` or region exactly as published;
- normalized `date` in `YYYY-MM-DD` form;
- Carbon Monitor `sector`;
- numeric `emissionsMtCO2PerDay`;
- explicit `unit` of `MtCO2/day`;
- source release date and source filename when provided by the download response;
- direct dataset URL, source-page URL, and scrape timestamp.

The supported sectors are Domestic Aviation, Ground Transport, Industry, International Aviation, Power, and Residential. Leave the sector as `all` to return every sector matching the other filters.

### Input example

```json
{
  "country": "Austria",
  "sector": "Power",
  "dateFrom": "2025-01-01",
  "dateTo": "2025-01-31",
  "maxResults": 100
}
```

`country` is an exact case-insensitive filter. Leave it empty to include all published countries and regions. `dateFrom` and `dateTo` are optional inclusive ISO dates. `maxResults` caps unique emitted rows; `maxRowsScanned`, `maxDownloadMbytes`, `maxRunMillis`, and `maxRetries` provide operational safety limits. An optional Apify Proxy configuration is accepted, though direct access normally works.

### Data quality and responsible operation

The Actor downloads the official CSV once per run, validates the HTTP status and CSV content type, enforces a response-size guard, and parses rows as a stream. It validates dates and numeric emissions, removes duplicate country-date-sector identities, and omits unavailable optional metadata. It never generates placeholder records, mock values, or hardcoded success.

Downloads use a consistent browser identity, bounded exponential retries, and one request at a time. Runs have an Actor-side deadline below five minutes.

### Important limitations

Carbon Monitor is a living scientific dataset. Values can change as new activity data arrive, errors are corrected, or methods are revised. These are estimates, not direct measurements at individual facilities and not official national greenhouse-gas inventories. Sector and geographic coverage follow the source dataset. Results should be interpreted with Carbon Monitor's methods and cited research, and users remain responsible for analytical conclusions based on the data.

The source CSV may grow over time. If it exceeds the configured size or scan guard, the Actor fails clearly so callers can raise the limit deliberately rather than receiving a silently truncated dataset.

# Actor input Schema

## `country` (type: `string`):

Optional case-insensitive exact country/region name. Leave empty to include all.

## `sector` (type: `string`):

Optional exact Carbon Monitor sector.

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

Optional inclusive ISO date (YYYY-MM-DD).

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

Optional inclusive ISO date (YYYY-MM-DD).

## `maxResults` (type: `integer`):

Maximum unique daily country-sector records to save.

## `maxRowsScanned` (type: `integer`):

Safety cap while streaming the downloaded CSV.

## `maxDownloadMbytes` (type: `integer`):

Reject the public CSV if its response exceeds this memory-safety guard.

## `maxRunMillis` (type: `integer`):

Actor-side deadline capped below five minutes.

## `maxRetries` (type: `integer`):

Bounded attempts with exponential backoff.

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

Optional Apify Proxy. The public Carbon Monitor endpoint normally works directly.

## Actor input object example

```json
{
  "country": "Austria",
  "sector": "all",
  "maxResults": 100,
  "maxRowsScanned": 2000000,
  "maxDownloadMbytes": 100,
  "maxRunMillis": 240000,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (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("codingfrontend/carbon-monitor-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("codingfrontend/carbon-monitor-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 '{}' |
apify call codingfrontend/carbon-monitor-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/f1HvV9II0gv2Ly659/builds/7LTQsV6m29dbOHhaD/openapi.json
