Compare Carbon Usage

POST /v2/carbon-comparison

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

application/json

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, or gram.

  • items array[object] Required

    You can define one or more metrics you want to compare your carbon quantity to.

    Hide items attributes Show items attributes object
    • metric string Required
    • If you don't send a comparison unit then SQUAKE will find the best match for the amount of CO2 you send in the carbon_quantity

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 integer 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] Required
      Hide items attributes Show items attributes object
      • comparison_unit string Required

        The unit used as the comparison, if you passed one in then it will be here. If you didn't send one then this will be the one SQUAKE selected

      • metric string Required
      • amount number(float) Required

        The amount based on the metric, for example if metric was annual_usage and amount was 0.5 then that would be half a year

  • 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.

      Format should match the following pattern: req_[a-zA-Z0-9-]+.

    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/carbon-comparison
curl \
 -X POST https://api.squake.earth/v2/carbon-comparison \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"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
SQUAKE-Request-Id: req_70394c00-728e-4d70-90bc-2b589c9ebdf8

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