API Documentation

A streamlined way to access multiple European railway APIs with one unified structure

⚠️ Fair Use Policy

This API is provided free of charge based on fair use principles. It is publicly available as long as it is not abused. Please be respectful with your usage - excessive requests may result in rate limiting or access restrictions. This service aggregates data from various European railway providers and is intended for personal and educational use.

Overview

The Rail Expert API provides a unified interface to query journey information from multiple European railway providers. Instead of dealing with different APIs, authentication methods, and response formats, you can use a single endpoint structure to access all supported providers.

Supported Providers

  • DB - Deutsche Bahn (Germany)
  • OEBB - Österreichische Bundesbahnen (Austria)
  • MAV - Magyar Államvasutak (Hungary)
  • PKP - Polskie Koleje Państwowe (Poland)
  • CD - České dráhy (Czech Republic)

Base URL

https://rail.expert/api/journeys/<provider>

apiDocs.baseUrlNote db, oebb, mav, pkp, cd

Endpoints

GET/api/journeys/db

Deutsche Bahn (Germany)

Search for train journeys on the German railway network and many European connections.

Parameters

ParameterTypeRequiredDescription
fromstringRequiredOrigin station ID or name
tostringRequiredDestination station ID or name
datestringRequiredDeparture date (YYYY-MM-DD)
timestringNoDeparture time (HH:MM, default: 12:00)
agenumberNoPassenger age (default: 27, affects pricing and booking URLs)
firstClassbooleanNoSearch for first class (default: false)
bestPricebooleanNoEnable best price search (default: false)
loyaltyCardstringNoLoyalty card type (e.g., BahnCard)
GET/api/journeys/oebb

Österreichische Bundesbahnen (Austria)

Search for train journeys on the Austrian railway network.

Uses the same parameters as DB endpoint. Note: fromName and toName are preferred over IDs.

GET/api/journeys/mav

Magyar Államvasutak (Hungary)

Search for train journeys on the Hungarian railway network.

Uses the same base parameters as DB endpoint. Supports age parameter.

GET/api/journeys/pkp

Polskie Koleje Państwowe (Poland)

Search for train journeys on the Polish railway network.

Uses the same base parameters as DB endpoint.

GET/api/journeys/cd

České dráhy (Czech Republic)

Search for train journeys on the Czech railway network.

Uses fromName and toName (required). Supports firstClass parameter.

Response Format

All endpoints return a consistent JSON structure with journey information.

{
  "journeys": [
    {
      "id": "string",
      "provider": "DB" | "OEBB" | "MAV" | "PKP" | "CD",
      "departure": "ISO 8601 date string",
      "arrival": "ISO 8601 date string",
      "duration": number, // in minutes
      "transfers": number,
      "price": {
        "amount": number,
        "currency": "EUR" | "CZK" | "HUF" | "PLN"
      },
      "originalPrice": { // if converted
        "amount": number,
        "currency": string
      },
      "bookingUrl": "string",
      "legs": [
        {
          "departure": "ISO 8601 date string",
          "arrival": "ISO 8601 date string",
          "origin": {
            "id": "string",
            "name": "string",
            "provider": "string"
          },
          "destination": {
            "id": "string",
            "name": "string",
            "provider": "string"
          },
          "line": "string", // e.g., "ICE 123"
          "operator": "string", // e.g., "Deutsche Bahn"
          "duration": number // in minutes
        }
      ]
    }
  ]
}

Examples

Search for journeys from Berlin to Munich

GET https://rail.expert/api/journeys/db?from=8011160&to=8000261&date=2025-11-15&time=10:00

Search with first class and best price

GET https://rail.expert/api/journeys/db?from=8011160&to=8000261&date=2025-11-15&firstClass=true&bestPrice=true

Search for youth traveler (under 27)

GET https://rail.expert/api/journeys/db?from=8011160&to=8000261&date=2025-11-15&age=25

Search Austrian railways

GET https://rail.expert/api/journeys/oebb?fromName=Wien&toName=Salzburg&date=2025-11-15&time=14:00

Rate Limiting & Best Practices

  • Please cache responses when possible to reduce unnecessary requests
  • Avoid making concurrent requests to the same endpoint
  • Implement exponential backoff for failed requests
  • Consider the underlying railway APIs' load and be respectful
  • This is a free service - commercial use requires prior discussion

Support & Contact

For questions, bug reports, or feature requests, please reach out via the contact information on the Impressum page.

This API aggregates data from various European railway providers. Rail Expert is not affiliated with any of these providers. All trademarks and service marks are the property of their respective owners. Journey information, prices, and availability are provided as-is and subject to change by the respective providers.