Skip to main content
PATCH
Change an order
Required scope: orders:write. Send the body as application/merge-patch+json. Before you send a change:
  1. Read the order and check each supplied field against editable_fields.
  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, If-Match value, and body.
Booking details close at the first driver or carrier booking. Pickup release codes and pickup contacts remain editable until pickup completes. Delivery contacts remain editable until delivery completes. Read editable_fields before each PATCH. A mixed permitted/locked request returns 409 order_not_updateable with field paths in errors and saves nothing. After 412 revision_conflict, read the order again and decide which changes still apply. Omitted fields keep their values. requested_windows replaces the list of the supplied stop, and file_ids only adds files. Booking details follow the same rules as a new order and can change the price. Code/contact-only changes preserve price and timing. Read Change or cancel an order for the field rules, 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]+$

Body

application/merge-patch+json

Order fields to change. Omitted fields keep their current values.

customer_reference
string | null

Replacement customer reference, or null to clear it.

Required string length: 1 - 255
pickup
object

Changes only the supplied pickup fields.

delivery
object

Changes only the supplied delivery fields.

items
Primary vehicle · object[]

Replaces the primary vehicle input. Include its identifier and every fact to retain, including height_mm and tires. Sending it also prices the tire answer again. A trade-in item remains unchanged.

Required array length: 1 element
service_options
object

Replacement transport and inspection service.

file_ids
string[]

Adds uploaded files to the order. Existing order files remain attached.

Stable identifier for an uploaded or published order file.

Pattern: ^file_[a-z0-9-]+$
customer_note
string | null

Replacement order-level note, or null to clear it.

Maximum string length: 5000

Response

The updated 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.