GET /v2/orders/{order_id} for these facts:
- Transport progress. Read
statusanditems[].status. - Driver assignments and their transport work. Read
driver_assignments. - Available changes and cancellation. Read
editable_fields,allowed_actions, andcancellation_unavailable_reason.
Order status
The order status summarizes all vehicles in the order.Status rules
- If a driver cancels the gig before pickup and no other driver is assigned, the status returns to
accepted. Booking details and cancellation stay locked. Pickup codes and contacts can still change. - For truck transport, the status changes directly from
acceptedtoin_transitat pickup. The API does not show a driver name. - Delivery of the primary vehicle does not complete a trade-in order. The order stays
in_transituntil the trade-in vehicle returns to the pickup address. - You can cancel through the API only when
allowed_actionscontainscancel. Otherwise, contact Bahn to request cancellation. Bahn can cancel an order before it reachesdelivered.
Vehicle status
Each vehicle initems has its own status. Use it when the primary and trade-in vehicles are at different stages.
A cancelled order keeps the last vehicle statuses and the actual pickup and delivery times.
Driver assignment
driver_assignments lists the drivers with a booking on the order. Each entry describes one driver’s work on one vehicle.
For a trade-in vehicle, the pickup address is the order’s delivery address, and the delivery address is the order’s pickup address.
Use these rules when you show drivers:
- One driver booking does not mean that every leg or vehicle has a driver. Check
pickupanddeliveryfor each vehicle. - A driver who works on both vehicles has two entries.
pickupanddeliveryare bothfalsewhen the driver moves the vehicle on an intermediate leg.pickupisnullwhen Bahn recorded the booking in an older format that does not say whether this driver collects the vehicle.- Drivers who finished their part stay in the list after pickup and delivery.
- A name disappears when that driver is no longer assigned or Bahn assigns a different driver. Replace your displayed list each time you read the order.
- If a driver cancels the gig before pickup and no other driver is assigned, the status returns to
accepted. The list is then empty.
not_started until the driver starts to travel to pickup. Read Live tracking for the map and the pickup approach.
Available actions
allowed_actions tells you which operations the current order state permits. Use it to enable or disable controls in your system. Do not decide from status alone: an order can be accepted without update or cancel.
The list contains each action under this condition:
update: At least one field ineditable_fieldscan change.cancel: You can cancel the order.get_files: Always.get_inspection_report: The order uses thefullinspection service.get_tracking: The order is notdeliveredorcancelled.
orders:write still sees update and cancel, and its write request returns 403 permission_denied.
When changes and cancellation close
Cancellation and changes to booking details close permanently when one of these events occurs:- The order receives its first driver assignment. These permissions stay closed after any later assignment change.
- A transport company books the transport, or Bahn has already arranged it. In these cases you may not see a driver name.
editable_fields lists the permitted fields. Cancelled or delivered orders accept no changes. Contact Bahn for changes outside those permissions or for cancellation after booking.
Explain a closed action
cancellation_unavailable_reason is null while cancellation is available. When cancellation is not available, it contains a sentence that you can show to the person who requested the transport. For example:
A driver has already booked this order. Contact Bahn to request cancellation.Show the text as written. Its wording can change, so do not use it in program logic. For change controls, use
editable_fields. Cancellation and field-edit permissions have different cutoffs.
Keep your copy current
Bahn sends a webhook when the driver assignments change:com.bahn.order.status.changed.v1: The status changes fromacceptedtodriver_assigned, or back toacceptedbefore pickup.com.bahn.order.updated.v1: The driver assignments change, and the order status stays the same.
revision. Read the order again before you send a change or cancellation.
Test these changes in the sandbox with the driver_booked, driver_unbooked, and driver_reassigned scenarios. Read Sandbox testing.
These statuses and fields belong to API V2. The V1 order status values have not changed.