Perform a Calculation including a Price Quote
Changed Oct 20Convenience 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.
All features supported by either the /calculations or /pricing endpoint
are equally valid for this combined endpoint. Please read the respective descriptions
for details.
If you need only either pricing or carbon emissions, SQUAKE advises using
the specific endpoints for lower latency and reduced implementation complexity.'
Bearer-AuthAuthorizationBearer <token>application/json- body
expand?array<>If you include "items", SQUAKE returns emissions per item. Include "legs"
for per-leg flight rows when using routing. If you include items.pricing
a pricing token will be returned for each item.
items*array<one of 20 types>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?booleanfalseproduct*stringproduct_[A-Za-z0-9]*payment_link_return_url?stringIf the customer does not exit the browser after the purchase, on success, SQUAKE will redirect the customer to this link.
currency?Currency3-letter ISO 4217 alpha code of the currency.
^[A-Z]{3}$3 <= length <= 3"EUR""AED""AMD""ARS""AUD""AZN""BAM""BGN""BHD""BRL""CAD""CHF""CLP""CNY""COP""CRC""CZK""DKK""DZD""EGP""ETB""EUR""GBP""GEL""HKD""HUF""IDR""INR""ISK""JMD""JOD""JPY""KES""KRW""KWD""KZT""LKR""LYD""MAD""MUR""MXN""MYR""NOK""NZD""OMR""PHP""PKR""PLN""QAR""RSD""RUB""SAR""SEK""SGD""SYP""THB""TND""TRY""TTD""TWD""UAH""USD""VND""XAF""XOF""ZAR"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"payment_method?payment_methodControls the way you want to process the purchase.
If stripe is used then you''ll receive a payment_link in response.
If batch_settlement is used, then you''ll have to use /purchases endpoint to finalise the purchase.
"batch_settlement""stripe""batch_settlement"OK
application/json- response
id*stringA token encoding the pricing. Used to make a purchase.
carbon_quantity*numbercarbon_unit*Carbon UnitSQUAKE uses The International System of Units (SI), commonly referred to as "metric system".
"tonne""kilogram""gram"payment_link?stringprice*|product*|valid_until*ISO-8601-DateDate in ISO 8601 notation.
^\d{4}-\d{2}-\d{2}$datecurrency*Currency3-letter ISO 4217 alpha code of the currency.
^[A-Z]{3}$3 <= length <= 3"EUR""AED""AMD""ARS""AUD""AZN""BAM""BGN""BHD""BRL""CAD""CHF""CLP""CNY""COP""CRC""CZK""DKK""DZD""EGP""ETB""EUR""GBP""GEL""HKD""HUF""IDR""INR""ISK""JMD""JOD""JPY""KES""KRW""KWD""KZT""LKR""LYD""MAD""MUR""MXN""MYR""NOK""NZD""OMR""PHP""PKR""PLN""QAR""RSD""RUB""SAR""SEK""SGD""SYP""THB""TND""TRY""TTD""TWD""UAH""USD""VND""XAF""XOF""ZAR"total*integerThe total amount in the lower denomination of the currency; e.g. 12.34 USD would be 1234.
items?array<>Expand items to receive emissions per item. By default, this is not included.
curl -X POST 'https://api.sandbox.squake.earth/v2/calculations-with-pricing' \ -H 'Content-Type: application/json' \ -d '{ "items": [ {} ], "product": "product_afg3465afg3"}'{ "id": "string", "carbon_quantity": 0, "carbon_unit": "tonne", "payment_link": "string", "price": "price_1MMroL2eZvKYlo2CxbxAACvb", "product": "product_01fa2d8f04e424", "valid_until": "2023-01-28", "currency": "EUR", "total": 0, "items": [ { "carbon_quantity": 0, "carbon_unit": "tonne", "external_reference": "string", "type": "air_freight", "methodology": "GLEC", "methodology_version": "2025", "distance": 0, "distance_unit": "kilometer", "routing": "string", "legs": [ { "carbon_quantity": 0, "carbon_unit": "tonne", "distance": 0, "distance_unit": "kilometer", "type": "flight", "methodology": "string", "external_reference": "string", "audit": {}, "emission_factors": {} } ], "pricing": { "id": "string", "total": "string", "currency": "EUR" } } ]}Perform a Calculation
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](https://squake.notion.site/Databases-2a5a8e757fc74b62bef3be7c5ac2f699).
Quote a Pricing
Returns pricing for a given product and carbon quantity (or a fixed total amount in any supported currency). <br><br> By default, requested pricing is valid for two weeks starting the moment you request it. Expired pricings can still be used as long as the underlying price hasn''t changed for your convenience. <br><br> Repeated purchases using the same pricing are possible via API and the checkout page using the pricing id or `payment_link`, respectively. <br><br> You can append additional parameters to the `payment_link`; SQUAKE's checkout page supports the following: * **localization**: Please use a two-letter ISO 639-1 code, for example: `&locale=en` for English. * **utm_***: any valid UTM tracking parameters, e.g., `&utm_medium=email`. <br><br> This is a low-latency endpoint, useful for previewing pricing before making a purchase either via API or on the SQUAKE checkout page via the returned `payment_link`.'