> ## 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.

> ## Agent Instructions
> For Bahn Customer API V2 integration work, start with /skill.md and /guides/agent-integration.md on this documentation site. Use /llms.txt to find the guides for the requested workflow.
> The main integration orders your company's transports from existing software. Follow the requested screen, service, or job. Omit ordered_for for own-account orders. Use the platform-ordering guide to choose order ownership and billing for businesses using a platform. Add a customer-facing interface only when requested.
> Use /openapi.yaml for paths, schemas, scopes, and operation preconditions. Use the guides for transport rules and recovery behavior. Load only the relevant pages.
> Use the sandbox for development and tests. Keep credentials on the server. Production orders start real transport work; follow the customer's authorized workflow and account context.
> For required writes, preserve write keys and request data across retries, and use current actions and quoted revisions for order changes. When consuming webhooks, verify and durably store them before acknowledgement.
> Deliver the implemented workflow with test evidence, setup steps, and remaining gaps. Distinguish simulated checks from requests actually verified against Bahn.

# Estimate a price

> Approximate transport prices for high-volume use, with higher rate limits than price checks. Uses addresses or coordinates and the customer's current tariff. Call POST /v2/price-checks before buyer confirmation. See [request limits](/guides/errors-and-retries#request-limits) and [usage and availability](/guides/prices#high-volume-browsing-estimates).

For each stop, choose **Address** or **Coordinates**. Coordinates are not required when you supply an address. You can use a different input format for each stop.


## OpenAPI

````yaml openapi.yaml POST /v2/price-estimates
openapi: 3.1.2
info:
  title: Bahn Customer API
  version: 2.0.0-draft
  summary: Create and follow vehicle transport orders.
  description: |
    Create vehicle transport orders and read their current state.
  contact:
    name: Bahn API support
    email: support@bahnexpress.com
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://{host}
    description: Customer API. Use the sandbox host for development and tests.
    variables:
      host:
        default: sandbox.api.bahnexpress.fi
        enum:
          - sandbox.api.bahnexpress.fi
          - api.bahnexpress.fi
        description: >-
          sandbox.api.bahnexpress.fi is the customer sandbox. api.bahnexpress.fi
          is production, where orders start real transport work.
security:
  - oauth2:
      - orders:read
      - orders:write
tags:
  - name: Authentication
    description: Create an access token for the selected environment.
  - name: Prices
    description: Check the current price for a route.
  - name: Ordering channels
    description: Check which businesses an ordering channel can represent.
  - name: Orders
    description: Create, read, change, and cancel orders.
  - name: Files
    description: Upload and read order files.
  - name: Inspections
    description: Get vehicle inspection reports.
  - name: Tracking
    description: Get the current location for each order item.
  - name: Reports
    description: Get order report rows.
  - name: Sandbox
    description: Apply deterministic scenarios in the customer sandbox.
  - name: Webhooks
    description: Receive order change events from Bahn.
