Train: DEFRA π¬π§
Calculate passenger rail emissions with the UK government's DEFRA conversion factors, by train type and energy scope, pinned to a Conversion Factors year if you need to.
About the methodology
DEFRA (Department for Environment, Food & Rural Affairs) provides conversion factors and guidelines for calculating greenhouse gas (GHG) emissions across sectors, including passenger rail. As one of the main references for emissions reporting in the UK, DEFRA's methodology keeps assessments of train travel consistent, transparent and accurate.
The methodology covers direct emissions from train fuel combustion and indirect emissions from electricity consumption. DEFRA distinguishes between electric and diesel trains, and emissions vary with fuel type, train type (for example national, international, light rail) and distance travelled. The framework is widely used in corporate GHG reporting.
Versions
Add methodology_version to pin a DEFRA Conversion Factors year (for example "2024"). If you omit it, SQUAKE automatically applies the latest supported year. Pin a year for reproducibility and audit readiness.
Sample requests
Send a quote before booking, then repeat the call with audit set to true once the booking is final. The body is otherwise identical.
{
"expand": ["items"],
"items": [{
"audit": false,
"type": "train",
"external_reference": "test_1",
"origin": "BER",
"destination": "FRA",
"number_of_travelers": 3,
"train_type": "national",
"methodology": "DEFRA",
"energy_scope": "ttw",
"methodology_version": "2024"
}]
}audit_for is optional
Pass the ID of an auditable entity when you calculate on behalf of that entity. Otherwise, leave it out.
Defaults
| Field | Default | Applies when |
|---|---|---|
train_type | national | No train_type is sent |
energy_scope | wtw | No energy_scope is sent |
methodology_version | Latest supported DEFRA year | No methodology_version is sent |
Request fields
typestringrequiredtrain
methodologystringrequiredDEFRA
methodology_versionstringDEFRA Conversion Factors year, for example "2024". If omitted, SQUAKE uses the latest supported year.
external_referencestringA unique identifier to link the result, up to 128 characters.
number_of_travelersintegerMinimum 1. Defaults to 1.
originstringFlexible formats: postal, IATA/ICAO (^[A-Z]{3,4}$), UN/LOCODE (^[A-Z]{2}\W?[A-Z2-9]{3}$) or "lat,lon". SQUAKE resolves the distance automatically. See Origin and destination formats.
destinationstringSame formats as origin.
distance_in_kmnumberIf provided, overrides origin and destination.
train_typeenumSupported categories (per DEFRA): "national", "international", "light", "tram", "underground".
energy_scopeenum"wtw" (default) or "ttw".
auditbooleanSet to true to create immutable audit records for finalised calculations. Must be enabled for your account.
POST /v2/calculations in the API referenceOrigin and destination formats
SQUAKE tries to resolve origin and destination whatever their format. Ideally, use:
- Addresses: the Post standard.
- Airports: an IATA/ICAO code (regex
^[A-Z]{3,4}$, for example"MUC"). - Ports and trade locations: a UN/LOCODE (regex
^[A-Z]{2}\W?[A-Z2-9]{3}$, for example"DEHAM"). - Coordinates: latitude and longitude (regex
^[-+]?\d{1,3}\.\d{1,10}\s?,\s?[-+]?\d{1,3}\.\d{1,10}$, for example"+40.712,-74.006").
UIC and provider codes
A UIC code is also a valid format for trains. If the value isn't valid, the system falls back to general, non-journey-specific emission data.
To use a UIC or provider code, send <provider>:<uic_code>, for example sncf:FRAAA. Possible provider prefixes: uic, uic8_sncf, sncf, sncf_tvs, entur, db, busbud, distribusion, flixbus, cff, leoexpress, obb, trenitalia, trenitalia_rtvt, trenord, ntv_rtiv, ntv, hkx, renfe, atoc, benerail, westbahn.
{
"type": "train",
"methodology": "DEFRA",
"origin": "atoc:1072", // Example UK station code structure
"destination": "atoc:5935",
"number_of_travelers": 1,
"energy_scope": "wtw",
"methodology_version": "2024"
}Distance and fallback
- If you send both
origin/destinationanddistance_in_km, SQUAKE usesdistance_in_kmfor emissions. - Invalid, unsupported or unresolvable location codes trigger a fallback to generic (non-journey-specific) factors consistent with the DEFRA methodology.
Sample response
{
"carbon_quantity": 6669,
"carbon_unit": "gram",
"items": [{
"carbon_quantity": 6669,
"carbon_unit": "gram",
"external_reference": "test_2",
"type": "train",
"methodology": "DEFRA",
"methodology_version": "2024",
"distance": 435.0,
"distance_unit": "kilometer"
}]
}Bibliography
- UK Government: Greenhouse gas emissions: Research & statistics.
- DEFRA (2024). Government Greenhouse Gas Conversion Factors for Company Reporting (Rail factors).
- UK Office of Rail and Road. National Rail Trends.
- Eurostar. GHG Methodology Report.