> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.milenow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.milenow.com/_mcp/server.

# 3. Build trips (web)

A trip is the work for one truck. You build it in the **Mile web app** from FTLs you already created, through the API or in the web app. Then you read it through the API.

> **Info**
>
> 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.

## Build a trip in the web app

#### Create the FTLs

[Create each FTL](/ftl-trips/guides/create-ftls) first. Its `created_on` sets the pickup day and its `expected_on` the delivery day.

#### Create a trip

In the Mile web app, open the **FTL Trips** menu and create a trip.

#### Add the FTLs as stops

Each stop carries one FTL. For each stop, enter:

| What you enter             | Rule                                                                                                                                                |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Leg                        | **Outbound** (default) or **Return**. A trip with a return stop is a round trip                                                                     |
| Pickup from, pickup to     | The pickup window, as times. The day is the FTL's `created_on`. Pickup to defaults to pickup from                                                   |
| Delivery from, delivery to | The delivery window, as times. The day is the FTL's `expected_on`. Delivery from defaults to the pickup time, delivery to defaults to delivery from |

Each window must end on or after it starts, and the delivery must not start before the pickup. To pick up on another day, change the FTL's `created_on`, not the stop.

#### Optimize the route

Click **Optimize and save sequence**. Mile orders the stops and calculates the [ETA plan](/ftl-trips/business-rules#eta-plan). Stop times do not change. Mile also re-optimizes after every change made through the API.

#### Choose who drives

[Assign your own driver](/ftl-trips/guides/assign-driver), through the API or the web app. Or [outsource the trip](/ftl-trips/guides/outsource) to a transporter in the web app. Not both.

A new trip has status `null` until a driver is assigned. See [trip statuses](/ftl-trips/business-rules#trip-statuses).

## Outbound and round trips

#### Outbound trip

One outbound stop: pick up a full container at the port between 10:00 and 11:00, and deliver it to the factory between 12:00 and 14:00.

#### Round trip

An outbound stop delivers the full container from the port to the factory. A return stop then takes the empty container from the factory to the depot, picking up between 15:00 and 16:00 and delivering between 16:30 and 18:00.

The return FTL's customer is the factory, so the empty is picked up there. Its consignee is the depot.

## Trip rules

* An FTL can be on one trip only. It can be on both legs of the same trip, but only once per leg. To move it, [remove its stop](/ftl-trips/guides/manage-stops#remove-a-stop) from the other trip first.
* Return stops come after the outbound deliveries. Every return pickup must be on or after the latest outbound delivery start on the trip.
* Once a trip is outsourced to a transporter, you cannot add stops until you take it back.
* A trip can change until it starts. See [when a trip can change](/ftl-trips/guides/manage-stops#when-a-trip-can-change).

## Where the truck picks up

| FTL                                                               | Pickup point                                                   |
| ----------------------------------------------------------------- | -------------------------------------------------------------- |
| `pickup_from_port` is not `true` and the customer has coordinates | The customer's address                                         |
| Otherwise                                                         | The FTL's warehouse if it has one, else its `destination_port` |

The container is always delivered to the consignee.

## Read the trip through the API

Once the trip is saved, it appears in [list trips](/ftl-trips/api-reference/ftl-trips/list-ftl-trips). [Get a trip](/ftl-trips/api-reference/ftl-trips/get-ftl-trip) returns it in full. The response is shortened here.

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

```json
{
  "status": 200,
  "msg": "Shipment trip fetched successfully",
  "msgs": [],
  "data": {
    "id": 412,
    "type": "round_trip",
    "status": null,
    "outbound_stops": 1,
    "return_stops": 1,
    "driver": null,
    "partner": null,
    "offer": null,
    "busy_from": "2026-11-03 09:30:00",
    "busy_to": "2026-11-03 17:41:00",
    "stops": [
      {
        "order_id": 70003943807,
        "tracking_no": "MSKU4821736",
        "leg": "outbound",
        "stop_no": 1,
        "pickup_sequence": 1,
        "delivery_sequence": 2,
        "status": { "id": 1, "name": "Scheduled" },
        "pickup": { "address": "Jiddah", "from": "2026-11-03 10:00:00", "to": "2026-11-03 11:00:00" },
        "delivery": { "name": "Coastal Trading Factory", "address": "South Industrial Area, Jeddah", "from": "2026-11-03 12:00:00", "to": "2026-11-03 14:00:00" },
        "eta": "2026-11-03 12:09:00",
        "shipment": { "id": 301, "shipment_no": "SHP-1001" }
      },
      {
        "order_id": 70003943808,
        "tracking_no": "MSKU4821736-2",
        "leg": "return",
        "stop_no": 1,
        "pickup_sequence": 3,
        "delivery_sequence": 4,
        "status": { "id": 1, "name": "Scheduled" },
        "pickup": { "address": "South Industrial Area, Jeddah", "from": "2026-11-03 15:00:00", "to": "2026-11-03 16:00:00" },
        "delivery": { "name": "Jeddah Port Empty Depot", "address": "Jeddah Islamic Port, Jeddah", "from": "2026-11-03 16:30:00", "to": "2026-11-03 18:00:00" },
        "eta": "2026-11-03 16:28:00",
        "shipment": { "id": 302, "shipment_no": "SHP-1002" }
      }
    ],
    "eta": { "busy_from": "2026-11-03 09:30:00", "busy_to": "2026-11-03 17:41:00", "total_km": 80, "late": false, "days": [] }
  }
}
```

| Field                                          | Meaning                                                                                         |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `id`                                           | The trip id. Use it in every later call                                                         |
| `driver`, `partner`, `offer`                   | Who runs the trip: your driver, the transporter it is outsourced to, or the latest offer        |
| `type`                                         | `round_trip` when there is a return stop, else `outbound`                                       |
| `status`                                       | `null` until a driver is assigned. See [trip statuses](/ftl-trips/business-rules#trip-statuses) |
| `stops[].order_id`                             | The stop id. Use it to [remove the stop](/ftl-trips/guides/manage-stops#remove-a-stop)          |
| `stops[].stop_no`                              | Position within its leg, in the order you added stops                                           |
| `stops[].pickup_sequence`, `delivery_sequence` | Position in the optimized route. Pickups and deliveries share one numbering                     |
| `stops[].eta`                                  | Estimated arrival at the consignee                                                              |
| `eta`                                          | The [ETA plan](/ftl-trips/business-rules#eta-plan), day by day                                  |
| `busy_from`, `busy_to`                         | When the truck is busy with this trip. Used for driver clashes                                  |

Next: [manage stops](/ftl-trips/guides/manage-stops).