paths:
  /v2/price-estimates:
    post:
      tags:
        - Prices
      summary: Estimate a price
      description: >-
        Approximate transport prices for high-volume use, with higher rate
        limits than price checks. Uses addresses or coordinates and the
        customer's current tariff. Call POST /v2/price-checks before buyer
        confirmation. See [request
        limits](/guides/errors-and-retries#request-limits) and [usage and
        availability](/guides/prices#high-volume-browsing-estimates).
      operationId: estimatePrice
      parameters:
        - $ref: '#/components/parameters/RequestId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PriceEstimateRequest'
            examples:
              Address:
                value:
                  pickup:
                    type: dealership
                    address:
                      address_line_1: Domkloster 4
                      postal_code: '50667'
                      city: Köln
                      country_code: DE
                  delivery:
                    type: dealership
                    address:
                      address_line_1: Marktplatz 2
                      postal_code: '40213'
                      city: Düsseldorf
                      country_code: DE
              Coordinates:
                value:
                  pickup:
                    type: dealership
                    coordinates:
                      lat: 50.9413
                      lng: 6.9583
                    country_code: DE
                    postal_code: '50667'
                  delivery:
                    type: dealership
                    coordinates:
                      lat: 51.2257
                      lng: 6.7716
                    country_code: DE
                    postal_code: '40213'
      responses:
        '200':
          description: An approximate price, or a reason an estimate is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PriceEstimate'
              example:
                status: estimated
                price:
                  currency: EUR
                  total_cents: 12000
                  transport_cents: 12000
                  additional_fees_cents: 0
                  trade_in_cents: 0
                distance_meters: 40210
                requires_price_check: true
                ordered_for: null
        '400':
          $ref: '#/components/responses/InvalidResourceRequest'
        '401':
          $ref: '#/components/responses/InvalidAccessToken'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '413':
          $ref: '#/components/responses/ResourceRequestTooLarge'
        '422':
          description: The represented business could not be used for this estimate.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: https://api.bahnexpress.fi/problems/ordered-for-not-allowed
                title: The price could not be estimated.
                status: 422
                code: ordered_for_not_allowed
                instance: /v2/price-estimates
                request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
                detail: A direct customer credential cannot use ordered_for.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - oauth2:
            - orders:write
components:
  parameters:
    RequestId:
      name: X-Request-Id
      in: header
      required: false
      description: A caller-supplied request identifier for support.
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    PriceEstimateRequest:
      type: object
      additionalProperties: false
      required:
        - pickup
        - delivery
      properties:
        ordered_for:
          $ref: '#/components/schemas/OrderedFor'
        pickup:
          $ref: '#/components/schemas/PriceEstimatePickup'
        delivery:
          $ref: '#/components/schemas/PriceEstimateDelivery'
        service_options:
          $ref: '#/components/schemas/ServiceOptions'
          description: >-
            Defaults to standard inspection and flexible transport. Other
            transport preferences require a price check.
    PriceEstimate:
      oneOf:
        - $ref: '#/components/schemas/AvailablePriceEstimate'
        - $ref: '#/components/schemas/UnavailablePriceEstimate'
      discriminator:
        propertyName: status
        mapping:
          estimated: '#/components/schemas/AvailablePriceEstimate'
          unavailable: '#/components/schemas/UnavailablePriceEstimate'
    Problem:
      description: A machine-readable API error in RFC 9457 problem-details format.
      type: object
      additionalProperties: false
      required:
        - type
        - title
        - status
        - code
        - instance
        - request_id
      properties:
        type:
          type: string
          format: uri
          description: A stable URI for the problem type.
        title:
          type: string
          description: A short problem summary.
        status:
          type: integer
          minimum: 400
          maximum: 599
          description: The HTTP status code returned with this problem.
        code:
          $ref: '#/components/schemas/ProblemCode'
          description: Stable code for application logic and retry decisions.
        detail:
          type: string
          description: A human-readable explanation of this occurrence.
        instance:
          type: string
          description: The request path that produced the problem.
        request_id:
          type: string
          description: Request identifier to include when you contact Bahn support.
        errors:
          type: array
          description: >-
            Field-level validation or edit-permission errors. Locked PATCH
            fields use code field_not_editable and a dotted path.
          items:
            $ref: '#/components/schemas/FieldError'
    OrderedFor:
      description: >-
        Business that an ordering channel represents. It must already exist as a
        Bahn customer in production.
      type: object
      additionalProperties: false
      required:
        - country_code
        - business_id
      properties:
        country_code:
          type: string
          pattern: ^[A-Z]{2}$
          description: The ISO 3166-1 alpha-2 country code of the Bahn customer.
        business_id:
          type: string
          minLength: 1
          maxLength: 100
          description: The official business ID of the Bahn customer.
    PriceEstimatePickup:
      oneOf:
        - title: Address
          type: object
          additionalProperties: false
          required:
            - type
            - address
          properties:
            type:
              type: string
              enum:
                - dealership
                - private
            address:
              $ref: '#/components/schemas/PriceEstimateAddress'
        - title: Coordinates
          type: object
          additionalProperties: false
          required:
            - type
            - coordinates
            - country_code
            - postal_code
          properties:
            type:
              type: string
              enum:
                - dealership
                - private
            coordinates:
              $ref: '#/components/schemas/EstimateCoordinates'
            country_code:
              type: string
              pattern: ^[A-Z]{2}$
            postal_code:
              type: string
              minLength: 1
              maxLength: 12
              description: Actual stop postal code. Germany requires five digits.
    PriceEstimateDelivery:
      oneOf:
        - title: Address
          type: object
          additionalProperties: false
          required:
            - type
            - address
          properties:
            type:
              type: string
              enum:
                - dealership
                - end_customer
            address:
              $ref: '#/components/schemas/PriceEstimateAddress'
        - title: Coordinates
          type: object
          additionalProperties: false
          required:
            - type
            - coordinates
            - country_code
            - postal_code
          properties:
            type:
              type: string
              enum:
                - dealership
                - end_customer
            coordinates:
              $ref: '#/components/schemas/EstimateCoordinates'
            country_code:
              type: string
              pattern: ^[A-Z]{2}$
            postal_code:
              type: string
              minLength: 1
              maxLength: 12
              description: Actual stop postal code. Germany requires five digits.
    ServiceOptions:
      description: Transport and inspection service selected for the order.
      type: object
      additionalProperties: false
      required:
        - transport_preference
        - inspection
      properties:
        transport_preference:
          type: string
          description: >
            How Bahn may move the primary vehicle.

            flexible allows driven or truck transport; truck_preferred requests
            a truck when practical;

            truck_required means the vehicle must not be driven.
          enum:
            - flexible
            - truck_preferred
            - truck_required
        inspection:
          type: string
          description: >-
            standard for the normal handover check; full for a structured
            inspection report.
          enum:
            - standard
            - full
    AvailablePriceEstimate:
      title: Price estimated
      type: object
      additionalProperties: false
      required:
        - status
        - price
        - distance_meters
        - requires_price_check
        - ordered_for
      properties:
        status:
          type: string
          enum:
            - estimated
        price:
          $ref: '#/components/schemas/PriceValue'
        distance_meters:
          type: integer
          minimum: 0
        ordered_for:
          $ref: '#/components/schemas/NullableOrderedFor'
        requires_price_check:
          type: boolean
          enum:
            - true
          description: >-
            Always check the current price with full addresses before buyer
            confirmation.
    UnavailablePriceEstimate:
      title: Estimate unavailable
      type: object
      additionalProperties: false
      required:
        - status
        - price
        - reason
        - requires_price_check
        - ordered_for
      properties:
        status:
          type: string
          enum:
            - unavailable
        price:
          type: 'null'
        reason:
          type: string
          enum:
            - unsupported_route
            - price_check_required
          description: >-
            This does not mean that transport cannot be booked. A final price
            check can use additional information.
        ordered_for:
          $ref: '#/components/schemas/NullableOrderedFor'
        requires_price_check:
          type: boolean
          enum:
            - true
          description: >-
            Always check the current price with full addresses before buyer
            confirmation.
    ProblemCode:
      type: string
      description: A stable machine code for client decisions.
      enum:
        - validation_error
        - authentication_failed
        - permission_denied
        - resource_not_found
        - idempotency_conflict
        - revision_conflict
        - order_not_cancellable
        - order_not_updateable
        - business_rule_violation
        - invoicing_validation_unavailable
        - ordered_for_not_allowed
        - ordered_for_customer_not_found
        - file_too_large
        - request_too_large
        - rate_limit_exceeded
        - rate_limit_unavailable
        - scenario_not_allowed
        - internal_error
    FieldError:
      description: One invalid request field.
      type: object
      additionalProperties: false
      required:
        - path
        - code
        - message
      properties:
        path:
          type: string
          description: Dot-separated path to the invalid field.
        code:
          type: string
          description: Stable validation code for this field error.
        message:
          type: string
          description: Human-readable reason why the field is invalid.
    PriceEstimateAddress:
      type: object
      additionalProperties: false
      description: >-
        The same address fields as a price check. country_code and postal_code
        are required; formatted_address is optional. Supply address_line_1 and
        city for a more precise estimate. An unrecognised German postal code is
        an input error.
      required:
        - country_code
        - postal_code
      properties:
        formatted_address:
          type: string
          minLength: 1
          maxLength: 500
          description: >-
            Complete address as it should appear to a person handling the
            transport.
        name:
          type: string
          minLength: 1
          maxLength: 500
          description: Business, dealership, auction, or site name at this address.
        address_line_1:
          type: string
          minLength: 1
          maxLength: 200
          description: Street name and building number.
        address_line_2:
          type: string
          minLength: 1
          maxLength: 200
          description: Unit, gate, building, or other secondary address detail.
        postal_code:
          type: string
          minLength: 1
          maxLength: 100
          description: Postal code for the location.
        city:
          type: string
          minLength: 1
          maxLength: 100
          description: City or municipality for the location.
        country_code:
          type: string
          pattern: ^[A-Z]{2}$
          description: Two-letter ISO 3166-1 country code, such as FI or DE.
    EstimateCoordinates:
      type: object
      additionalProperties: false
      required:
        - lat
        - lng
      properties:
        lat:
          type: number
          minimum: -90
          maximum: 90
        lng:
          type: number
          minimum: -180
          maximum: 180
    PriceValue:
      description: Price breakdown in euro cents.
      type: object
      additionalProperties: false
      required:
        - currency
        - total_cents
        - transport_cents
        - additional_fees_cents
        - trade_in_cents
      properties:
        currency:
          type: string
          enum:
            - EUR
          description: Currency for every amount in this price.
        total_cents:
          type: integer
          minimum: 0
          description: >-
            Total price, including transport, additional fees, and trade-in
            service.
        transport_cents:
          type: integer
          minimum: 0
          description: >-
            Price of the primary vehicle transport before additional fees and
            trade-in service.
        additional_fees_cents:
          type: integer
          description: >-
            Total additional service fees. The value is negative when agreed
            discounts or price corrections on the order outweigh its surcharges.
        trade_in_cents:
          type: integer
          minimum: 0
          description: >-
            Price of the reverse-route trade-in transport, or zero when none is
            included.
    NullableOrderedFor:
      description: >-
        Represented business, or null when the order belongs to the calling
        credential's own account.
      oneOf:
        - $ref: '#/components/schemas/OrderedFor'
        - type: 'null'
  responses:
    InvalidResourceRequest:
      description: The request syntax or shape is invalid.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://api.bahnexpress.fi/problems/validation-error
            title: The request body is not valid JSON.
            status: 400
            code: validation_error
            instance: /v2/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
    InvalidAccessToken:
      description: Authentication failed.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://api.bahnexpress.fi/problems/authentication-failed
            title: The access token is not valid.
            status: 401
            code: authentication_failed
            instance: /v2/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
    InsufficientScope:
      description: The access token lacks the required scope.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            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/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
            detail: The orders:write scope is required.
    ResourceRequestTooLarge:
      description: The request body exceeds the maximum size.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://api.bahnexpress.fi/problems/request-too-large
            title: The request body is too large.
            status: 413
            code: request_too_large
            instance: /v2/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
    RateLimitExceeded:
      description: >-
        The customer account allowance was reached. No operation was started.
        See [request limits](/guides/errors-and-retries#request-limits).
      headers:
        Retry-After:
          description: >-
            Minimum seconds to wait before retrying, including an exhausted
            daily allowance.
          schema:
            type: integer
            minimum: 1
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://api.bahnexpress.fi/problems/rate-limit-exceeded
            title: The request limit was reached.
            status: 429
            code: rate_limit_exceeded
            instance: /v2/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
            detail: Wait for the Retry-After interval before retrying.
    InternalError:
      description: Bahn could not complete the request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://api.bahnexpress.fi/problems/internal-error
            title: The server could not complete the request.
            status: 500
            code: internal_error
            instance: /v2/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
    ServiceUnavailable:
      description: >-
        The service is temporarily unavailable, the request timed out, or its
        shared allowance could not be checked. A rate_limit_unavailable response
        includes Retry-After in seconds.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            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/price-checks
            request_id: req_01k1a2b3c4d5e6f7g8h9j0k1m2
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0 client credentials.
      flows:
        clientCredentials:
          tokenUrl: /oauth2/token
          scopes:
            orders:read: Read customer orders.
            orders:write: Check prices, upload files, and change customer orders.
            reports:read: Read customer order reports.
            test:write: Apply customer sandbox scenarios.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.