> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Hotel Stay Impact Calculation

> Get a step-by-step CO2e breakdown for a specific hotel stay

# 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

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication

  **Example:** `Bearer sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="hotel_stay_id" type="string" required>
  The unique identifier (UUID) of the hotel stay record

  **Example:** `550e8400-e29b-41d4-a716-446655440000`
</ParamField>

## 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

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  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}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  response = requests.get(
      "https://api.dcycle.io/v1/hotel-stays/550e8400-e29b-41d4-a716-446655440000/impact-calculation",
      headers={
          "Authorization": f"Bearer {os.getenv('DCYCLE_API_KEY')}",
          "x-organization-id": os.getenv("DCYCLE_ORG_ID")
      }
  )
  print(response.json())
  ```
</CodeGroup>

## Common Errors

### 404 Not Found

**Cause:** The hotel stay ID does not exist or belongs to a different organization.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Hotel stay not found",
  "code": "HOTEL_STAY_NOT_FOUND"
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Hotel Stay" icon="magnifying-glass" href="/api-reference/hotel-stays/get">
    Retrieve full stay details
  </Card>

  <Card title="List Hotel Stays" icon="list" href="/api-reference/hotel-stays/list">
    Browse all stays for the organization
  </Card>
</CardGroup>
