Skip to main content
Start with the transport request in your existing system: for example, moving a vehicle between sites or arranging a delivery. Create the Bahn order from that request, then store its ID alongside your own record. For your company’s transports, use your own Bahn account and omit ordered_for. Add the capabilities your workflow needs after the first order works. Quickstart provides that first complete request.

The core loop

Once order creation and reads work, subscribe to webhooks for the changes your system needs. A webhook tells you what changed. The resource tells you what is true now. This distinction matters when events arrive late, arrive more than once, or arrive in a different order.

Store the right identifiers

After order creation, store these values together: Do not build a second version of the order lifecycle from webhook events. Store the data your system needs, then refresh it from the API after relevant events.

Add the capabilities your workflow needs

Make reads event-driven

Read the order when your workflow needs its current status, timing, or available actions. Use webhooks to refresh stored records after relevant changes. If you show a live map, poll the tracking resource every 30 to 60 seconds while it is visible. The event payload contains data.resource_url. Tracking, file, and inspection events point to their own resources. Order events point to the order. Use data.related_resource_urls when one change affects more than one resource.

Keep writes deliberate

Create one idempotency key for each logical write that requires it. Reuse it for retries of the same operation and request data. Before an update or cancellation, read the latest order. Check allowed_actions, then send the current revision inside double quotation marks in If-Match. If Bahn returns revision_conflict, read the order again and make a new decision.

Ordering for other businesses

If your platform arranges transport for its business users, follow Platform ordering. This track adds ordered_for, eligibility checks, and business context in storage and webhook routing. Continue with Orders and timing for the order model, or Webhooks for the event-processing flow.