> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bahnexpress.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Bahn Customer API

> Add vehicle transport to your product.

The Bahn Customer API lets businesses arrange vehicle transport between a pickup location and a delivery location. Dealers, marketplaces, auction platforms, and leasing companies use it to place orders and follow each transport through delivery.

Most integrations create an order flow, an operations view, or a tracking page. You can also use webhooks to automate customer messages and collect the photos, documents, and inspection reports for each transport.

<CardGroup cols={2}>
  <Card title="Create a sandbox order" icon="rocket" href="/quickstart">
    Get a token and create your first order with one complete request.
  </Card>

  <Card title="Understand the lifecycle" icon="route" href="/guides/integration-workflows">
    See how orders, webhooks, tracking, and files fit together.
  </Card>

  <Card title="Build tracking" icon="map-pin" href="/guides/tracking-and-inspections">
    Show ETAs, pickup progress, and a map marker for each vehicle.
  </Card>

  <Card title="Order as a platform" icon="network" href="/guides/ordering-channels">
    Place orders for other businesses with an ordering-channel credential.
  </Card>
</CardGroup>

## The standard integration

A typical integration follows one simple loop. A price check is optional. The order is not.

1. Get an OAuth access token.
2. Check the price if your product needs to show one before checkout.
3. Create the order and store the Bahn order ID.
4. Receive webhooks for meaningful changes.
5. Read the current order or related resource after a webhook.

The order is the main resource. It contains the accepted price, current status, vehicles, timing, and the actions that are currently available. Tracking, files, inspection reports, and report rows are separate resources because products use them in different ways.

| If your product needs to…                     | Use…                                         |
| --------------------------------------------- | -------------------------------------------- |
| Show a price before the customer confirms     | `POST /v2/price-checks`                      |
| Place and manage a transport order            | `/v2/orders`                                 |
| Show the latest ETA and agreed timing         | The order resource                           |
| Put a vehicle marker on a map                 | The tracking resource                        |
| Show photos, documents, or inspection results | The file and inspection resources            |
| Keep local data current                       | Signed webhooks, followed by a resource read |
| Export many orders                            | The order report resource                    |

## Timing has four meanings

Customer products often make timing confusing. Keep these values separate in your data model and UI:

* A **requested window** is the time the customer asked for.
* An **agreed window** is the time range Bahn agreed to target.
* An **ETA** is the latest arrival estimate.
* An **actual time** records when pickup or delivery completed.

Use the actual time after completion. Before completion, prefer the ETA, then the agreed window, then the requested time.

## Production and sandbox

| Environment | Base URL                             | Use                                         |
| ----------- | ------------------------------------ | ------------------------------------------- |
| Sandbox     | `https://sandbox.api.bahnexpress.fi` | Test orders, webhooks, files, and tracking. |
| Production  | `https://api.bahnexpress.fi`         | Real transport orders.                      |

Each environment has separate credentials and data.

<Warning>
  A production order starts real operational work. Complete the full order and webhook flow in the sandbox first.
</Warning>

## A few rules prevent most integration bugs

Use a new idempotency key for each logical write. Store the `revision` from every order response, and send it in `If-Match` when you update or cancel an order. Check `allowed_actions` before you offer those actions in your UI.

Treat webhooks as change notifications. Verify the signature, deduplicate the event, and read `data.resource_url` when you need the latest resource.

Start with the [Quickstart](./quickstart). Use the **API Reference** tab for complete field definitions and interactive requests.

For credentials or integration support, contact `support@bahnexpress.com`.
