# Travel

Traveling, whether for leisure, business, or necessity, plays a significant role in our daily lives. From flights and car rentals to accommodations, each step of a journey leaves an environmental footprint. With growing awareness of climate change, understanding and managing the carbon emissions associated with travel has become crucial. Whether you're planning a round-the-world trip or a simple weekend getaway, having insights into the emissions generated by each activity allows for better choices and a more sustainable approach to travel.

The SQUAKE platform offers the ability to calculate carbon emissions across various travel-related activities. These calculations provide transparency and foster sustainability by encouraging travelers to offset their emissions or choose greener alternatives. Whether you're flying internationally, renting a car, staying at a hotel, or taking a ferry, SQUAKE’s methodology helps in understanding the environmental impact of your journey.

### Perform a Calculation

`POST /v2/calculations`\
**Bearer auth required**

The `calculations` endpoint is used to calculate carbon emissions for one or multiple activities. For example, you can compute the carbon footprint of a journey consisting of a return flight, two cab rides, and a hotel stay, by passing all activities in the `items` array. By including the string literal `"items"` in the `"expand"` array, you can retrieve emissions for each item separately in addition to the total carbon quantity.

This is a low-latency endpoint. Note that SQUAKE does not provide a unique identifier for any calculation results through this endpoint. You must quote a price on the pricing endpoint to purchase compensation for your carbon emissions.

Some data sets are extensive and are documented separately.

**Request Format** Content Type: `application/json`

#### Body

* **expand** `array[string]`\
  If you choose to expand on, for example, `"items"`, SQUAKE returns emissions per each item separately (in addition to a total value).\
  Value: `"items"`
* **carbon\_unit** `string`\
  SQUAKE uses The International System of Units (SI), commonly referred to as the "metric system".\
  Possible Values: `"tonne"`, `"kilogram"`, or `"gram"`
* **distance\_unit** `string`\
  SQUAKE uses common distance units.\
  Possible Values: `"meter"`, `"kilometer"`, `"feet"`, `"mile"`, or `"nautical_mile"`\
  Default value: `"kilometer"`

#### Generic API Request Sample

```json
{
  "expand": [
    "items"
  ],
  "carbon_unit": "tonne",
  "distance_unit": "kilometer",
  "items": [
    {
      "type": "car",
      "methodology": "ACRISS",
      "external_reference": "Taxi",
      "origin": "Alexanderplatz, Berlin, Germany",
      "destination": "Berlin Brandenburg Airport, Schönefeld, Brandenburg, Germany",
      "fuel_type": "diesel",
      "acriss_car_type": "C"
    },
    {
        "type": "flight",
        "methodology": "TIM",
        "origin": "BER",
        "destination": "LHR",
        "number_of_travelers": 1,
        "booking_class": "business",
        "airline": "BA",
        "flight_number": "BA995",
        "external_reference": "Flight"
    },
    {
      "type": "car",
      "methodology": "ACRISS",
      "external_reference": "Taxi",
      "origin": "Hounslow TW6 1QG, United Kingdom",
      "destination": "150 Piccadilly, St. James's, London W1J 9BR, United Kingdom",
      "fuel_type": "petrol",
      "acriss_car_type": "S"
    },
    {
      "type": "hotel",
      "methodology": "HCMI",
      "external_reference": "Hotel",
      "country": "GB",
      "city": "London",
      "stars": 5,
      "hcmi_member": false,
      "number_of_nights": 3
    },
    {
      "type": "car",
      "methodology": "ACRISS",
      "external_reference": "Taxi",
      "origin": "150 Piccadilly, St. James's, London W1J 9BR, United Kingdom",
      "destination": "Horley, Gatwick RH6 0NP, United Kingdom",
      "fuel_type": "hev",
      "acriss_car_type": "D"
    },
    {
        "type": "flight",
        "methodology": "TIM",
        "origin": "LGW",
        "destination": "BER",
        "number_of_travelers": 1,
        "booking_class": "business",
        "airline": "U2",
        "flight_number": "U28629",
        "external_reference": "Flight"
    },
    {
      "type": "car",
      "methodology": "ACRISS",
      "external_reference": "Taxi",
      "origin": "Berlin Brandenburg Airport, Schönefeld, Brandenburg, Germany",
      "destination": "Alexanderplatz, Berlin, Germany",
      "fuel_type": "EV",
      "acriss_car_type": "G"
    }
  ]
}
```

#### Generic API Response Sample

```json
{
    "carbon_quantity": 0.525911,
    "carbon_unit": "tonne",
    "items": [
        {
            "carbon_quantity": 0.002928,
            "carbon_unit": "tonne",
            "external_reference": "Taxi",
            "type": "car",
            "methodology": "ACRISS",
            "distance": 24.0,
            "distance_unit": "kilometer"
        },
        {
            "carbon_quantity": 0.181885,
            "carbon_unit": "tonne",
            "external_reference": "Flight",
            "type": "flight",
            "methodology": "TIM",
            "distance": 1065.0,
            "distance_unit": "kilometer"
        },
        {
            "carbon_quantity": 0.004396,
            "carbon_unit": "tonne",
            "external_reference": "Taxi",
            "type": "car",
            "methodology": "ACRISS",
            "distance": 28.0,
            "distance_unit": "kilometer"
        },
        {
            "carbon_quantity": 0.175022,
            "carbon_unit": "tonne",
            "external_reference": "Hotel",
            "type": "hotel",
            "methodology": "HCMI"
        },
        {
            "carbon_quantity": 0.005292,
            "carbon_unit": "tonne",
            "external_reference": "Taxi",
            "type": "car",
            "methodology": "ACRISS",
            "distance": 49.0,
            "distance_unit": "kilometer"
        },
        {
            "carbon_quantity": 0.156388,
            "carbon_unit": "tonne",
            "external_reference": "Flight",
            "type": "flight",
            "methodology": "TIM",
            "distance": 1054.0,
            "distance_unit": "kilometer"
        },
        {
            "carbon_quantity": 0.0,
            "carbon_unit": "tonne",
            "external_reference": "Taxi",
            "type": "car",
            "methodology": "ACRISS",
            "distance": 24.0,
            "distance_unit": "kilometer"
        }
    ]
}
```
