> For the complete documentation index, see [llms.txt](https://docs-integration.squake.earth/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-integration.squake.earth/api-calculations-request-response/travel/train/train-rem.md).

# Train: REM

Documentation on this page is aligned to **REM methodology v2.4** (integration and Calculation API payloads). Use **`"methodology": "REM"`** in all new integrations.

Set `methodology` to **`REM`** to use REM. If you omit `methodology` on a train item, the API uses your client's configured train default.

***

## Overview

REM is an operator- and country-aware rail methodology. It selects an emission factor (grams CO₂e per passenger-kilometre) using a **deterministic tiered resolver**, then multiplies by distance and passenger count.

Supplying **`operator_name`**, ISO **country codes**, **`departure_date`**, and **`energy_scope`** when you have them improves tier matching and makes results easier to audit.

***

## Factor resolution (tiers)

REM applies this order:

1. **Tier 1 — Operator-reported** Used when `operator_name` matches operator-specific factors for the requested `energy_scope`, `train_type`, and (when needed) `fuel_type` / year.
2. **Tier 2 — Not used** Tier 2 (operator traction-mix proxy) is **not implemented** in production and is **intentionally skipped**. If Tier 1 does not match, resolution continues with Tier 3. Do not expect a Tier 2 step in the fallback chain.
3. **Tier 3 — Country-published** Uses country-level methodology data when **Tier 1** does not apply and a country context is available (see **Country context** below).
4. **Tier 4 — Activity-based** Uses fuel, traction mix, and electricity carbon intensity data for the country / region when Tier 3 does not yield a factor.
5. **Tier 5 — Global constant** Well-to-wheel global rail averages (IEA-based constants), with a pre/post cut-off driven by `departure_date` when present.

**Country context for Tiers 3–4:** The resolver uses **`origin_country`** if set, otherwise **`destination_country`** (both optional). Values should be **ISO 3166-1 alpha-2** (e.g. `DE`, `SE`). The API accepts other resolvable country inputs and normalizes to alpha-2 where possible (e.g. `UK` → `GB`). If neither country field is available, Tier 1 may still apply; otherwise resolution falls through toward **Tier 5**.

Factor tables are maintained as CSV bundles backing REM; methodology and data lineage are described in your internal REM v2.4 source document and operator-factor exports.

***

## Distance handling

You must provide **one** of the following (after validation):

* **`origin` and `destination`** (resolved to a route distance), or
* **`distance_in_km`** (positive number), or
* **`route_coords`**: an array of at least **two** `[longitude, latitude]` pairs (WGS84). Longitude must be in **\[-180, 180]**, latitude in **\[-90, 90]**.

**Precedence:** If **`distance_in_km`** is set together with `origin` / `destination`, **`distance_in_km`** is used for the calculation distance.

**Corrections:**

* If you send **`route_coords`**, the API computes a **border-aware** path distance (per-country segments, train-type **detour factor** from REM data). That total becomes the distance used for emissions; **no additional "air distance" correction** is applied on top.
* If you send **`distance_in_km`** **without** `route_coords`, REM still applies the **air-distance correction** used for straight-line or user-supplied distances (so driven distance is consistent with the methodology).
* For **audit / debugging**, expanded item metadata may include a **`border_distance_breakdown`** when `route_coords` were used (sequential segments and totals per ISO alpha-3 country). If some segments cannot be attributed to a country, a warning may be present.

***

### **Sample API Requests**

#### A. Without audit mode (for pre-booking/quotes)

```json
{
  "expand": ["items"],
  "items": [
    {
      "audit": false,
      "type": "train",
      "external_reference": "test_1",
      "origin": "Stockholm",
      "destination": "Malmo",
      "number_of_travelers": 1,
      "train_type": "high_speed",
      "seat_type": "second_class",
      "fuel_type": "electricity",
      "operator_name": "sj",
      "methodology": "REM",
      "departure_date": "2025-06-15",
      "origin_country": "SE",
      "destination_country": "SE",
      "energy_scope": "wtw"
    }
  ]
}
```

#### B. With audit mode (for finalized/post-booking calculations)

```json
{
  "expand": ["items"],
  "audit_for": "<Auditable Entity ID>",
  "items": [
    {
      "audit": true,
      "type": "train",
      "external_reference": "test_1",
      "origin": "Stockholm",
      "destination": "Malmo",
      "number_of_travelers": 1,
      "train_type": "high_speed",
      "seat_type": "second_class",
      "fuel_type": "electricity",
      "operator_name": "sj",
      "methodology": "REM",
      "departure_date": "2025-06-15",
      "origin_country": "SE",
      "destination_country": "SE",
      "energy_scope": "wtw"
    }
  ]
}
```

> **Note:** `audit_for` is optional. Provide it when calculating on behalf of a specific Auditable entity; otherwise omit.

#### C. Route path (`route_coords`) without origin/destination

When `route_coords` is valid, `origin` and `destination` are not required for distance validation.

```json
{
  "expand": ["items"],
  "items": [
    {
      "type": "train",
      "methodology": "REM",
      "external_reference": "route_coords_1",
      "number_of_travelers": 1,
      "train_type": "high_speed",
      "route_coords": [
        [13.405, 52.52],
        [10.0, 51.0],
        [8.682, 50.11]
      ],
      "operator_name": "db",
      "energy_scope": "wtw"
    }
  ]
}
```

***

### **API request fields**

* **`type`**: `"train"` (required).
* **`methodology`**: `"REM"`. If omitted, the API uses your client's configured train default.
* **`external_reference`**: Unique id for the item in the request (helps map results to inputs). Max length **128** characters.
* **`number_of_travelers`**: Integer ≥ `1`. Default **`1`**.
* **`origin`**, **`destination`**: Location strings as in other train methodologies (addresses, IATA/ICAO, UN/LOCODE, coordinates, UIC/provider codes — see **Origin/destination formats** below). Required unless you supply **`distance_in_km`** or valid **`route_coords`**.
* **`distance_in_km`**: Optional. If provided together with `origin` / `destination`, this value wins. Subject to REM **air-distance correction** unless `route_coords` are used.
* **`route_coords`**: Optional. Array of `[lon, lat]` pairs; minimum **2** points. Each pair must have exactly two numbers. Used for border-aware distance and detour factor.
* **`train_type`**: One of: **`average`**, **`high_speed`**, **`intercity`**, **`regional`**, **`long_distance`**, **`tram`**, **`metro`**, **`light_rail`**. API default when omitted: **`average`**.
* **`fuel_type`**: **`diesel`**, **`electricity`**, **`hvo`**, **`hydrogen`**. Default **`diesel`**. Used for **Tier 1** disambiguation when an operator has multiple fuel rows, and for **Tier 4** modelling where applicable.
* **`seat_type`**: **`average`**, **`first_class`**, or **`second_class`**. Default **`average`**.
* **`operator_name`**: Optional; enables **Tier 1** when the operator exists in the REM operator database. See the [supported operators database](https://squake.notion.site/21a17389cc5c4e38946f97ecaf6435bb?v=6be41159e77247599fe9b3672782fd5e).
* **`departure_date`**: Optional. **ISO 8601 calendar date** only: **`YYYY-MM-DD`** (date-only, not a full timestamp). Used to select year-matched factors. If invalid, the API returns: **`Departure date '<value>' is not a valid ISO-8601 date.`**
* **`origin_country`**, **`destination_country`**: Optional. **ISO 3166-1 alpha-2** recommended (e.g. `DE`, `FR`). Other resolvable country strings may be accepted and normalized to alpha-2. Invalid codes return a parameter error. For country-based tiers, **`origin_country`** is preferred over **`destination_country`** when both are set.
* **`energy_scope`**: **`wtw`** (well-to-wheel, default) or **`ttw`** (tank-to-wheel). Invalid values return an error listing allowed scopes.
* **`audit`**: Optional boolean for immutable audit records (feature must be enabled for your account).

***

## Origin/destination formats (enriched)

We will try to resolve `origin` / `destination` regardless of format. Ideally:

* **Addresses:** Post/standard postal format.
* **Airports:** IATA/ICAO (`^[A-Z]{3,4}$`, e.g. `MUC`).
* **Ports / trade:** UN/LOCODE (`^[A-Z]{2}\W?[A-Z2-9]{3}$`, e.g. `DEHAM`).
* **Coordinates:** `^[-+]?\d{1,3}\.\d{1,10}\s?,\s?[-+]?\d{1,3}\.\d{1,10}$` (e.g. `"+40.712,-74.006"`).

**UIC and provider codes**

* Invalid or unsupported codes may trigger **fallback** to more generic factors (non-journey-specific).
* Format: `<provider>:<uic_code>` (e.g. `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`.

**Examples**

```jsonc
// UIC/provider (illustrative)
{
  "type": "train",
  "methodology": "REM",
  "origin": "entur:7400001",
  "destination": "entur:7400046",
  "operator_name": "sj",
  "number_of_travelers": 1
}

// UN/LOCODE
{
  "type": "train",
  "methodology": "REM",
  "origin": "SESTO",
  "destination": "SEMMA",
  "number_of_travelers": 1
}

// Coordinates
{
  "type": "train",
  "methodology": "REM",
  "origin": "+59.330,18.058",
  "destination": "+55.605,13.003",
  "number_of_travelers": 1
}
```

> **Notes**
>
> * If both `origin`/`destination` and `distance_in_km` are provided, `distance_in_km` is used.
> * Unresolvable locations produce validation errors or methodology fallbacks as described for train generally.

***

### **Sample API response**

When you expand **`items`**, each train item may include **`algorithm_specifics`** describing the resolved REM tier and matched metadata (for example `tier`, `energy_scope`, `gco2e_per_pax_km`, `year_matched`, `country_matched`, `operator_matched`, `source_links`, and resolver `details`). Exact shape follows the live API.

```json
{
  "carbon_quantity": 261,
  "carbon_unit": "gram",
  "items": [
    {
      "carbon_quantity": 261,
      "carbon_unit": "gram",
      "external_reference": "test_1",
      "type": "train",
      "methodology": "REM",
      "distance": 616.0,
      "distance_unit": "kilometer",
      "algorithm_specifics": {
        "tier": 1,
        "energy_scope": "wtw",
        "gco2e_per_pax_km": "0.42",
        "year_matched": 2024,
        "country_matched": "se",
        "operator_matched": "sj",
        "source_links": [],
        "methodology": "operator_reported"
      }
    }
  ]
}
```

> The numeric / string formatting of `algorithm_specifics` fields matches the production API; treat `gco2e_per_pax_km` as a decimal string or number per response schema.

***

### **Bibliography**

* "Which Form of Transport Has the Smallest Carbon Footprint?" *Our World in Data*, ourworldindata.org/travel-carbon-footprint.
* CO2- Berechnung Geschäftsreise VDR-Standard Teil I (2016, March). VDR. Retrieved from <https://www.atmosfair.de/wp-content/uploads/vdr\\_reportingstandard\\_teil1\\_30032016-1.pdf>
* CO2- Berechnung Geschäftsreise VDR-Standard Teil II (2016, March). VDR. Retrieved from <https://www.atmosfair.de/wp-content/uploads/vdr\\_reportingstandard\\_teil2\\_30032016.pdf>
* VDR standard CO2 calculation for business trips (n.d.). VDR. Retrieved from <https://www.vdr-service.de/arbeitsvorlagen/vdr-standard-co2-berechnung-geschaeftsreise>
* Thistlethwaite, G., et al. (2022, June). 2022 Government Greenhouse Gas Conversion Factors for Company Reporting. *Department for Business, Energy, & Industrial Strategy.* Retrieved from <https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment\\_data/file/1083857/2022-ghg-cf-methodology-paper.pdf>
* *Environmental Mobility Check.* nachhaltigkeit.deutschebahn.com/en/measures/environmental-mobility-check.
* Polkinghorne, John. "Public Transport Emissions in NZ." *Greater Auckland*, 13 Dec. 2013, [www.greaterauckland.org.nz/2013/07/19/public-transport-emissions-in-nz](http://www.greaterauckland.org.nz/2013/07/19/public-transport-emissions-in-nz).
* Ngila, Faustine. "Tanzania's New Electric Rail Will Help It Cut Carbon Emissions." *Quartz*, 20 July 2022, qz.com/africa/2185031/tanzanias-new-electric-rail-will-help-it-cut-carbon-emissions.
* Miller, C. Andrew. "Savings in Per-passenger CO2 Emissions Using Rail Rather Than Air Travel in the Northeastern U.S." *Journal of the Air \&Amp; Waste Management Association*, vol. 71, no. 12, Informa UK Limited, Sept. 2021, pp. 1458–71. <https://doi.org/10.1080/10962247.2020.1837996>.
