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.
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.
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.
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.
Existing FTL
New return FTL
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.
412: pickup is in the past
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.
412: a date in a time field
pickup_at is on 2026-11-04 but the shipment created_on is 2026-11-03. Send only the time, H:i.
412: delivery before pickup
Expected delivery (...) is before the pickup (...). Check the FTL’s created_on and expected_on, and the stop’s deliver_from.
412: return pickup before the outbound delivery
Return pickup (...) must be on or after the outbound delivery (...). Move the return pickup_at later.
409: FTL already on a trip
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.
409: the trip is outsourced or started
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.
- 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.
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
Next: assign your driver.

