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:
Read the related resource and verify the signed webhook after each scenario.
Test optional states
Create the order with
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.