Perform a Calculation
Changed Oct 20The 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.
Bearer-AuthAuthorizationBearer <token>application/json- body
expand?array<>Include "items" to return emissions per item (in addition to the total).
Include "legs" to return per-leg rows for flight items that use routing
(multi-leg itineraries). legs is only meaningful when combined with items.
See Flight routing.
carbon_unit?Carbon UnitSQUAKE uses The International System of Units (SI), commonly referred to as "metric system".
"tonne""kilogram""gram"distance_unit?Distance-UnitSQUAKE uses common distance units
"kilometer""meter""kilometer""feet""mile""nautical_mile"audit_for?string(Optional) Provide when calculating on behalf of a specific Auditable entity; otherwise omit.
If you make a calculation on behalf of a specific legal entity, you can specify the ID of the auditable entity. This will associate all audit logs created for that calculation with the given Auditable entity.
items*array<one of 20 types>One entry per activity you want calculated. A single request can mix activity
types freely — a flight, two taxi rides, and a hotel stay are one call, and the
response returns their combined carbon_quantity. Add "items" to expand to
also get the emissions of each entry separately.
Every item is shaped by two fields:
type— the activity, e.g.flight,hotel,car,train,road_freight,expenditure.methodology— the standard to calculate it with, e.g.DEFRA,ICAO,TIM,GREENVIEW,GLEC.
Those two decide which further fields the item takes, and which of them are
required: flight + ICAO expects origin and destination (or routing for a
multi-leg itinerary), while hotel + GREENVIEW expects country, city, and
number_of_nights. Not every methodology is available for every activity type.
Two fields are accepted on any item: external_reference, echoed back on the
matching response item so you can reconcile results with your own records, and
audit for the immutable audit log of a final calculation.
Pick your activity type below to see the fields it accepts per methodology. For copy-paste request and response pairs, see the calculation examples in the integration docs.
Accommodation considers only activities related to short-term rentals, lodging, sublets, etc.
SQUAKE has country-specific values for most parameters. If the country is omitted, default values will apply.
audit?Audit modeSQUAKE provides you the option to create audit records for your calculations requests. These records are immutable, once they are created they cannot be altered, please use this feature only for final calculations.
Note: to use this feature you need to have it enabled for your account, please contact us for more information.
falsetype*"accommodation"methodology*"SQUAKE"Detailed documentation of the methodology can be found in the integration docs.
"SQUAKE"external_reference?external_referenceA 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.
length <= 128number_of_nights?integerRequired if start and end dates are omitted; else this is ignored.
int321 <= valuestarts_on*stringThe format is ISO 8601 Date, YYYY-MM-DD. Required if season-specific methodology shall be used, or number of nights is omitted.
dateends_on*stringThe format is ISO 8601 Date, YYYY-MM-DD. Required if season-specific methodology shall be used, or number of nights is omitted.
datecountry?CountryTwo-letter or three-letter code as defined in ISO 3166-1 alpha-2 and alpha-3 respectively.
^[A-Z]{2,3}$2 <= length <= 3number_of_travelers*integerThe default value depends on the country.
1 <= valuesquare_meters*numberThe default value depends on the country.
double1 <= valuesauna?booleanfalseparking?booleantrueswimming_pool?booleanfalseair_conditioner?booleanfalsegarage?booleanfalseOK
application/json- response
carbon_quantity*numbercarbon_unit*Carbon UnitSQUAKE uses The International System of Units (SI), commonly referred to as "metric system".
"tonne""kilogram""gram"items?array<>Present when expand includes items. Per-item emissions; for routed flights,
include legs in expand to also receive routing and per-leg rows on the item.
curl -X POST 'https://api.sandbox.squake.earth/v2/calculations' \ -H 'Content-Type: application/json' \ -d '{ "expand": [ "items" ], "carbon_unit": "tonne", "distance_unit": "kilometer", "items": [ { "type": "flight", "audit": false, "methodology": "DEFRA", "external_reference": "string", "booking_class": "economy", "number_of_travelers": 1, "aircraft_type": "7M7", "fare_class": "Y", "origin": "BER", "destination": "CDG", "airline": "LH", "radiative_forcing_index": true, "sustainable_fuels": { "carbon_reduction_percentage_of_total": 0.25 }, "energy_scope": "ttw" } ]}'{ "carbon_quantity": 0.37, "carbon_unit": "tonne", "items": [ { "carbon_quantity": 0.37, "carbon_unit": "tonne", "type": "flight", "methodology": "DEFRA", "external_reference": "string" } ]}Introduction
Previous Page
Perform a Calculation including a Price Quote
Convenience all-in-one endpoint to perform carbon calculation and pricing. A purchase can be performed via API or SQUAKE's checkout page using the returned `payment_link`. <br><br> All features supported by either the `/calculations` or `/pricing` endpoint are equally valid for this combined endpoint. Please read the respective descriptions for details. <br><br> If you need only either pricing or carbon emissions, SQUAKE advises using the specific endpoints for lower latency and reduced implementation complexity.'