Skip to navigation

5. Assign your driver

Run a trip with your own fleet

Use this when your own driver runs the trip. To give the trip to a transporter instead, see outsource a trip.

1

Pick a driver

List your drivers with the existing drivers endpoint and take the id. Drivers who belong to a transporter are rejected.

2

Assign the driver

Call POST /api/v1/partners/shipment-trips/{tripId}/driver.

curl -X POST "https://lastmile.milenow.com/index.php/api/v1/partners/shipment-trips/412/driver" \
-H "Authorization: Bearer $MILE_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "driver_id": 7009107 }'
3

Check the result

The response is the full trip. These fields change:

{
"status": 200,
"msg": "Driver assigned",
"msgs": [],
"data": {
"id": 412,
"status": { "id": 4, "name": "Dispatch" },
"driver": {
"id": 7009107,
"name": "Omar Khalid",
"phone": "+966500000000",
"vehicle": { "id": 7002187, "name": "Flatbed 1", "plate": "ABC 1234" }
},
"stops": [
{ "order_id": 70003943807, "shipment": { "id": 301, "status": { "id": 23, "name": "Local Dispatch" } } }
],
"warnings": []
}
}
  • The trip status becomes 4 Dispatch.
  • The FTLs are dispatched to the driver and move to Local Dispatch.
  • The stops are re-ordered and the ETA plan is recalculated from the driver’s shift and vehicle.

You can also assign drivers in the Mile web app.

Change the driver

Send another driver_id to the same endpoint. This works until the trip starts.

The API cannot remove a driver from a trip. A trip with a driver cannot be outsourced or offered. Decide between your fleet and a transporter before you assign a driver.

Errors

ErrorCauseFix
409 Omar Khalid is busy on Shipment Trip #405 from 03 Nov 08:00 to 03 Nov 16:41, ...The driver’s other trip overlaps this onePick another driver, or change the stop times. See driver availability
409 This trip is outsourced to a partner. ...The trip is with a transporterThe transporter assigns its own driver. Or take the trip back in the web app
409 This trip has already started and can no longer be changedStatus 5 or laterNone
412 driver_id ... belongs to the transporter ...A transporter’s driverOutsource the trip to that transporter in the web app
412 driver_id not foundNot an active driver in your companyCheck the id

Next: outsource a trip.