List Commuting Periods
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', 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"
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 \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"items": {
"id": "<string>",
"employee_id": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"commuting_type": "<string>",
"transport_type": {},
"vehicle_size": {},
"fuel_type": {},
"renewable_energy": {},
"total_km": {},
"weekly_travels": {},
"daily_trips": 123,
"carpool": true,
"situation": "<string>",
"origin": {},
"destination": {},
"response_medium": {},
"co2e": 123,
"created_at": {},
"updated_at": {}
},
"total": 123,
"page": 123,
"size": 123
}List Commuting Periods
Retrieve all commuting periods for an employee
GET
/
v1
/
employee-historic
List Commuting Periods
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', 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"
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 \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"items": {
"id": "<string>",
"employee_id": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"commuting_type": "<string>",
"transport_type": {},
"vehicle_size": {},
"fuel_type": {},
"renewable_energy": {},
"total_km": {},
"weekly_travels": {},
"daily_trips": 123,
"carpool": true,
"situation": "<string>",
"origin": {},
"destination": {},
"response_medium": {},
"co2e": 123,
"created_at": {},
"updated_at": {}
},
"total": 123,
"page": 123,
"size": 123
}List Commuting Periods
Retrieve a paginated list of commuting periods for a specific employee. Each period contains detailed transport information and calculated CO2e emissions.Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faQuery Parameters
string
required
The employee UUID to get commuting periods forExample:
550e8400-e29b-41d4-a716-446655440000integer
default:"1"
Page number for paginationExample:
1integer
default:"50"
Number of items per page (max 100)Example:
50Response
array[object]
Array of commuting period objects
Show Commuting Period Object
Show Commuting Period Object
string
Unique identifier (UUID)
string
Employee UUID this period belongs to
date
Period start date (YYYY-MM-DD)
date
Period end date (YYYY-MM-DD)
string
Type:
in_itinere (home-work) or in_labore (during work)string | null
Mode of transport
string | null
For cars:
small, medium, largestring | null
Fuel type for motorized transport
string | null
For electric:
yes, no, do_not_knownumber | null
One-way distance in kilometers
array | null
Days of week employee commutes (0=Mon, 6=Sun)
integer
Round trips per day
boolean
Whether employee carpools
string
Period status:
active, inactive, terminatedstring | null
Origin address
string | null
Destination address
string | null
Data source:
manual, qr, formnumber
Calculated CO2 equivalent emissions in kg
datetime
Creation timestamp
datetime | null
Last update timestamp
integer
Total number of periods
integer
Current page
integer
Items per page
Example
curl -X GET "https://api.dcycle.io/v1/employee-historic?employee_id=550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID")
}
employee_id = "550e8400-e29b-41d4-a716-446655440000"
response = requests.get(
"https://api.dcycle.io/v1/employee-historic",
headers=headers,
params={"employee_id": employee_id}
)
result = response.json()
for period in result["items"]:
print(f"{period['start_date']} - {period['end_date']}")
print(f" Transport: {period['transport_type']}")
print(f" CO2e: {period['co2e']} kg")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID
};
const employeeId = '550e8400-e29b-41d4-a716-446655440000';
axios.get(
'https://api.dcycle.io/v1/employee-historic',
{ headers, params: { employee_id: employeeId } }
)
.then(response => {
response.data.items.forEach(period => {
console.log(`${period.start_date} - ${period.end_date}`);
console.log(` Transport: ${period.transport_type}`);
console.log(` CO2e: ${period.co2e} kg`);
});
});
Successful Response
{
"items": [
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"employee_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-01-01",
"end_date": "2024-06-30",
"commuting_type": "in_itinere",
"transport_type": "car",
"vehicle_size": "medium",
"fuel_type": "petrol",
"renewable_energy": null,
"total_km": 15,
"weekly_travels": [0, 1, 2, 3, 4],
"daily_trips": 1,
"carpool": false,
"situation": "active",
"origin": "Home",
"destination": "Office",
"response_medium": "form",
"co2e": 622.75,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"employee_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-07-01",
"end_date": "2024-12-31",
"commuting_type": "in_itinere",
"transport_type": "train",
"vehicle_size": null,
"fuel_type": "electric",
"renewable_energy": "yes",
"total_km": 15,
"weekly_travels": [0, 1, 2, 3, 4],
"daily_trips": 1,
"carpool": false,
"situation": "active",
"origin": "Home",
"destination": "Office",
"response_medium": "form",
"co2e": 156.20,
"created_at": "2024-07-01T09:00:00Z",
"updated_at": "2024-07-01T09:00:00Z"
}
],
"total": 2,
"page": 1,
"size": 50
}
Common Errors
404 Not Found
Cause: Employee not found{
"code": "EMPLOYEE_NOT_FOUND",
"detail": "Employee with id=UUID('...') not found"
}
Related Endpoints
Create Commuting Period
Add a new period
Get Employee
Get employee with all periods
Was this page helpful?