Appearance
Driving times
GET /fleet/driving-times
How long each driver drove per day, measured against the organisation's driving window: the hours of the day when driving is expected, for example 06:00–20:00, set in the organisation's settings. Driving time is split into time inside the window and time before or after it.
Query parameters
| Name | Type | Description |
|---|---|---|
from | YYYY-MM-DD | First day, inclusive. Defaults to 6 days before to. |
to | YYYY-MM-DD | Last day, inclusive. Defaults to today. Can't be after today. |
groupId | string | Only vehicles in this group. 404 if the group doesn't exist. |
Days are organisation-local. A period can cover at most 31 days. The response isn't paginated. This endpoint allows 30 calls per minute per client and 60 per minute per organisation, counted inside the shared /fleet/* limit.
How it is calculated
- Only trips whose vehicle had a driver assigned when the trip started are counted, and they are credited to that driver. Trips with no driver are left out.
- A trip that crosses midnight is split between the two days. Its distance is shared out by the time spent on each day.
- Outside driving shorter than
meta.outsideToleranceSeconds(60 s) doesn't flag a trip, day or driver as outside. - If the organisation hasn't set a driving window,
meta.drivingWindowisnulland the lists are empty.
Example
bash
curl "https://api.routetracks.com/api/v1/partner/v1/fleet/driving-times?from=2026-10-20&to=2026-10-22" \
-H "Authorization: Bearer $TOKEN"json
{
"data": [
{
"driverId": "cm1drv0007",
"driverName": "Nimal Perera",
"vehicles": [{ "vehicleId": "cm1veh0003", "licensePlate": "WP CAB-1234" }],
"daysDriven": 2,
"outsideDays": 1,
"drivingSeconds": 30120,
"insideSeconds": 27420,
"beforeSeconds": 2700,
"afterSeconds": 0,
"outsideSeconds": 2700,
"distanceKm": 412.6,
"outsideDistanceKm": 31.9,
"trips": 9,
"outsideTrips": 1,
"days": [
{
"date": "2026-10-21",
"trips": 5,
"drivingSeconds": 16200,
"insideSeconds": 13500,
"beforeSeconds": 2700,
"afterSeconds": 0,
"firstStart": "05:15",
"lastEnd": "17:40",
"segments": [
{ "vehicleId": "cm1veh0003", "start": "05:15", "end": "07:05" },
{ "vehicleId": "cm1veh0003", "start": "09:30", "end": "11:10" }
]
}
]
}
],
"daily": [
{ "date": "2026-10-20", "drivingSeconds": 0, "insideSeconds": 0, "beforeSeconds": 0, "afterSeconds": 0, "driversOutside": 0 },
{ "date": "2026-10-21", "drivingSeconds": 16200, "insideSeconds": 13500, "beforeSeconds": 2700, "afterSeconds": 0, "driversOutside": 1 },
{ "date": "2026-10-22", "drivingSeconds": 13920, "insideSeconds": 13920, "beforeSeconds": 0, "afterSeconds": 0, "driversOutside": 0 }
],
"meta": {
"timezone": "Asia/Colombo",
"from": "2026-10-20",
"to": "2026-10-22",
"groupId": null,
"drivingWindow": { "start": "06:00", "end": "20:00" },
"outsideToleranceSeconds": 60,
"totals": {
"drivingSeconds": 30120,
"insideSeconds": 27420,
"beforeSeconds": 2700,
"afterSeconds": 0,
"outsideSeconds": 2700,
"distanceKm": 412.6,
"outsideDistanceKm": 31.9,
"trips": 9,
"outsideTrips": 1,
"drivers": 1,
"driversOutside": 1
}
}
}Fields
Per driver (data[]), sorted with the most outside driving first:
| Field | Description |
|---|---|
vehicles | Vehicles the driver drove in the period. |
daysDriven / outsideDays | Days with any driving / days with driving outside the window. |
drivingSeconds | Total driving time. Equals insideSeconds + beforeSeconds + afterSeconds. |
beforeSeconds / afterSeconds | Driving before the window opened / after it closed. |
outsideSeconds | beforeSeconds + afterSeconds. |
distanceKm / outsideDistanceKm | Distance driven in total / outside the window. |
trips / outsideTrips | Trips / trips with driving outside the window. |
days[] | One entry per day driven, earliest first. |
Per day (days[]):
| Field | Description |
|---|---|
firstStart / lastEnd | Organisation-local HH:mm of the first trip start and the last trip end. 24:00 means midnight at the end of the day. |
segments[] | Each trip piece that day: vehicle and local start/end time. |
Fleet per day (daily[]): every day of the period, including days nobody drove, with fleet totals and the number of drivers who drove outside the window.