Skip to main content
POST
/
vehicle
Create vehicle
curl --request POST \
  --url https://apiweb.mile.app/api/v3/vehicle \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Mini Van 54",
  "assignee": "leandro@mile.app",
  "speed": 30,
  "fixedCost": 15,
  "tags": [
    "Ganjil",
    "Depok",
    "B1124CC"
  ],
  "workingTime": {
    "startTime": "08:00",
    "endTime": "17:00",
    "multiday": 0
  },
  "breakTime": {
    "startTime": "11:00",
    "endTime": "11:30"
  },
  "hubId": "621dd813eb3ebf16b94d6969",
  "capacity": {
    "width": {
      "min": 10,
      "max": 1000
    },
    "height": {
      "min": 10,
      "max": 1000
    }
  }
}
'
{
  "status": true,
  "message": "Success",
  "data": {
    "name": "Mini Van 54",
    "assignee": "leandro@mile.app",
    "speed": 30,
    "fixedCost": 15,
    "tags": [
      "Ganjil",
      "Depok",
      "B1124CC"
    ],
    "workingTime": {
      "startTime": "08:00",
      "endTime": "17:00",
      "multiday": 0
    },
    "capacity": {
      "width": {
        "min": 10,
        "max": 1000
      },
      "height": {
        "min": 10,
        "max": 1000
      }
    },
    "organizationId": "621dd813eb3ebf16b94dbde3",
    "hubId": "621dd813eb3ebf16b94d6969",
    "updatedTime": "2022-07-13T03:16:40+00:00",
    "createdTime": "2022-07-13T03:16:40+00:00",
    "_id": "62ce3918d3f3e1681a3a54b2"
  }
}

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Body

application/json
hubId
string
required

The identifier for the hub that generated by system. Use GET /hubs API to get the list of Hub IDs. Example: 621dd813eb3ebf16b94d6969

name
string
required

The name of the vehicle, which can be a number plate, vehicle brand, or any relevant identifier for the vehicle. This name is used to distinguish and label each vehicle in the route optimization results. Example: Mini Van 54

assignee
string
required

Worker's email that is assigned to the vehicle. Each vehicle can only be assigned to one worker, and this parameter helps to manage the vehicle assignments. Example: leandro@mile.app

workingTime
object[]
required

Working hours of the vehicle, containing startTime, endTime, and multiday. The time is specified in the 24-hour format, and it defines the time span during which the vehicle is available for routing tasks. In this example, the multiday value is set to 1, indicating that the vehicle's working hours span two consecutive calendar days. The vehicle starts its shift at 9:00 AM and continues until 4:00 PM the next day. Example: { 'startTime':'08:00', 'endTime':'17:00', 'multiday':0 }

breakTime
object[]

Indicates that the data inside represents the break time for the vehicle. containing: startTime, and endTime.

speed
string

The average speed of the vehicle in kilometers per hour (km/h). Must not be less than 5 km/h. Example: 30 Default: 25

fixedCost
integer

The Cost Factor value range is set from 0 to 100, with the default value being 0. A lower number signifies a higher priority for routing optimization purposes. Example: 15 Default: 0

tags
string[]

Tags used for route optimization purposes. Visits with matching tags will be assigned to vehicles with the same tags. Example: ['Ganjil','Depok','B1124CC']

Maximum array length: 10
capacity
object[]

Capacity specifications for route optimization, which are dynamic based on user needs. Includes minimum and maximum values for weight and volume. Example: { 'weight':{'min':10,'max':1000}, 'volume':{'min':10,'max':1000} }

Response

Success

status
string

Status of response.

message
string

Message of API response.

data
object

Detail of object vehicle.