Route Optimization Balance Routes

Balance total time spent for each route

NametypeDescription
balanceRoutesbooleanOptional. Default false: the optimization uses as few drivers as it needs for the most efficient result, so some selected drivers may get no tasks at all. When true, every selected driver gets a route, and the workload is balanced by total route time (driving plus service time), not by number of stops.
curl -X POST "https://onfleet.com/api/v2/optimizations/scheduled" \
  -u "$ONFLEET_API_KEY:" \
  -H "Content-Type: application/json" \
  -d '{
    "tasks": [
      "Knf1Tfv9XhhztP8fFnlG4lwp",
      "FMBu5EOi2T55dGKBrWTHTBHx",
      "d5x*6ONmw~mxqso6pURUHqt0",
      "gIhT8pxJPPfou~KkMmjDhLqy",
      "8zw4MnBIsnm397HB01qUymLc",
      "YPfNoRJHpXJPdbw5ryssI5gZ"
    ],
    "teams": {
      "K3FXFtJj2FtaO2~H60evRrDc": ["m~ooPjqzofSGulgzKk6VN4ps"]
    },
    "date": 1795420800000,
    "timezone": "America/Los_Angeles",
    "mode": 0,
    "serviceTime": 10,
    "maxViolationTime": 0,
    "maxTasksPerRoute": 20,
    "schedulingMethod": 1,
    "defaultSchedule": [
      {
        "date": 1795420800000,
        "slots": [{ "start": "0800", "end": "2000" }],
        "owner": "K3FXFtJj2FtaO2~H60evRrDc",
        "timezone": "America/Los_Angeles"
      }
    ],
    "routeStart": "hub://1wd7SNmgXyrBv7zP3Q9tMf3Y",
    "routeEnd": "hub://1wd7SNmgXyrBv7zP3Q9tMf3Y",
    "allowMissingLinkedTasks": true
  }'