Perform a Calculation

POST /v2/calculations

The calculations endpoint can calculate carbon emissions for one or multiple activities. The carbon footprint or your journey consisting of, for example, a return flight, two cab rides, and a hotel stay can be computed all at once, passing all five activities in the items array. Include the string literal "items" in the "expand" array to retrieve values for each item separately in addition to the total carbon quantity.

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

Some data sets are extensive and thus documented separately here.

application/json

Body

  • expand array[string]

    If you choose to expand on e.g. "items", SQUAKE returns emissions per each item separately (in addition to a total value).

    Value is items.

  • SQUAKE uses The International System of Units (SI), commonly referred to as "metric system".

    Values are tonne, kilogram, or gram.

  • SQUAKE uses common distance units

    Values are meter, kilometer, feet, mile, or nautical_mile. Default value is kilometer.

  • items array[object] Required
    Any of:

Responses

  • 200 application/json

    OK

    Hide headers attribute Show headers attribute
    • Unique identifier linked to this API request. If you need to contact us regarding a specific request, providing the request identifier helps the resolution process.

    Hide response attributes Show response attributes object
    • carbon_quantity number Required
    • carbon_unit string Required

      SQUAKE uses The International System of Units (SI), commonly referred to as "metric system".

      Values are tonne, kilogram, or gram.

    • items array[object]

      Expand items to receive emissions per item. By default, this is not included.

      Hide items attributes Show items attributes object
      • carbon_quantity number Required
      • carbon_unit string Required

        SQUAKE uses The International System of Units (SI), commonly referred to as "metric system".

        Values are tonne, kilogram, or gram.

      • type string Required

        Values are accommodation, air_freight, bus, camping_site, car, co2_amount, coffee_production, cruise, expenditure, ferry, flight, general, hotel, logistics, logistics_site, money_amount, private_jet, sea_freight, inland_waterways, train, rail_freight, road_freight, or van.

      • methodology string Required

        Values are ACRISS, ADEME, BASIC, CLEAN-CARGO, CO2-EMISSIEFACTOREN-NL, DIN-EN-16258, DEFRA, EU-EEA, EU-EMSA, US-EPA, HCMI, OFNK, ECTA, GLEC, ICAO, TIM, or SQUAKE.

  • 400 application/json

    Example response

    Hide headers attribute Show headers attribute
    • Unique identifier linked to this API request. If you need to contact us regarding a specific request, providing the request identifier helps the resolution process.

    Hide response attributes Show response attributes object
    • code string Required

      An application-specific error code, expressed as a string value.

      Values are field_validation_error, server_error, not_authorized, not_found, invalid_methodology, or invalid_type.

    • detail string

      A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.

    • source object

      An object containing references to the primary source of the error

      Additional properties are allowed.

      Hide source attributes Show source attributes object
  • 401 application/json

    Example response

    Hide headers attribute Show headers attribute
    • Unique identifier linked to this API request. If you need to contact us regarding a specific request, providing the request identifier helps the resolution process.

    Hide response attributes Show response attributes object
    • code string Required

      An application-specific error code, expressed as a string value.

      Values are field_validation_error, server_error, not_authorized, not_found, invalid_methodology, or invalid_type.

    • detail string

      A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.

    • source object

      An object containing references to the primary source of the error

      Additional properties are allowed.

      Hide source attributes Show source attributes object
POST /v2/calculations
curl \
 -X POST https://api.squake.earth/v2/calculations \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"expand":["items"],"carbon_unit":"tonne","distance_unit":"kilometer","items":[{"type":"accommodation","methodology":"SQUAKE","external_reference":"string","number_of_nights":2,"starts_on":"2020-01-01","ends_on":"2020-01-01","country":"DE","number_of_travelers":1,"square_meters":50,"sauna":false,"parking":true,"swimming_pool":false,"air_conditioner":false,"garage":false}]}'
Request examples
{
  "expand": [
    "items"
  ],
  "carbon_unit": "tonne",
  "distance_unit": "kilometer",
  "items": [
    {
      "type": "accommodation",
      "methodology": "SQUAKE",
      "external_reference": "string",
      "number_of_nights": 2,
      "starts_on": "2020-01-01",
      "ends_on": "2020-01-01",
      "country": "DE",
      "number_of_travelers": 1,
      "square_meters": 50,
      "sauna": false,
      "parking": true,
      "swimming_pool": false,
      "air_conditioner": false,
      "garage": false
    }
  ]
}
Response examples (200)
# Headers

# Payload
{
  "carbon_quantity": 0.37,
  "carbon_unit": "tonne",
  "items": [
    {
      "carbon_quantity": 0.37,
      "carbon_unit": "tonne",
      "external_reference": "string",
      "type": "air_freight",
      "methodology": "GLEC"
    }
  ]
}
Response examples (400)
# Headers

# Payload
[
  {
    "code": "field_validation_error",
    "detail": "string",
    "source": {
      "id": "string",
      "attribute": "string",
      "model": "string"
    }
  }
]
Response examples (401)
# Headers

# Payload
[
  {
    "code": "field_validation_error",
    "detail": "string",
    "source": {
      "id": "string",
      "attribute": "string",
      "model": "string"
    }
  }
]