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>',
custom_ef_record_id: {},
attachment_file_id: {}
})
};
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>",
"custom_ef_record_id": {},
"attachment_file_id": {}
}
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>",
"custom_ef_record_id": {},
"attachment_file_id": {}
}
'{
"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": {},
"attachment": {
"file_id": "<string>",
"file_name": "<string>",
"file_url": "<string>"
},
"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>',
custom_ef_record_id: {},
attachment_file_id: {}
})
};
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>",
"custom_ef_record_id": {},
"attachment_file_id": {}
}
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>",
"custom_ef_record_id": {},
"attachment_file_id": {}
}
'{
"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": {},
"attachment": {
"file_id": "<string>",
"file_name": "<string>",
"file_url": "<string>"
},
"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
Path Parameters
Body Parameters
All fields are optional — only send the ones you want to change.name, hotel_name and address are cleared by
sending null; a null for any other field is ignored.
Check-out date in ISO format (
YYYY-MM-DD). When both dates are sent, check-out must be on or after check-in.A record of one of your custom emission factor databases, configured for
hotel_stays and expressed per
room-night, to calculate the stay with; null goes back to the default factor of its country. Omit it to keep the
stay’s factor. Errors: MULTIDB_CUSTOM_RECORD_NOT_FOUND_OR_DISABLED, MULTIDB_CUSTOM_RECORD_INCOMPATIBLE_CATEGORY,
CUSTOM_RECORD_UNIT_MISMATCH (422).UUID of an
uploaded file of your files to attach to the stay as its supporting
document, e.g. the hotel’s invoice or the booking confirmation; null removes the attachment and omitting it keeps
it. Sent alone, only the attachment changes: the stay is not recalculated. A file you cannot attach answers
404 NOT_FOUND naming File, and nothing changes.Response
Returns the updated hotel stay with current CO2e (HTTP 200).The document attached to the stay (
attachment_file_id), or null. Not the file the stay was read from
(file_id). A file deleted or moved to the trash is no longer attached.Show properties
Show properties
The file of your files.
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 |
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,
"attachment": 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?