Skip to main content
Read the full order with GET /v2/orders/{order_id} for these facts:
  • Transport progress. Read status and items[].status.
  • Driver assignments and their transport work. Read driver_assignments.
  • Available changes and cancellation. Read editable_fields, allowed_actions, and cancellation_unavailable_reason.
Order creation and driver booking are different events. You create an order when you request a transport. A driver books the order later, when the driver accepts transport work on it. One order can have several driver bookings, for example one for each vehicle or leg. A leg is one part of a vehicle’s route.

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 accepted to in_transit at 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_transit until the trade-in vehicle returns to the pickup address.
  • You can cancel through the API only when allowed_actions contains cancel. Otherwise, contact Bahn to request cancellation. Bahn can cancel an order before it reaches delivered.

Vehicle status

Each vehicle in items 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.
In this example, two drivers share the primary vehicle’s route. The first driver collects the vehicle. The second driver hands it over at the delivery address. 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 pickup and delivery for each vehicle.
  • A driver who works on both vehicles has two entries.
  • pickup and delivery are both false when the driver moves the vehicle on an intermediate leg.
  • pickup is null when 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.
A driver booking does not start location tracking. The tracking resource stays 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 in editable_fields can change.
  • cancel: You can cancel the order.
  • get_files: Always.
  • get_inspection_report: The order uses the full inspection service.
  • get_tracking: The order is not delivered or cancelled.
The list does not check the scopes of your credential. A credential without 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.
Bahn can offer the transport to drivers before anyone books it. This offer alone does not close changes or cancellation. Pickup release codes and pickup contacts remain editable until primary pickup completes. Delivery contacts remain editable until primary delivery completes. 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 from accepted to driver_assigned, or back to accepted before pickup.
  • com.bahn.order.updated.v1: The driver assignments change, and the order status stays the same.
There is no separate event for a driver assignment. After either event, read the order for the current status, drivers, and actions. Read Webhooks for delivery and ordering rules. A change to the driver assignments also changes the order 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.