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": {},
"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": {},
"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
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 commuting period record
Response
string
Commuting period UUID
string
UUID of the associated employee
string
Type of commuting:
in_itinere (commute) or in_labore (work-from-home)string
Transport mode (car, bus, metro, train, bicycle, walking, telecommuting, etc.)
date
Period start date (ISO 8601)
date
Period end date (ISO 8601)
number | null
Distance per trip (km)
integer | null
Number of daily trips
string
Calculation status:
pending, active, or errornumber | null
Calculated CO2e emissions (tCO2e)
Example
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?