A REST API that estimates per-passenger flight carbon emissions. It serves ground-truth values from an ICAO reference dataset where available, and falls back to a calibrated distance regression everywhere else — consistent with ICAO and IATA methodologies.
One POST gives you emissions, the offset in trees, and the cost to offset.
Exact and reverse lookups against an ICAO emissions reference table for covered routes and cabin classes.
Routes outside the dataset use a piecewise log-linear regression segmented by distance band and aircraft category (~15.5% MAPE).
Economy, premium economy, business, and first are weighted by ICAO Yseat factors (1.00 → 7.97).
Every result includes trees required and offset cost, using EPA's 21 kg CO₂/tree/year over a 40-year lifespan.
Every POST /calculate runs this priority chain.
(origin, destination, cabin_class). ~0% error.CO₂ = exp(b) × distance_corrected_kma, segmented by distance band × aircraft category. ~15.5% MAPE.
Compute and history endpoints may require an X-API-Key header. Use the
interactive Swagger UI to send authenticated requests.
POST /api/v1/carbon-calculator/calculate
Content-Type: application/json
X-API-Key: <your-key>
{
"origin": "JFK",
"destination": "LHR",
"cabin_class": "economy"
}
201 Created
{
"origin": "JFK",
"destination": "LHR",
"cabin_class": "economy",
"distance_km": 5554.0,
"co2_kg_per_passenger": 302.4,
"trees_required": 1,
"offset_amount": 10.0,
"emissions_on_icao": { ... }
}
From ICAO Methodology v13.1 and EPA offset figures.
| Constant | Value |
|---|---|
| CO₂ conversion factor | 3.16 kg CO₂ / kg fuel |
| Yseat — Economy / Premium / Business / First | 1.00 / 1.52 / 5.20 / 7.97 |
| CO₂ absorbed per tree | 21 kg / year (EPA) |
| Tree lifespan · cost | 40 years · $10 |