Update Hotel Stay
const options = {
method: 'PATCH',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
check_in_date: '<string>',
check_out_date: '<string>',
country: '<string>',
name: '<string>',
hotel_name: '<string>',
address: '<string>',
rooms: 123,
status: '<string>'
})
};
fetch('https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id}', 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/{hotel_stay_id}"
payload = {
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"name": "<string>",
"hotel_name": "<string>",
"address": "<string>",
"rooms": 123,
"status": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)curl --request PATCH \
--url https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"name": "<string>",
"hotel_name": "<string>",
"address": "<string>",
"rooms": 123,
"status": "<string>"
}
'{
"id": "<string>",
"organization_id": "<string>",
"name": {},
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"address": {},
"hotel_name": {},
"rooms": 123,
"status": "<string>",
"source": "<string>",
"file_id": {},
"file_name": {},
"co2e": {},
"uploaded_by": {},
"location_geocode": {},
"created_at": {},
"updated_at": {}
}Update Hotel Stay
Update a hotel stay record (partial update) and trigger CO2e recalculation
PATCH
/
v1
/
hotel-stays
/
{hotel_stay_id}
Update Hotel Stay
const options = {
method: 'PATCH',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
check_in_date: '<string>',
check_out_date: '<string>',
country: '<string>',
name: '<string>',
hotel_name: '<string>',
address: '<string>',
rooms: 123,
status: '<string>'
})
};
fetch('https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id}', 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/{hotel_stay_id}"
payload = {
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"name": "<string>",
"hotel_name": "<string>",
"address": "<string>",
"rooms": 123,
"status": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)curl --request PATCH \
--url https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"name": "<string>",
"hotel_name": "<string>",
"address": "<string>",
"rooms": 123,
"status": "<string>"
}
'{
"id": "<string>",
"organization_id": "<string>",
"name": {},
"check_in_date": "<string>",
"check_out_date": "<string>",
"country": "<string>",
"address": {},
"hotel_name": {},
"rooms": 123,
"status": "<string>",
"source": "<string>",
"file_id": {},
"file_name": {},
"co2e": {},
"uploaded_by": {},
"location_geocode": {},
"created_at": {},
"updated_at": {}
}← Hotel Stays API
Update a hotel stay record with a partial update — only the fields you send are changed. CO2e is recalculated asynchronously if dates, country, or rooms change.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
UUID of the hotel stay to update
Body Parameters
All fields are optional — only send the ones you want to change.string
Check-in date in ISO format (
YYYY-MM-DD)string
Check-out date in ISO format (
YYYY-MM-DD). When both dates are sent, check-out must be on or after check-in.string
ISO-2 country code (e.g.
ES, GB, US)string
Label for the trip or traveler (max 255 characters)
string
Name of the hotel (max 255 characters)
string
Plain-text address for geocoding (max 500 characters)
integer
Number of booked rooms (1–10 000)
string
Record status. Values:
active, deletedResponse
Returns the updated hotel stay with current CO2e (HTTP 200).string
Hotel stay UUID
string
UUID of the owning organization
string | null
Trip or traveler label
string
Check-in date (YYYY-MM-DD)
string
Check-out date (YYYY-MM-DD)
string
ISO-2 country code
string | null
Plain-text address
string | null
Hotel name
integer
Number of booked rooms
string
Record status:
active, pending, or deletedstring
How the record was created:
manual, api, file_uploadstring | null
UUID of the source file, if created from a file upload
string | null
Name of the source file, if created from a file upload
number | null
Calculated CO2e emissions in tCO2e. May change after recalculation.
string | null
UUID of the user who created the record
object | null
Geocoded location data resolved from the address
| Field | Type | Description |
|---|---|---|
country_code | string | ISO-2 country code |
place_id | string | Place identifier |
address_formatted | string | Full formatted address |
latitude | number | Latitude coordinate |
longitude | number | Longitude coordinate |
datetime
Creation timestamp
datetime | null
Last update timestamp
Example
curl -X PATCH "https://api.dcycle.io/v1/hotel-stays/${HOTEL_STAY_ID}" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"check_out_date": "2025-03-15",
"rooms": 2
}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
}
hotel_stay_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
response = requests.patch(
f"https://api.dcycle.io/v1/hotel-stays/{hotel_stay_id}",
headers=headers,
json={"check_out_date": "2025-03-15", "rooms": 2},
)
stay = response.json()
print(f"Updated: {stay['check_in_date']} to {stay['check_out_date']}, {stay['rooms']} rooms")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
};
const hotelStayId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
axios.patch(`https://api.dcycle.io/v1/hotel-stays/${hotelStayId}`, {
check_out_date: '2025-03-15',
rooms: 2,
}, { headers })
.then(response => {
const s = response.data;
console.log(`Updated: ${s.check_in_date} to ${s.check_out_date}, ${s.rooms} rooms`);
});
Successful Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"organization_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
"name": "Spring conference",
"check_in_date": "2025-03-10",
"check_out_date": "2025-03-15",
"country": "ES",
"address": "Calle Gran Vía 28, Madrid",
"hotel_name": "Hotel Madrid Centro",
"rooms": 2,
"status": "active",
"source": "api",
"file_id": null,
"file_name": null,
"co2e": 0.312,
"created_at": "2025-03-01T12:00:00Z",
"updated_at": "2025-03-02T09:30:00Z",
"uploaded_by": null,
"location_geocode": {
"country_code": "ES",
"place_id": "ChIJ_ynhfqgoQg0RJhAYCAE8uFk",
"address_formatted": "Calle Gran Vía, 28, 28013 Madrid, Spain",
"latitude": 40.4203,
"longitude": -3.7065
}
}
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"}
422 Validation Error
Cause: Check-out date is before check-in date (when both are provided){
"detail": [
{
"loc": ["body", "check_out_date"],
"msg": "check_out_date must be on or after check_in_date",
"type": "value_error"
}
]
}
Related Endpoints
Get Hotel Stay
View hotel stay details
Calculation Steps
View the CO2e calculation breakdown
Was this page helpful?