Compare Carbon Usage
This endpoint allows you to compare carbon quantities to more recognizable items such as cars, light bulbs, or kettles.
Our list of metrics and comparison units are quite extensive so a list of accepted combinations has been compiled and is available here
Body
-
carbon_quantity
integer Required Minimum value is
1
. -
carbon_unit
string Required SQUAKE uses The International System of Units (SI), commonly referred to as "metric system".
Values are
tonne
,kilogram
, orgram
. -
items
array[object] Required You can define one or more metrics you want to compare your carbon quantity to.
POST
/v2/carbon-comparison
curl \
--request POST 'https://api.squake.earth/v2/carbon-comparison' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"carbon_quantity":2000,"carbon_unit":"tonne","items":[{"metric":"annual_usage","comparison_unit":"cars"}]}'
Request examples
{
"carbon_quantity": 2000,
"carbon_unit": "tonne",
"items": [
{
"metric": "annual_usage",
"comparison_unit": "cars"
}
]
}
Response examples (200)
# Headers
SQUAKE-Request-Id: string
# Payload
{
"carbon_quantity": 5000,
"carbon_unit": "tonne",
"items": [
{
"comparison_unit": "cars",
"metric": "annual_usage",
"amount": 42.0
}
]
}
Response examples (400)
# Headers
# Payload
[
{
"code": "field_validation_error",
"detail": "string",
"source": {
"id": "string",
"attribute": "string",
"model": "string"
}
}
]