Skip to main content
DELETE
Cancel an order
Cancellation stops open production work. Confirm the customer’s intent before you cancel a production order.
Required scope: orders:write. The request has no body. Before you cancel:
  1. Read the order and check that allowed_actions contains cancel. If it does not, show cancellation_unavailable_reason.
  2. Send the current revision inside double quotation marks in If-Match.
  3. Send a new Idempotency-Key. After a timeout, retry with the same key and If-Match value.
Cancellation closes permanently at the first driver booking, even if the driver unbooks later. Bahn offering the work to drivers does not close it. If a driver books while your request is in progress, Bahn returns 409 order_not_cancellable with the reason in detail. A successful cancellation sets the status to cancelled and keeps the order readable. Bahn sends com.bahn.order.cancelled.v1. If the transport was shared with other orders, Bahn arranges their transport separately. Read Change or cancel an order for an example and the recovery from each error.

Authorizations

Authorization
string
header
required

OAuth 2.0 client credentials.

Scopes

orders:write

Check prices, upload files, and change customer orders.

Headers

Idempotency-Key
string
required

A unique key for this logical write across the customer account. Reuse it only for retries of the same operation and request data.

Required string length: 8 - 255
If-Match
string
required

The current order revision inside double quotation marks. Preserve it when retrying the same logical write.

X-Request-Id
string

A caller-supplied request identifier for support.

Required string length: 1 - 255

Path Parameters

order_id
string
required

The order identifier. Stable Bahn order identifier used in every order resource path.

Pattern: ^ord_[a-z0-9]+$

Response

The cancelled order.

Current state of one transport order.

id
string
required

Stable Bahn order ID. Store it after order creation.

Pattern: ^ord_[a-z0-9]+$
ordered_for
object | null
required

Business the order was placed for, or null when it belongs to your own account.

customer_reference
string | null
required

Reference supplied by your system, or null when none was supplied.

status
enum<string>
required

Current overall order state.

Available options:
accepted,
driver_assigned,
in_transit,
delivered,
cancelled
pickup_readiness
enum<string>
required

Current seller readiness for pickup.

Available options:
pending,
preparing,
confirmed
created_at
string<date-time>
required

Time when Bahn accepted the order.

updated_at
string<date-time>
required

Time when Bahn last updated the order.

pickup
object
required

Current pickup location, contact, requested timing, agreed timing, ETA, and actual time.

delivery
object
required

Current delivery location, contact, requested timing, agreed timing, ETA, and actual time.

items
object[]
required

Primary vehicle and optional trade-in vehicle, each with its own state and handover condition.

Required array length: 1 - 2 elements
service_options
object
required

Transport and inspection service selected for this order.

price
object | null
required

Current accepted price, or null when automatic pricing is not available. An order change can calculate a new price.

customer_note
string | null
required

Order-level note supplied by the customer.

editable_fields
enum<string>[]
required

Fields accepted by PATCH at this transport stage. Pickup and delivery entries use dotted paths. Contact entries permit partial name, phone, and email updates. Empty after primary delivery or cancellation. Other validation and credential scopes still apply.

Available options:
customer_reference,
customer_note,
file_ids,
items,
service_options,
pickup.address,
pickup.type,
pickup.available_from,
pickup.requested_windows,
delivery.address,
delivery.type,
delivery.requested_windows,
pickup.release_code,
pickup.contact,
delivery.contact
allowed_actions
enum<string>[]
required

Actions that the current order state permits. The list does not check the scopes of your credential. Use this list to enable controls, and handle rejected writes because the order can change before the request completes.

Operation that the current order state permits. It does not check the scopes of your credential.

Available options:
update,
cancel,
get_files,
get_inspection_report,
get_tracking
revision
string
required

An opaque order revision. Use this value in the If-Match header for an order change. A live ETA update does not change this value. Booking, unbooking and changes to displayed driver assignments also change this value.

driver_assignments
object[]
required

Drivers with a booking on this order, one entry for each driver and vehicle. Drivers who finished their part stay in the list. A booking can cover only part of the route, and it does not start location tracking. Replace the displayed list each time you read the order.

cancellation_unavailable_reason
string | null
required

Text that explains why you cannot cancel or change the order, or null when both actions are available. Show the text as written; its wording can change. An order that returns to accepted after a driver unbooks stays closed.

distance_meters
integer | null

The driving distance in meters that the price calculation used. The field appears only in the creation response. Bahn does not store the value on the order.

Required range: x >= 0
invoicing
null | object

Accepted end-customer billing details and export progress. Null for normal account billing. Read this order to refresh progress. Exported means accepted by Netvisor, not sent or paid. Internal Netvisor identifiers are not exposed.