Skip to main content
GET
/
v1
/
hotel-stays
/
totals
Get Hotel Stay Totals
const options = {
  method: 'GET',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/hotel-stays/totals', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
import requests

url = "https://api.dcycle.io/v1/hotel-stays/totals"

headers = {
    "x-api-key": "<x-api-key>",
    "x-organization-id": "<x-organization-id>"
}

response = requests.get(url, headers=headers)

print(response.text)
curl --request GET \
  --url https://api.dcycle.io/v1/hotel-stays/totals \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-organization-id: <x-organization-id>'
{
  "total_stays": 123,
  "total_nights": 123,
  "total_co2e": 123
}

Get Hotel Stay Totals

Returns aggregated statistics for all hotel stays in your organization: total number of stays, total room-nights booked, and total CO2e emitted.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Response

total_stays
integer
Total number of hotel stay records for the organization
total_nights
integer
Total room-nights booked (sum of rooms × nights across all stays)
total_co2e
number
Total CO2e in kg across all stays

Example

curl -X GET "https://api.dcycle.io/v1/hotel-stays/totals" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os

response = requests.get(
    "https://api.dcycle.io/v1/hotel-stays/totals",
    headers={
        "x-api-key": os.getenv("DCYCLE_API_KEY"),
        "x-organization-id": os.getenv("DCYCLE_ORG_ID")
    }
)
totals = response.json()
print(f"{totals['total_stays']} stays, {totals['total_nights']} room-nights, {totals['total_co2e']} kg CO2e")
const axios = require('axios');

axios.get('https://api.dcycle.io/v1/hotel-stays/totals', {
  headers: {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID
  }
})
.then(r => {
  const { total_stays, total_nights, total_co2e } = r.data;
  console.log(`${total_stays} stays, ${total_nights} room-nights, ${total_co2e} kg CO2e`);
})
.catch(error => console.error(error));

Successful Response

{
  "total_stays": 42,
  "total_nights": 186,
  "total_co2e": 1143.72
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The authenticated user is not a member of the organization
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}

List Hotel Stays

Browse individual stay records

Impact Calculation

See the step-by-step breakdown for a specific stay