2. Create FTLs
An FTL holds the cargo details: numbers, customer, consignee, containers, and the pickup and delivery days. You can create it in two ways:
- On its own with
POST /api/v1/partners/shipments. Then put it on a trip in the Mile web app, or add it to a trip with itsshipment_id. - Inside a stop, as a
shipmentobject, when you add stops to a trip. It takes the same fields and is created together with the stop.
Both ways apply the same validation and the same duplicate rule.
Request
Required fields
Optional fields include vessel, voyage_no, tracking_no, notes, origination_port, stayed_ports, shipping_method, country and documents. The reference lists them all.
Customer and consignee
Send id to reuse a party: the consigner.id or consignee.id from an earlier FTL. For a new party, send name and address. A new customer also needs phone. Send the phone in the correct format for its country, with the country code. Mile matches it against existing customers in your account. Mile locates the address with Google Maps. Read customers and consignees for how phones and coordinates are matched.
Containers
Pickup at a port
By default the container is picked up at the customer’s address. To pick it up at a port, send pickup_from_port: true and the port as destination_port (name, code or UN/LOCODE) or destination_port_id. Find ports with port search.
Documents
Optional. Each document has a type from options, a file_name ending in .png, .jpg, .jpeg or .pdf, and file_base64 of 300 KB or less.
Response
The response is shortened here. Keep these fields:
id: send it asshipment_idin a trip stop.consigner.idandconsignee.id: send them ascustomer.idandconsignee.idin later FTLs.
Errors
412: several problems at once
Every problem is in msgs. Fix them all and send again.
409: the FTL already exists
The same shipment_no, bl_no and container number are already in your account. Use the shipment_id from the message instead of creating it again.
Next: build trips.

