# Car: DEFRA 🇬🇧

:bulb: **High-Level Description**

The Department for Environment, Food & Rural Affairs (DEFRA) of the UK has been a stalwart in environmental governance and establishing methodologies across various sectors. Within the car sector, DEFRA's methodology focuses keenly on providing robust and comprehensible metrics for carbon emissions. Recognizing the massive contribution of vehicles to the UK's carbon footprint, DEFRA's guidelines are tailored to encompass the diverse range of vehicles on the roads, from compact cars to SUVs.

DEFRA's approach not only accounts for direct emissions derived from fuel combustion but also considers the broader life-cycle emissions of vehicles, including manufacturing, maintenance, and disposal. Their methodology, backed by extensive research and consultation with automotive industry experts, provides a solid foundation for the UK's policy-making, encouraging sustainable car manufacturing and usage. Through DEFRA's efforts, consumers, manufacturers, and policymakers are better equipped to make environmentally conscious decisions regarding transportation.

**Versioning:** Use `methodology_version` to pin a specific **Conversion Factors** year (e.g., `"2024"`). If omitted, SQUAKE **uses the latest supported year**.

***

## Sample API Requests

### A. Route-based request without audit mode (origin/destination or explicit distance)

```json
{
  "expand": ["items"],
  "items": [
    {
      "audit": false,
      "type": "car",
      "methodology": "DEFRA",
      "external_reference": "string",
      "origin": "Frankfurt am Main, Germany",
      "destination": "Berlin, Germany",
      "fuel_type": "hev",
      "car_type": "dual_purpose_4x4",
      "energy_scope": "ttw",
      "methodology_version": "2024"
    }
  ]
}
```

### B. Route-based request with audit mode (for finalized/post-booking calculations)

```json
{
  "expand": ["items"],
  "audit_for": "<Auditable Entity ID>",
  "items": [
    {
      "audit": true,
      "type": "car",
      "methodology": "DEFRA",
      "external_reference": "string",
      "origin": "Frankfurt am Main, Germany",
      "destination": "Berlin, Germany",
      "fuel_type": "hev",
      "car_type": "dual_purpose_4x4",
      "energy_scope": "ttw",
      "methodology_version": "2024"
    }
  ]
}
```

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

### C. Duration-based request (fallback when distance is unknown)

> When the trip distance is unknown, you may pass `number_of_days`. The API will estimate the distance as\
> `estimated_distance_in_km = number_of_days * 60`.

```json
{
  "expand": ["items"],
  "items": [
    {
      "audit": false,
      "type": "car",
      "methodology": "DEFRA",
      "external_reference": "string",
      "fuel_type": "hev",
      "car_type": "dual_purpose_4x4",
      "energy_scope": "ttw",
      "methodology_version": "2024",
      "number_of_days": 5
    }
  ]
}
```

> **Precedence rule:** If `distance_in_km` is provided, it will be used and **takes priority** over both `origin`/`destination` and `number_of_days`.

***

## Sample API Response

```json
{
  "carbon_quantity": 10764,
  "carbon_unit": "gram",
  "items": [
    {
      "carbon_quantity": 10764,
      "carbon_unit": "gram",
      "external_reference": "string",
      "type": "car",
      "methodology": "DEFRA",
      "methodology_version": "2024",
      "distance": 110.0,
      "distance_unit": "kilometer"
    }
  ]
}
```

***

## API Request Items

* `"type"`: `"car"` **(required)**
* `"methodology"`: `"DEFRA"` **(required)**
* `"methodology_version"`: DEFRA **Conversion Factors** year (e.g., `"2024"`). **Optional**; if omitted → **latest supported year**.
* `"external_reference"`: Unique identifier to correlate responses (max 128 chars).
* `"origin"` / `"destination"`: Postal, IATA/ICAO, UN/LOCODE, or `"lat,lon"`; SQUAKE resolves distance.
* `"distance_in_km"`: If present, **overrides** origin/destination resolution and `number_of_days`.
* `"number_of_days"`: **integer** (display name: **Number-Of-Days**), **>= 1**.
  * Use when trip distance is **unknown**.
  * Estimated distance formula: `estimated_distance_in_km = number_of_days * 60`.
  * **Precedence:** `distance_in_km` > `origin/destination` > `number_of_days` (fallback).
* `"fuel_type"`: `"petrol"`, `"diesel"`, `"hev"`, `"phev"`, `"electricity"`, `"average"` *(default: `"average"`)*.
* `"acriss_car_type"`: ACRISS segment letters (e.g., `C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`L`,`M`,`N`,`P`,`R`,`S`,`U`,`W`,`X`). **Mutually exclusive** with `"car_type"`.
* `"sipp_car_type"`: If `acriss_car_type` not passed, can be used to infer class. **Mutually exclusive** with `"car_type"`.
* `"car_type"`: `"mini"`, `"supermini"`, `"lower_medium"`, `"upper_medium"`, `"executive"`, `"luxury"`, `"sports"`, `"dual_purpose_4x4"`, `"mpv"`, `"small"`, `"medium"`, `"large"`, `"average"` *(default: `"average"`)*.
* `"energy_scope"`: `"wtw"` *(default)* or `"ttw"`.
* `"audit"`: boolean (optional). Set to `true` to create immutable audit records for finalized calculations. Must be enabled for your account.

***

## Default Values

* `"fuel_type": "average"`
* `"car_type": "average"`
* `"energy_scope": "wtw"`
* `"methodology_version"`: **latest supported DEFRA year**

***

## Notes

* **Data quality tip:** whenever possible, pass the actual `distance_in_km`—it yields the most accurate result. `number_of_days` is a convenience fallback and a coarse approximation.
* Pin `methodology_version` for **reproducibility and auditability** in long-lived reports.
* If neither `distance_in_km` nor `origin`/`destination` are supplied, the API will use `number_of_days` (if provided) to estimate distance; otherwise the request may be insufficient to compute trip emissions.

***

## Bibliography

* UK Government — **Greenhouse gas emissions: Research & statistics**: <https://www.gov.uk/environment/greenhouse-gas-emissions#research\\_and\\_statistics>
* Bramwell, R., et al. (2024). *Government Greenhouse Gas Conversion Factors for Company Reporting — Methodology*. (Methodology paper PDF).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-integration.squake.earth/api-calculations-request-response/travel/car/car-defra.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
