# Bus: SQUAKE

💡 **High-Level Description:**

SQUAKE, a holistic and modern approach to carbon calculation, sets itself apart by its capacity to integrate operator-specific data within its methodology for the bus sector. Recognizing that buses, as a mode of public transport, can vary significantly in their environmental impact depending on numerous variables, the methodology's flexibility is its strength. Factors such as bus age, fuel type, maintenance schedules, route frequencies, and driver habits can all play crucial roles in determining the carbon footprint of a single bus journey.

With its roots in contemporary data analytics, SQUAKE not only aggregates broad industry metrics but also narrows down to the intricacies of individual bus operators. This ability to granulate allows transportation authorities and companies to gain precise insights and implement targeted strategies for carbon reduction. Such precision, driven by operator-specific data, translates into actionable solutions that make bus transportation greener and more sustainable.

### **Sample API Requests**

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

```json
{
  "expand": ["items"],
  "items": [
    {
      "audit": false,
      "type": "bus",
      "external_reference": "test_1",
      "origin": "Berlin",
      "destination": "Frankfurt am Main",
      "number_of_travelers": 1,
      "methodology": "SQUAKE",
      "fuel_type": "diesel",
      "operator_name": "flixbus"
    }
  ]
}
```

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

```json
{
  "expand": ["items"],
  "audit_for": "<Auditable Entity ID>",
  "items": [
    {
      "audit": true,
      "type": "bus",
      "external_reference": "test_1",
      "origin": "Berlin",
      "destination": "Frankfurt am Main",
      "number_of_travelers": 1,
      "methodology": "SQUAKE",
      "fuel_type": "diesel",
      "operator_name": "flixbus"
    }
  ]
}
```

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

### **API Request Items**

* `"type"`: `"bus"` (required)
* `"methodology"`: `"SQUAKE"` (required)
* `"external_reference"`: A unique identifier that helps you link the resulting emissions to the requested item. Especially useful if multiple items are requested since SQUAKE cannot guarantee to keep the same order. The maximum length is 128 characters.
* `"number_of_travelers"`: Minimum value is `1`. The default value is `1`.
* `"origin"`: SQUAKE will try to resolve the `origin`/`destination` regardless of its format. Ideally, for addresses use the Post standard, for airports use IATA/ICAO code (format: `^[A-Z]{3,4}$`, e.g., `"MUC"`), for other locations used in trade and transportation use UN/LOCODE codes (format: `^[A-Z]{2}\W?[A-Z2-9]{3}$`, e.g., `"DEHAM"`). You can also pass lat/long (format: `^[-+]?\d{1,3}\.\d{1,10}\s?,\s?[-+]?\d{1,3}\.\d{1,10}$`, e.g., `"+40.712,-74.006"`).
* `"destination"`: SQUAKE will try to resolve the `origin`/`destination` regardless of its format. Ideally, for addresses use the Post standard, for airports use IATA/ICAO code (format: `^[A-Z]{3,4}$`, e.g., `"MUC"`), for other locations used in trade and transportation use UN/LOCODE codes (format: `^[A-Z]{2}\W?[A-Z2-9]{3}$`, e.g., `"DEHAM"`). You can also pass lat/long (format: `^[-+]?\d{1,3}\.\d{1,10}\s?,\s?[-+]?\d{1,3}\.\d{1,10}$`, e.g., `"+40.712,-74.006"`).
* `"distance_in_km"`: Prioritized over `origin` and `destination`. If you don't have a `distance_in_km`, you can use `origin` and `destination` and the distance will be automatically resolved. If you pass both `distance_in_km` and `origin`/`destination`, then `distance_in_km` will be used.
* `"fuel_type"`: Values are `lng`, `diesel`, `lpg`, `phev`, `hydrogen`, `electricity`; defaults to `average`.
* `"operator_name"`: SQUAKE's methodology allows passing the operator's name to obtain a more accurate result. You can find the list of [supported operators here](https://squake.notion.site/31f83752e3bd4cf2ba314ceb8fa2acc6?v=5190873dd753431187b735a8fe40038f).
* `"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"`

***

## Origin/Destination Formats (Enriched)

SQUAKE will try to resolve the `origin`/`destination` regardless of its format. Ideally:

* **Addresses:** Use the *Post* standard.
* **Airports:** Use IATA/ICAO code (regex: `^[A-Z]{3,4}$`, e.g., `"MUC"`).
* **Ports/Trade locations:** Use UN/LOCODE (regex: `^[A-Z]{2}\W?[A-Z2-9]{3}$`, e.g., `"DEHAM"`).
* **Coordinates:** Pass latitude/longitude (regex: `^[-+]?\d{1,3}\.\d{1,10}\s?,\s?[-+]?\d{1,3}\.\d{1,10}$`, e.g., `"+40.712,-74.006"`).

**Provider/Stop Codes for Buses**

* You can also reference **bus stops or stations** using provider-prefixed stop IDs:
  * Format: `<provider>:<stop_id>` (e.g., `flixbus:2006`)
* **Common provider prefixes:**
  * `flixbus`
  * `distribusion`
  * `busbud`

> If a value cannot be resolved, SQUAKE will **fallback to generic (non-journey-specific)** bus factors under the SQUAKE methodology.

**Examples**

```jsonc
// Using provider stop codes
{
  "type": "bus",
  "methodology": "SQUAKE",
  "origin": "flixbus:berlin_zob",
  "destination": "flixbus:frankfurt_sued",
  "operator_name": "flixbus",
  "number_of_travelers": 1
}

// Using UN/LOCODEs (for multimodal contexts)
{
  "type": "bus",
  "methodology": "SQUAKE",
  "origin": "DEBER",
  "destination": "DEFRA",
  "number_of_travelers": 1
}

// Using coordinates
{
  "type": "bus",
  "methodology": "SQUAKE",
  "origin": "+52.501,13.281",
  "destination": "+50.094,8.662",
  "number_of_travelers": 1
}
```

***

### **Sample API Response**

```json
{
    "carbon_quantity": 12374,
    "carbon_unit": "gram",
    "items": [
        {
            "carbon_quantity": 12374,
            "carbon_unit": "gram",
            "external_reference": "test_1",
            "type": "bus",
            "methodology": "SQUAKE",
            "distance": 538.0,
            "distance_unit": "kilometer"
        }
    ]
}
```

### **Bibliography**

* Chang, Ching-Chih, et al. “Life Cycle Assessment of Carbon Footprint in Public Transportation - a Case Study of Bus Route NO. 2 in Tainan City, Taiwan.” *Procedia Manufacturing*, vol. 30, Elsevier BV, 2019, pp. 388–95. <https://doi.org/10.1016/j.promfg.2019.02.054>.
* Logan, Kathryn G., et al. “Electric and Hydrogen Buses: Shifting From Conventionally Fuelled Cars in the UK.” *Transportation Research Part D: Transport and Environment*, vol. 85, Elsevier BV, Aug. 2020, p. 102350. <https://doi.org/10.1016/j.trd.2020.102350>.
* "Which form of transport has the smallest carbon footprint?" *Our World in Data*, ourworldindata.org/travel-carbon-footprint.


---

# 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/bus/bus-squake.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.
