Skip to main content
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));
{
  "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

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

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

employee_historic_id
string
required
UUID of the commuting period record

Response

id
string
Commuting period UUID
employee_id
string
UUID of the associated employee
commuting_type
string
Type of commuting: in_itinere (commute) or in_labore (work-from-home)
transport_type
string
Transport mode (car, bus, metro, train, bicycle, walking, telecommuting, etc.)
start_date
date
Period start date (ISO 8601)
end_date
date
Period end date (ISO 8601)
total_km
number | null
Distance per trip (km)
daily_trips
integer | null
Number of daily trips
status
string
Calculation status: pending, active, or error
co2e
number | 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}"

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"}

List Commuting Periods

List all commuting periods

Update Commuting Period

Modify a commuting period