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
apiDocs.baseUrlNote db, oebb, mav, pkp, cd
Endpoints
/api/journeys/dbDeutsche Bahn (Germany)
Search for train journeys on the German railway network and many European connections.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Required | Origin station ID or name |
to | string | Required | Destination station ID or name |
date | string | Required | Departure date (YYYY-MM-DD) |
time | string | No | Departure time (HH:MM, default: 12:00) |
age | number | No | Passenger age (default: 27, affects pricing and booking URLs) |
firstClass | boolean | No | Search for first class (default: false) |
bestPrice | boolean | No | Enable best price search (default: false) |
loyaltyCard | string | No | Loyalty card type (e.g., BahnCard) |
/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.
/api/journeys/mavMagyar Államvasutak (Hungary)
Search for train journeys on the Hungarian railway network.
Uses the same base parameters as DB endpoint. Supports age parameter.
/api/journeys/pkpPolskie Koleje Państwowe (Poland)
Search for train journeys on the Polish railway network.
Uses the same base parameters as DB endpoint.
/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:00Search with first class and best price
GET https://rail.expert/api/journeys/db?from=8011160&to=8000261&date=2025-11-15&firstClass=true&bestPrice=trueSearch for youth traveler (under 27)
GET https://rail.expert/api/journeys/db?from=8011160&to=8000261&date=2025-11-15&age=25Search Austrian railways
GET https://rail.expert/api/journeys/oebb?fromName=Wien&toName=Salzburg&date=2025-11-15&time=14:00Rate 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.