Skip to main content
V2 resource errors use application/problem+json. The OAuth token endpoint uses standard OAuth error responses. Branch on the stable code, not the human-readable message. Include the request_id when you contact Bahn support.

Read a problem response

The errors array can identify more than one invalid field. Do not parse the human message to select a program action.

Choose a recovery action

Set a maximum retry count and surface a failure when it is exhausted. A token refresh is the limited recovery path for a resource 401. Other permanent 4xx errors need a corrected request, permission, or account setup.

Use idempotency keys

Order creation, updates, cancellation, file-upload creation, and sandbox advancement require Idempotency-Key. Price checks and represented-business checks do not require it. File deletion is idempotent without the header. Use a unique key of 8 to 255 characters for each logical write. Keys are shared across write operations for the authenticated customer account, so a cancellation must not reuse an order-creation key. Store the key with the method, resource path, and request data. After a timeout, retry that request rather than starting another write. For an update or cancellation, preserve the original If-Match too. A retry of a completed order write does not perform the write again, but it can return the order’s current state. Do not assume that the response is an identical historical snapshot. After idempotency_conflict, check your stored request before changing anything. A new key is appropriate for a new logical write. It is not a way to recover an unknown result from a timed-out creation.

Use order revisions

Order updates and cancellation require If-Match. Put the current order revision inside double quotation marks:
After revision_conflict, read the order again. Decide whether the original change is still appropriate, check allowed_actions, and use a new key for the newly decided write. Do not automatically overwrite another person’s change. A live ETA update does not change the order revision.

Store request IDs

You can send X-Request-ID. The response also includes a request ID. Store the request ID with each write result. Send it to support@bahnexpress.com when you report a problem.