ZeroCarbon Enterprise Logo

Carbon Emissions API: Calculate CO2e in Code, Free

Call a carbon emissions API without signing up: electricity, fuel, flight and freight CO2e with the factor and formula in every response. curl, Python, JS.

Akshit Tiwari

Akshit Tiwari

3 min read

Facts checked 25 October 2026

Key takeaways

  • ZeroCarbon's calculation endpoints work without an API key: send activity data and a country, get CO2e back.
  • Every response carries the emission factor, its source and edition, the scope and the formula, so the number can be checked.
  • No country, no number: factors are national, and the API refuses rather than assume one.
  • The same calculators are available to AI agents over MCP, at the same address with no key.

Most emissions APIs ask you to sign up before you can see a single number. The ZeroCarbon emissions API does not: its calculation endpoints answer anonymous requests, rate-limited, so you can test the numbers before you build on them. This guide shows the four calculators with real requests and responses.

Your first request: grid electricity

Send the kWh and the country. Scope 2 is calculated with that country's published grid factor for the current edition.

curl -X POST https://zerocarbon.org.in/api/v1/calculate/electricity \
  -H "Content-Type: application/json" \
  -d '{"kwh": 145000, "country_code": "IN"}'
Request
{
  "success": true,
  "data": {
    "emissions_kg_co2e": 97875,
    "emission_factor": 0.675,
    "emission_factor_label": "0.675 kgCO2e/kWh (CEA_CO2_Baseline_v22_FY2025-26 (weighted_average, AR5))",
    "emission_factor_source": "CEA_CO2_Baseline_v22_FY2025-26",
    "scope": "scope_2",
    "activity": { "value": 145000, "unit": "kWh" },
    "formula": "145000 kWh × 0.675 kgCO2e/kWh = 97875.0000 kgCO2e"
  }
}
Response (abridged)

The factor label names the publisher and edition: here the Central Electricity Authority's CO2 Baseline Database, version 22, for FY 2025-26. Send GB instead and you get the UK DESNZ factor; the UK factor guide explains the 2026 change.

The four calculators

ActivityEndpointSend
Grid electricity (Scope 2)/api/v1/calculate/electricitykwh, country_code
Fuel combustion (Scope 1)/api/v1/calculate/fuelfuel_type, amount, unit, country
Business flights (Scope 3)/api/v1/calculate/flightdistance_km, passengers, round_trip, country
Freight (Scope 3)/api/v1/mcp/tools/calculate_freight_emissionsmode, weight_tonnes, distance_km, country
Keyless calculation endpoints. All take JSON in a POST body.

Fuel, in Python

import requests

r = requests.post(
    "https://zerocarbon.org.in/api/v1/calculate/fuel",
    json={"fuel_type": "diesel", "amount": 1000, "unit": "L", "country": "IN"},
)
print(r.json()["data"]["emissions_kg_co2e"])   # 2687.954

1,000 litres of diesel is 2,687.954 kg CO2e at India's factor of 2.687954 kg per litre: 2.68 kg CO2 plus methane and nitrous oxide at AR5 warming potentials. The DG set guide shows how to get the litres right.

Flights and freight, in JavaScript

const post = (path, body) =>
  fetch("https://zerocarbon.org.in" + path, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(body),
  }).then((r) => r.json());

// One traveller, 1,150 km one way: medium haul, 148.35 kg CO2e
await post("/api/v1/calculate/flight", { distance_km: 1150, passengers: 1, country: "IN" });

// 10 tonnes by road over 500 km: 5,000 t-km, 445 kg CO2e
await post("/api/v1/mcp/tools/calculate_freight_emissions",
  { mode: "road", weight_tonnes: 10, distance_km: 500, country: "IN" });

When the API says no

An emissions figure with the wrong factor is worse than none, so the API refuses inputs it cannot price and says what to send instead.

{
  "success": false,
  "error": "There is no published factor for \"kerosene\" in the library yet.",
  "code": "unsupported_input",
  "guidance": "Supported fuel_type values: petrol, diesel, natural_gas, lpg, coal, cng, furnace_oil."
}
No published factor for the input: HTTP 422
  • No country: HTTP 400. Factors are national and no default is assumed.
  • An unknown fuel or mode: HTTP 422 with the accepted values.
  • A flight with no distance: refused. Route distances are not estimated, so send the great-circle distance in km.

With an API key

A key from your ZeroCarbon workspace raises the limits, falls back to your company's country when a request omits it, and unlocks the ledger endpoints: records, drafts, documents and suppliers. Send it in the Authorization header as a Bearer token. The full reference is in the developer docs.

For AI agents

The same calculators, plus EU CBAM default values and BRSR Core GHG indicators, are exposed as an MCP server at https://zerocarbon.org.in/api/v1/mcp (Streamable HTTP). Add it as a custom connector in Claude or ChatGPT, or in Cursor's MCP settings, with no key. Each tool returns structured results with its output schema.

Frequently asked questions

Is there a free carbon emissions API?+

Yes. ZeroCarbon's electricity, fuel, flight and freight calculators answer without an API key, rate-limited. Each response includes the emission factor, its source and the formula.

Which emission factors does the API use?+

Published national factors chosen by the country you send: for example CEA's CO2 Baseline Database for India, DESNZ for the UK and the EPA hub for the US. The factor and its edition are in every response.

Why does the API refuse my request?+

It refuses when it cannot price the input honestly: no country, a fuel or mode with no published factor, or a flight without a distance. The response says what to send instead.

Sources

  1. 1.ZeroCarbon emissions API · ZeroCarbon
  2. 2.API reference · ZeroCarbon developer docs
  3. 3.CO2 Baseline Database for the Indian Power Sector · Central Electricity Authority
  4. 4.Model Context Protocol specification: transports · Model Context Protocol

This article is general information, not legal or tax advice. Regulations change; check the primary source before acting.

All posts

// ZEROCARBON

Emissions data you can defend, prepared by agents, approved by you.

Pre-register