Skip to main content
POST
/
routing
Route optimize
curl --request POST \
  --url https://apiweb.mile.app/api/v3/routing \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Result 01-24-2023 02:54:09",
  "hubId": "6352736c628401059b37a2e2",
  "hubCoordinate": "-6.17148,106.82649",
  "configuration": {
    "name": "Configuration Default",
    "capacityConstraint": [
      "weight",
      "width",
      "volume"
    ],
    "multitrip": false,
    "returnToHub": false,
    "clustering": "none",
    "useAllVehicle": false,
    "autoSpeed": false,
    "defaultSpeed": 10,
    "defaultVisitTime": 10,
    "autoSplit": "none",
    "autoMerge": false,
    "crossDockingType": "all",
    "subHubs": [
      {
        "id": "660ce14bf7613e566145fe86",
        "name": "Testing",
        "address": "Jalan Kalimaro, Cirebon Kabupaten 45694, Indonesia",
        "coordinate": "-6.84337,108.71348"
      }
    ],
    "multidayOption": "from hub",
    "useOddEven": true,
    "oddEvenTime": [
      {
        "startTime": "07:00",
        "endTime": "10:00"
      },
      {
        "startTime": "17:00",
        "endTime": "20:00"
      }
    ]
  },
  "routingDate": "2023-08-08",
  "resultCode": "Route-20230801-001",
  "visits": [
    {
      "id": "taskId-6311cc36db29775ad01694e6",
      "name": "Visit 1",
      "address": "Neo Soho, Jakarta Barat",
      "coordinate": "-6.230815251666679,106.75684387903198",
      "timeWindow": {
        "startTime": "08:00:00",
        "endTime": "16:00:00"
      },
      "visitTime": 10,
      "capacity": {
        "weight": 100,
        "volume": 150
      },
      "tags": [
        "Even",
        "East"
      ]
    },
    {
      "id": "taskId-63970a49cc6ae973f90929e2",
      "name": "Visit 2",
      "address": "Gambir Jakarta",
      "coordinate": "-6.17148,106.82649",
      "timeWindows": [
        {
          "startTime": "08:00:00",
          "endTime": "16:00:00"
        }
      ],
      "visitTime": 10,
      "capacity": {
        "weight": 2500,
        "volume": 6000
      },
      "tags": [
        "Even",
        "East"
      ]
    }
  ],
  "vehicles": [
    {
      "id": "6352736c628401059b37a2e2",
      "name": "B001ACB",
      "assignee": "miguel@mile.app",
      "capacity": {
        "weight": {
          "max": 300,
          "min": 0
        },
        "volume": {
          "max": 1000,
          "min": 0
        }
      },
      "tags": [
        "Even",
        "East"
      ],
      "speed": 15,
      "fixedCost": 0,
      "oddEven": "even",
      "workingTime": {
        "startTime": "08:00",
        "endTime": "17:00"
      }
    }
  ],
  "background": true
}
'
{
  "status": true,
  "data": {
    "name": "Result 01-24-2023 02:54:09",
    "status": "done",
    "resultCode": "Route-20230801-001",
    "result": {
      "routing": [
        {
          "vehicleId": "6352736c628401059b37a2e2",
          "vehicleName": "B001ACB",
          "assignee": "miguel@mile.app",
          "workingTime": {
            "startTime": "08:00:00",
            "endTime": "17:00:00"
          },
          "vehicleTags": [
            "Even",
            "East"
          ],
          "isOddEven": true,
          "trips": [
            {
              "visitId": "hub-6352736c628401059b37a2e2",
              "coordinate": "-6.17527,106.82581",
              "weight": 0,
              "volume": 0,
              "isHub": true,
              "travelTime": 0,
              "visitTime": 0,
              "waitingTime": 0,
              "eta": "08:00:00",
              "etd": "08:00:00",
              "distance": 0,
              "order": 0
            },
            {
              "visitId": "task-6311cc36db29775ad01694e6",
              "visitName": "Visit 1",
              "address": "Neo Soho, Jakarta Barat",
              "coordinate": "-6.230815251666679,106.75684387903198",
              "tags": [
                "Even",
                "East"
              ],
              "allowOddEven": true,
              "isHub": false,
              "weight": 100,
              "volume": 150,
              "travelTime": 34,
              "visitTime": 12,
              "waitingTime": 0,
              "eta": "08:34:00",
              "etd": "08:46:00",
              "distance": 22666,
              "order": 1
            }
          ],
          "totalWeight": 0,
          "vehicleMaxWeight": 300,
          "vehicleMinWeight": 0,
          "weightPercentage": "0%",
          "totalVolume": 0,
          "vehicleMaxVolume": 1000,
          "vehicleMinVolume": 0,
          "volumePercentage": "0%",
          "fixedCost": 0,
          "totalNodes": 2,
          "totalVisits": 1,
          "speed": 30,
          "totalTravelTime": 34,
          "totalDistance": 22666
        }
      ],
      "dropped": [
        {
          "id": "63970a49cc6ae973f90929e2",
          "name": "Visit 2",
          "address": "Gambir Jakarta",
          "coordinate": "-6.17148,106.82649",
          "timeWindow": {
            "startTime": "08:00:00",
            "endTime": "16:00:00"
          },
          "visitTime": 10,
          "capacity": {
            "weight": 2500,
            "volume": 6000
          },
          "tags": [
            "Even",
            "East"
          ],
          "weight": 2500,
          "volume": 6000,
          "isHub": false,
          "reason": "Dropped due to constraint"
        }
      ],
      "summary": {
        "routedVisits": 1,
        "droppedVisits": 1,
        "totalVisits": 2,
        "usedVehicles": 1,
        "unusedVehicles": 0,
        "totalVehicles": 1,
        "totalDistance": 22666,
        "totalTravelTime": 34,
        "totalVisitTime": 12,
        "totalWaitingTime": 0,
        "totalSpentTime": 22712,
        "minFinishTime": "08:46:00",
        "maxFinishTime": "08:46:00",
        "avgFinishTime": "08:46:00",
        "avgSpeed": 30,
        "capacityConstraint": [
          {
            "name": "weight",
            "optimized": 100,
            "available": 300,
            "percentage": 33.3
          },
          {
            "name": "volume",
            "optimized": 150,
            "available": 1000,
            "percentage": 15
          }
        ]
      },
      "countryCode": "IDN",
      "resultCode": "Route-20230801-001"
    },
    "hubId": "6352736c628401059b37a2e2",
    "hubCoordinate": "-6.17148,106.82649",
    "configuration": {
      "name": "Configuration Default",
      "defaultSpeed": 10,
      "defaultVisitTime": 10,
      "autoSplit": "none",
      "multitrip": false,
      "clustering": false,
      "returnToHub": false,
      "useAllVehicle": false,
      "autoSpeed": false,
      "autoMerge": false,
      "capacityConstraint": [
        "weight",
        "width",
        "volume"
      ],
      "crossDockingType": "all",
      "subHubs": [
        {
          "id": "660ce14bf7613e566145fe86",
          "name": "Testing",
          "address": "Jalan Kalimaro, Cirebon Kabupaten 45694, Indonesia",
          "coordinate": "-6.84337,108.71348"
        }
      ]
    },
    "createdTime": "2023-01-24T07:54:09+00:00",
    "resultTotal": {
      "routing": 1,
      "dropped": 1,
      "total": 2
    },
    "organizationId": "635f6a998e47b604ed5f5e02",
    "createdBy": "635f6a9a8e47b604ed5f5e08",
    "updatedTime": "2023-01-24T07:54:09+00:00",
    "_id": "63cf8ea11209ff54de2c15d2",
    "user": {
      "name": "Vasco Da Gama"
    }
  }
}

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Body

