https://sandbox.api.bahnexpress.fi.
Sandbox credentials, orders, files, webhook endpoints, signing secrets, events, and tracking snapshots stay separate from production data.
Prepare the environment
Create a sandbox credential and webhook endpoint on the Customer API page in the Bahn portal. The endpoint needs a publicly reachable HTTPS URL. Sandbox address responses use the structured address fields that you send. Includecountry_code in each address.
An ordering channel can use any supported test business ID in ordered_for. The sandbox creates an isolated business when none matches, so you can test the flow before that business exists in Bahn. Leave ordered_for out to test an order for your own account.
The supported country codes are FI, DK, DE, and PL.
To test the preflight separately, call POST /v2/represented-business-checks with a supported test business ID and country code. The sandbox returns eligible when no customer matches, without creating a customer. This verifies your eligibility flow but does not prove that the business exists in production.
Apply a scenario
Create a normal order, then callPOST /v2/test/orders/{order_id}/advance.
The call needs the test:write scope and an idempotency key. The optional occurred_at field makes the test time deterministic.
The response contains the current order. It does not replace webhook delivery.
Test the main order flow
Apply these scenarios in order for a standard transport flow:pickup_readiness_confirmed: Pickup readiness becomesconfirmed.driver_booked: Status becomesdriver_assigned, the driver’s name appears, and cancellation closes.pickup_approach_started: Tracking becomes active and progress becomeson_the_way.pickup_nearby: Pickup progress becomesnearby.pickup_completed: The order enters transit.delivery_eta_changed: A delivery ETA becomes available.files_published: Sample order files become available.tracking_available: A driver position becomes available.delivery_completed: The order becomes delivered.
Test optional states
Each scenario needs the order state in parentheses:driver_unbooked(before pickup): Status returns toaccepted, driver names clear, and cancellation stays closed.driver_reassigned(before pickup): The driver name and order revision change.inspection_completed(full inspection and completed pickup): The inspection report becomes available.tracking_unavailable(completed pickup): The position becomes unavailable.tracking_paused(completed pickup): A ferry phase pauses live tracking.cancelled(order not cancelled): Simulates an internal Bahn cancellation, including after booking. Customer DELETE still followsallowed_actions.
inspection: full before you test inspection_completed.
Use one of the named scenarios. A request fails when the scenario does not match the current order state.
Move from sandbox to production
Sandbox prices, times, files, and positions are test data. They do not predict a production result. Use/v2/test routes only with the sandbox base URL.
Sandbox webhooks use the normal event and signature formats. Test the events and recovery paths your integration relies on through your sandbox endpoint. Read Go live before switching environments.