Skip to navigation

4. Manage stops

Read trips, then add, remove or re-plan stops before the trip starts

Trips are created in the Mile web app. Through the API you read them, and add or remove stops until the trip starts. Every change made through the API re-orders the stops and recalculates the ETA plan, then returns the full trip with warnings.

List trips

GET /api/v1/partners/shipment-trips returns your trips, newest first, without stops.

curl -G "https://lastmile.milenow.com/index.php/api/v1/partners/shipment-trips" \
-H "Authorization: Bearer $MILE_TOKEN" \
--data-urlencode "created_from=2026-10-01" \
--data-urlencode "limit=20" \
--data-urlencode "page=1"
FilterMeaning
status_idTrip status id
driver_idTrips with this driver
partner_idTrips outsourced to this transporter
created_from, created_toDay the trip was created, Y-m-d. Not the pickup day
page, limitlimit is 1 to 50, default 20

Read the next page while data.has_more is true. Other query parameters are ignored.

Get a trip

GET /api/v1/partners/shipment-trips/{tripId} returns the trip with its stops, FTLs and ETA plan. The fields are explained in build trips.

curl "https://lastmile.milenow.com/index.php/api/v1/partners/shipment-trips/412" \
-H "Authorization: Bearer $MILE_TOKEN"

Add FTLs to a trip

POST /api/v1/partners/shipment-trips/{tripId}/stops adds 1 to 50 stops to a trip you built in the web app.

Stop fieldRequiredMeaning
shipment_id or shipmentYes, one of themAn existing FTL, or a new FTL object
legNooutbound (default) or return
pickup_atYesStart of the pickup window, H:i
pickup_toNoEnd of the pickup window. Defaults to pickup_at
deliver_fromNoStart of the delivery window. Defaults to the pickup_at time
deliver_toNoEnd of the delivery window. Defaults to deliver_from

Send times only. The pickup day is the FTL’s created_on and the delivery day is its expected_on. The end of the pickup window must be in the future.

curl -X POST "https://lastmile.milenow.com/index.php/api/v1/partners/shipment-trips/412/stops" \
-H "Authorization: Bearer $MILE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"stops": [
{ "shipment_id": 303, "pickup_at": "10:30", "pickup_to": "11:30", "deliver_from": "13:00", "deliver_to": "15:00" }
]
}'

The response is the full trip with warnings. The trip rules apply, and the leg order check includes the stops already on the trip. The request is all or nothing: if any stop fails, no stop and no FTL is added.

stops[0]: pickup 03-Nov-2026 08:00 is in the past (now 03-Nov-2026 09:15). The pickup day comes from the FTL’s created_on. Send a later pickup_at, or use an FTL with a later created_on.

pickup_at is on 2026-11-04 but the shipment created_on is 2026-11-03. Send only the time, H:i.

Expected delivery (...) is before the pickup (...). Check the FTL’s created_on and expected_on, and the stop’s deliver_from.

Return pickup (...) must be on or after the outbound delivery (...). Move the return pickup_at later.

Shipment SHP-1001 is already on Shipment Trip #358. Remove it from that trip first. Remove the stop from the other trip, or use another FTL.

This trip is outsourced to Desert Line Transport. Take it back from the partner before adding stops. Take the trip back in the Mile web app first. A started trip cannot change.

Remove a stop

POST /api/v1/partners/shipment-trips/{tripId}/stops/remove removes one stop by its order_id.

curl -X POST "https://lastmile.milenow.com/index.php/api/v1/partners/shipment-trips/412/stops/remove" \
-H "Authorization: Bearer $MILE_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "order_id": 70003943808 }'
  • The stop must not have started (stop status 1 Scheduled).
  • A trip keeps at least one stop. To drop the last one, add another stop first.
  • The FTL is kept. You can put it on another trip.
  • The remaining stops are renumbered.
ErrorCause
404 order_id is not a stop on this tripWrong order_id, or it belongs to another trip
409 This stop has already started and cannot be removedThe driver has started this stop
409 A trip needs at least one stopIt is the last stop

Optimize a trip (web)

In the Mile web app, open the trip and click Optimize and save sequence. Mile re-orders the stops and recalculates the ETA plan. Stop times do not change.

Adding or removing a stop and assigning a driver through the API already re-optimize the trip. Optimize in the web app when a response had a warnings item such as ETAs could not be calculated: ..., or to refresh an old plan.

Need to create trips, optimize them or assign them to transporters through the API? Contact Mile support and we will enable it for your account.

When a trip can change

Trip stateAdd stopsRemove a stopOptimize (web)Assign your driver
New, no driverYesYesYesYes
Your driver assigned, not startedYesYesYesYes, to change the driver
Outsourced to a transporter, not startedNoYesYesNo
Started (status 5 or later)NoNoNoNo

Next: assign your driver.