Recalculate Hotel Stays
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({hotel_stay_ids: {}, activity_categories: {}})
};
fetch('https://api.dcycle.io/v1/hotel-stays/recalculate', 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/recalculate"
payload = {
"hotel_stay_ids": {},
"activity_categories": {}
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/hotel-stays/recalculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"hotel_stay_ids": {},
"activity_categories": {}
}
'{
"hotel_stay_ids": {},
"count": 123,
"processing_job_ids": {}
}Recalculate Hotel Stays
Enqueue async emission recalculation for selected hotel stays
POST
/
v1
/
hotel-stays
/
recalculate
Recalculate Hotel Stays
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({hotel_stay_ids: {}, activity_categories: {}})
};
fetch('https://api.dcycle.io/v1/hotel-stays/recalculate', 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/recalculate"
payload = {
"hotel_stay_ids": {},
"activity_categories": {}
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/hotel-stays/recalculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"hotel_stay_ids": {},
"activity_categories": {}
}
'{
"hotel_stay_ids": {},
"count": 123,
"processing_job_ids": {}
}← Hotel Stays API
Enqueue EF-config recalculation for a set of hotel stays. The endpoint returns
202 Accepted immediately and creates one ProcessingJob per requested activity category.
All hotel stay IDs must belong to the caller’s organization. IDs that don’t match are silently dropped.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
ff4adcc7-8172-45fe-9cf1-e90a6de53aa9Body Parameters
array of strings
required
One or more hotel stay UUIDs to recalculate. Must be non-empty. Maximum 5000 IDs.Example:
["a1b2c3d4-...", "e5f6g7h8-..."]array of strings
required
Activity categories to recalculate. Must be non-empty. Duplicates are silently deduplicated.Allowed values:
hotel_stays— Scope 3 hotel stay emissions
["hotel_stays"]Response
array of strings
UUIDs of the hotel stays that were enqueued (after organization scoping).
integer
Number of hotel stays enqueued.
array of strings
One
ProcessingJob UUID per dispatched activity category.Example
curl -X POST "https://api.dcycle.io/v1/hotel-stays/recalculate" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"hotel_stay_ids": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001"
],
"activity_categories": ["hotel_stays"]
}'
import requests
import os
response = requests.post(
"https://api.dcycle.io/v1/hotel-stays/recalculate",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
},
json={
"hotel_stay_ids": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001",
],
"activity_categories": ["hotel_stays"],
},
)
result = response.json()
print(f"Enqueued {result['count']} hotel stays, jobs: {result['processing_job_ids']}")
const axios = require('axios');
const response = await axios.post(
'https://api.dcycle.io/v1/hotel-stays/recalculate',
{
hotel_stay_ids: [
'550e8400-e29b-41d4-a716-446655440000',
'660e8400-e29b-41d4-a716-446655440001',
],
activity_categories: ['hotel_stays'],
},
{
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
},
}
);
console.log(`Enqueued ${response.data.count} hotel stays`);
console.log(`Job IDs: ${response.data.processing_job_ids.join(', ')}`);
Successful Response
{
"hotel_stay_ids": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001"
],
"count": 2,
"processing_job_ids": [
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
]
}
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 Unprocessable Entity
Cause: Invalid activity category{
"detail": "Invalid activity_category: unknown. Allowed: ['hotel_stays']",
"code": "VALIDATION_ERROR"
}
Related Endpoints
List Hotel Stays
Retrieve hotel stays to find IDs for recalculation
Calculation Steps
View the emission calculation breakdown
Was this page helpful?