Skip to main content
GET
/
v1
/
hotel-stays
/
{hotel_stay_id}
/
impact-calculation
Hotel Stay Impact Calculation
const options = {
  method: 'GET',
  headers: {Authorization: '<authorization>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id}/impact-calculation', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Hotel Stay Impact Calculation

Returns the step-by-step emission calculation for a specific hotel stay, showing exactly how the CO2e figure was derived from the DEFRA room-night emission factor.

Request

Headers

Authorization
string
required
Bearer token for authenticationExample: Bearer sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

hotel_stay_id
string
required
The unique identifier (UUID) of the hotel stay recordExample: 550e8400-e29b-41d4-a716-446655440000

Response

The response contains the full step-by-step calculation breakdown as used by the Dcycle kernel. The exact shape reflects the kernel’s multi-DB calculation result for the DEFRA hotel room-night activity.

Calculation Methodology

CO2e is computed as:
CO2e (kg) = rooms × nights × EF (kg CO2e / room-night)
Where:
  • nights = check_out_date − check_in_date in days
  • EF = DEFRA hotel room-night emission factor for the stay’s country (from the defra_hotel_stays kernel activity, HOTEL_STAYS category)
One total_impacts row is written per night so that partial-period exports and dashboards pro-rate correctly.

Example

curl -X GET "https://api.dcycle.io/v1/hotel-stays/550e8400-e29b-41d4-a716-446655440000/impact-calculation" \
  -H "Authorization: Bearer ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Common Errors

404 Not Found

Cause: The hotel stay ID does not exist or belongs to a different organization.
{
  "detail": "Hotel stay not found",
  "code": "HOTEL_STAY_NOT_FOUND"
}

Get Hotel Stay

Retrieve full stay details

List Hotel Stays

Browse all stays for the organization