Skip to content

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 ​

NameTypeDescription
fromYYYY-MM-DDFirst day, inclusive. Defaults to 6 days before to.
toYYYY-MM-DDLast day, inclusive. Defaults to today. Can't be after today.
groupIdstringOnly 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.drivingWindow is null and 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:

FieldDescription
vehiclesVehicles the driver drove in the period.
daysDriven / outsideDaysDays with any driving / days with driving outside the window.
drivingSecondsTotal driving time. Equals insideSeconds + beforeSeconds + afterSeconds.
beforeSeconds / afterSecondsDriving before the window opened / after it closed.
outsideSecondsbeforeSeconds + afterSeconds.
distanceKm / outsideDistanceKmDistance driven in total / outside the window.
trips / outsideTripsTrips / trips with driving outside the window.
days[]One entry per day driven, earliest first.

Per day (days[]):

FieldDescription
firstStart / lastEndOrganisation-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.

Partner API v1