Sandbox
Apply a sandbox scenario
Advance a sandbox order through a deterministic transport scenario.
POST
/
v2
/
test
/
orders
/
{order_id}
/
advance
Apply a sandbox scenario
curl --request POST \
--url https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"scenario": "pickup_readiness_confirmed"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({scenario: 'pickup_readiness_confirmed'})
};
fetch('https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance"
payload = { "scenario": "pickup_readiness_confirmed" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"scenario": "pickup_readiness_confirmed",
"order": {
"id": "ord_01k1a2b3c4d5e6f7g8h9j0k1m2",
"ordered_for": null,
"customer_reference": "PO-2026-1042",
"status": "accepted",
"pickup_readiness": "confirmed",
"created_at": "2026-07-30T13:00:00Z",
"updated_at": "2026-08-03T08:40:00+03:00",
"pickup": {
"address": {
"formatted_address": "Teollisuuskatu 1, 00510 Helsinki, Finland",
"name": null,
"address_line_1": "Teollisuuskatu 1",
"address_line_2": null,
"postal_code": "00510",
"city": "Helsinki",
"country_code": "FI",
"coordinates": {
"latitude": 60.188,
"longitude": 24.951
}
},
"type": "dealership",
"contact": null,
"release_code": null,
"available_from": "2026-08-03T08:00:00+03:00",
"requested_windows": [],
"agreed_window": null,
"eta": "2026-08-03T08:40:00+03:00",
"eta_updated_at": "2026-08-03T08:35:00+03:00",
"actual_at": null
},
"delivery": {
"address": {
"formatted_address": "Hatanpään valtatie 24, 33100 Tampere, Finland",
"name": null,
"address_line_1": "Hatanpään valtatie 24",
"address_line_2": null,
"postal_code": "33100",
"city": "Tampere",
"country_code": "FI",
"coordinates": {
"latitude": 61.489,
"longitude": 23.766
}
},
"type": "dealership",
"contact": null,
"requested_windows": [],
"agreed_window": null,
"commitment_deadline_at": null,
"eta": null,
"eta_updated_at": null,
"actual_at": null
},
"items": [
{
"id": "item_01k1a2b3c4d5e6f7g8h9j0k1m2_primary",
"role": "primary",
"status": "awaiting_pickup",
"vin": "WBA00000000000001",
"registration_number": null,
"make": null,
"model": null,
"note": null,
"fuel_type": "unknown",
"transmission": "unknown",
"engine_power_kw": null,
"first_registered_year": null,
"kerb_weight_kg": null,
"cmr": "digital",
"plates": "none",
"pickup_condition": null,
"delivery_condition": null,
"winter_tires": {
"mounted": false,
"in_vehicle": false
}
}
],
"service_options": {
"transport_preference": "flexible",
"inspection": "standard"
},
"price": {
"currency": "EUR",
"total_cents": 45900,
"transport_cents": 43900,
"additional_fees_cents": 2000,
"trade_in_cents": 0
},
"customer_note": null,
"allowed_actions": [
"update",
"cancel",
"get_files",
"get_inspection_report",
"get_tracking"
],
"revision": "x5Bm9Qa2Kd7Rv1Nu4Le8Yc3Hj6Wp0Tg5FsZiAoUkEnM"
}
}{
"type": "https://api.bahnexpress.fi/problems/validation-error",
"title": "The request body is not valid JSON.",
"status": 400,
"code": "validation_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/authentication-failed",
"title": "The access token is not valid.",
"status": 401,
"code": "authentication_failed",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/permission-denied",
"title": "The access token does not have the required scope.",
"status": 403,
"code": "permission_denied",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The test:write scope is required."
}{
"type": "https://api.bahnexpress.fi/problems/resource-not-found",
"title": "The sandbox scenario could not be applied.",
"status": 404,
"code": "resource_not_found",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The order does not exist."
}{
"type": "https://api.bahnexpress.fi/problems/scenario-not-allowed",
"title": "The sandbox scenario could not be applied.",
"status": 409,
"code": "scenario_not_allowed",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The order pickup must be complete."
}{
"type": "https://api.bahnexpress.fi/problems/request-too-large",
"title": "The request body is too large.",
"status": 413,
"code": "request_too_large",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/internal-error",
"title": "The server could not complete the request.",
"status": 500,
"code": "internal_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/internal-error",
"title": "The server could not complete the request in time.",
"status": 503,
"code": "internal_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}Required scope:
test:write.
Read the workflow guide for setup, examples, and recovery behavior.
Authorizations
OAuth 2.0 client credentials.
Headers
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 - 255A caller-supplied request identifier for support.
Required string length:
1 - 255Path Parameters
The order identifier. Stable Bahn order identifier used in every order resource path.
Pattern:
^ord_[a-z0-9]+$Body
application/json
Scenario to apply to one sandbox order.
Named state change to apply. Its current-state precondition must be satisfied.
Available options:
pickup_readiness_confirmed, pickup_approach_started, pickup_nearby, pickup_completed, delivery_eta_changed, inspection_completed, files_published, tracking_available, tracking_unavailable, tracking_paused, delivery_completed, cancelled Optional event time for deterministic tests. Defaults to the current time.
Response
The sandbox applied the scenario.
Applied scenario and the resulting current order.
Scenario that was applied.
Available options:
pickup_readiness_confirmed, pickup_approach_started, pickup_nearby, pickup_completed, delivery_eta_changed, inspection_completed, files_published, tracking_available, tracking_unavailable, tracking_paused, delivery_completed, cancelled Current order after the scenario.
Show child attributes
Show child attributes
⌘I
Apply a sandbox scenario
curl --request POST \
--url https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"scenario": "pickup_readiness_confirmed"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({scenario: 'pickup_readiness_confirmed'})
};
fetch('https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://sandbox.api.bahnexpress.fi/v2/test/orders/{order_id}/advance"
payload = { "scenario": "pickup_readiness_confirmed" }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"scenario": "pickup_readiness_confirmed",
"order": {
"id": "ord_01k1a2b3c4d5e6f7g8h9j0k1m2",
"ordered_for": null,
"customer_reference": "PO-2026-1042",
"status": "accepted",
"pickup_readiness": "confirmed",
"created_at": "2026-07-30T13:00:00Z",
"updated_at": "2026-08-03T08:40:00+03:00",
"pickup": {
"address": {
"formatted_address": "Teollisuuskatu 1, 00510 Helsinki, Finland",
"name": null,
"address_line_1": "Teollisuuskatu 1",
"address_line_2": null,
"postal_code": "00510",
"city": "Helsinki",
"country_code": "FI",
"coordinates": {
"latitude": 60.188,
"longitude": 24.951
}
},
"type": "dealership",
"contact": null,
"release_code": null,
"available_from": "2026-08-03T08:00:00+03:00",
"requested_windows": [],
"agreed_window": null,
"eta": "2026-08-03T08:40:00+03:00",
"eta_updated_at": "2026-08-03T08:35:00+03:00",
"actual_at": null
},
"delivery": {
"address": {
"formatted_address": "Hatanpään valtatie 24, 33100 Tampere, Finland",
"name": null,
"address_line_1": "Hatanpään valtatie 24",
"address_line_2": null,
"postal_code": "33100",
"city": "Tampere",
"country_code": "FI",
"coordinates": {
"latitude": 61.489,
"longitude": 23.766
}
},
"type": "dealership",
"contact": null,
"requested_windows": [],
"agreed_window": null,
"commitment_deadline_at": null,
"eta": null,
"eta_updated_at": null,
"actual_at": null
},
"items": [
{
"id": "item_01k1a2b3c4d5e6f7g8h9j0k1m2_primary",
"role": "primary",
"status": "awaiting_pickup",
"vin": "WBA00000000000001",
"registration_number": null,
"make": null,
"model": null,
"note": null,
"fuel_type": "unknown",
"transmission": "unknown",
"engine_power_kw": null,
"first_registered_year": null,
"kerb_weight_kg": null,
"cmr": "digital",
"plates": "none",
"pickup_condition": null,
"delivery_condition": null,
"winter_tires": {
"mounted": false,
"in_vehicle": false
}
}
],
"service_options": {
"transport_preference": "flexible",
"inspection": "standard"
},
"price": {
"currency": "EUR",
"total_cents": 45900,
"transport_cents": 43900,
"additional_fees_cents": 2000,
"trade_in_cents": 0
},
"customer_note": null,
"allowed_actions": [
"update",
"cancel",
"get_files",
"get_inspection_report",
"get_tracking"
],
"revision": "x5Bm9Qa2Kd7Rv1Nu4Le8Yc3Hj6Wp0Tg5FsZiAoUkEnM"
}
}{
"type": "https://api.bahnexpress.fi/problems/validation-error",
"title": "The request body is not valid JSON.",
"status": 400,
"code": "validation_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/authentication-failed",
"title": "The access token is not valid.",
"status": 401,
"code": "authentication_failed",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/permission-denied",
"title": "The access token does not have the required scope.",
"status": 403,
"code": "permission_denied",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The test:write scope is required."
}{
"type": "https://api.bahnexpress.fi/problems/resource-not-found",
"title": "The sandbox scenario could not be applied.",
"status": 404,
"code": "resource_not_found",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The order does not exist."
}{
"type": "https://api.bahnexpress.fi/problems/scenario-not-allowed",
"title": "The sandbox scenario could not be applied.",
"status": 409,
"code": "scenario_not_allowed",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2",
"detail": "The order pickup must be complete."
}{
"type": "https://api.bahnexpress.fi/problems/request-too-large",
"title": "The request body is too large.",
"status": 413,
"code": "request_too_large",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/internal-error",
"title": "The server could not complete the request.",
"status": 500,
"code": "internal_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}{
"type": "https://api.bahnexpress.fi/problems/internal-error",
"title": "The server could not complete the request in time.",
"status": 503,
"code": "internal_error",
"instance": "/v2/test/orders/ord_01k1a2b3c4d5e6f7g8h9j0k1m2/advance",
"request_id": "req_01k1a2b3c4d5e6f7g8h9j0k1m2"
}