application/json
hubId
string
required

Fundamental entity within an organization, serving as the central point for managing various operational components. Use GET /hubs endpoint to get the list of Hub IDs. Example: 634e98498ce07d29474a7e29

visits
object[]
required

List of visits used for routing. Each visit represents a destination to be included in the optimized route.

vehicles
object[]
required

List of vehicles used for routing. Each vehicle represents a specific vehicle available for the route optimization process.

name
string

The desired name for the routing result. Users have the flexibility to define a custom name for the result. Default: Routing m-d H:i. Example: Routing 01-03 10:53

hubCoordinate
string

Coordinate of the hub. The hub coordinates represent the geographic coordinates (latitude and longitude) of the central location or starting point for the route optimization process. Example: -6.230815251666679,106.75684387903198

configuration
object[]

Configuration settings for route optimization. The default values for these configuration settings are taken from the menu route configuration at web.mile.app.

resultCode
string

This key allows users to assign unique values for result optimization data as per their requirements. If not provided, the response will automatically generate a unique resultCode. Additionally, the resultCode key can be used as a filter to categorize API responses efficiently. Default: Unique Timestamp Example: Route-20230801-001

routingDate
string

Determines the routing date to comply with odd-even traffic regulations applicable on that day. This date is used to check whether vehicles are allowed to enter odd-even restricted areas based on their license plate numbers. Format: Y-m-d Example: 2023-08-08

background
boolean

When the background parameter is set to true , the routing will be processed in the background. In this mode, the API call will return quickly with a response indicating that the routing request has been received and is being processed asynchronously in the background. When the background parameter is set to false (default), the routing will be processed directly via the API, and the response will be provided immediately. This means that the API call will wait for the route optimization process to complete before returning the results to the user. Default: false

Response

Success

status
string

Status of response.

data
object

Object of details result routing data.