Get Commuting Period
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/employee-historic/{employee_historic_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/employee-historic/{employee_historic_id}"
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/employee-historic/{employee_historic_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"employee_id": "<string>",
"commuting_type": "<string>",
"transport_type": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"total_km": {},
"daily_trips": {},
"total_telecommuting_hours": {},
"status": "<string>",
"co2e": {}
}Get Commuting Period
Get a single commuting period by ID
GET
/
v1
/
employee-historic
/
{employee_historic_id}
Get Commuting Period
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/employee-historic/{employee_historic_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/employee-historic/{employee_historic_id}"
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/employee-historic/{employee_historic_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"employee_id": "<string>",
"commuting_type": "<string>",
"transport_type": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"total_km": {},
"daily_trips": {},
"total_telecommuting_hours": {},
"status": "<string>",
"co2e": {}
}← Employees API
Retrieve a single employee commuting period record by its ID. Returns the full commuting details including transport type, distances, and emission calculation status.
Request
Headers
Path Parameters
Response
Hours worked from home in the whole period, for a
telecommuting period sent with them instead of weekly_telecommuting; null otherwiseExample
curl "https://api.dcycle.io/v1/employee-historic/${COMMUTING_PERIOD_ID}" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
response = requests.get(
f"https://api.dcycle.io/v1/employee-historic/{os.getenv('COMMUTING_PERIOD_ID')}",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
)
period = response.json()
print(f"{period['transport_type']}: {period['total_km']} km/trip, {period['co2e']} tCO2e")
const axios = require('axios');
const { data: period } = await axios.get(
`https://api.dcycle.io/v1/employee-historic/${process.env.COMMUTING_PERIOD_ID}`,
{
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
}
);
console.log(`${period.transport_type}: ${period.total_km} km/trip, ${period.co2e} tCO2e`);
Successful Response
{
"id": "commuting-period-uuid",
"employee_id": "employee-uuid",
"commuting_type": "in_itinere",
"transport_type": "car",
"start_date": "2025-01-01",
"end_date": "2025-12-31",
"total_km": 25.0,
"daily_trips": 2,
"status": "active",
"co2e": 1.85
}
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"}
404 Not Found
Cause: The commuting period ID does not exist or belongs to a different organization{"detail": "Employee historic not found"}
Related Endpoints
List Commuting Periods
List all commuting periods
Update Commuting Period
Modify a commuting period
Was this page helpful?