OrbTop

Deutsche Bahn Timetable Scraper - Schedules & Real-Time Delays

TRAVELBUSINESSDEVELOPER TOOLS

Deutsche Bahn Scraper — Train Schedules & Delays

This is the first and only Deutsche Bahn timetable actor on Apify. It queries the DB Navigator HAFAS API — the same backend powering the official Deutsche Bahn app — to return point-to-point journey results with real-time delay data, occupancy forecasts, platform information, and full segment breakdowns. Commercial HAFAS licences start at thousands of euros per year; this actor gives you the same data at $0.001 per journey result.

What does the Deutsche Bahn Scraper do?

  • Queries DB Navigator for train journeys between any two German stations
  • Returns scheduled and real-time departure/arrival times, delay minutes, and cancellation status
  • Breaks each journey into segments with train type, train number, carrier, and platform
  • Includes first and second class occupancy forecasts per journey
  • Returns ris_notizen — DB service alerts (disruptions, substitutions, platform changes)
  • One Apify run = one timetable query; schedule repeating runs to build historical delay datasets

What data does it extract?

Field Description
journey_id Unique journey identifier
origin_station Origin station name
origin_id DB station ID (EVA number)
destination_station Destination station name
destination_id DB station ID (EVA number)
departure_time Scheduled departure (ISO 8601)
departure_time_realtime Real-time departure if available
arrival_time Scheduled arrival (ISO 8601)
arrival_time_realtime Real-time arrival if available
duration_minutes Total journey duration in minutes
transfers Number of transfers
train_segments Array of individual legs with train type, number, carrier, departure, arrival, platform
platform_departure Departure platform at origin
platform_arrival Arrival platform at destination
train_type Primary train type (ICE, IC, RE, S-Bahn, etc.)
train_number Train service number
train_name Train name where applicable
carrier Operating carrier
delay_minutes Delay in minutes (negative = early)
cancelled Whether the journey was cancelled
occupancy_class_1 First class occupancy forecast (LOW/MEDIUM/HIGH)
occupancy_class_2 Second class occupancy forecast (LOW/MEDIUM/HIGH)
ris_notizen Array of DB service notices and disruption alerts
bahn_de_url Canonical bahn.de link for this journey

How to use it

Enter the origin and destination station names in plain German (e.g. Berlin Hbf, München Hbf, Frankfurt(Main)Hbf). Leave date and time empty to query tomorrow's departures at 08:00 — the defaults shown in the table below. Set maxItems to limit results if you only need the first few journeys.

Field Type Default Description
origin string Berlin Hbf Origin station name in German
destination string München Hbf Destination station name in German
date string tomorrow Date in YYYY-MM-DD format. Empty = tomorrow's date.
time string 08:00 Departure time in HH:MM format. Empty = 08:00.
fareClass integer 2 1 = First class, 2 = Second class
includeLocalTrains boolean true Include regional trains (RE, RB, S-Bahn) alongside long-distance services
maxItems integer 50 Maximum journey results to return
proxyConfiguration object Datacenter Proxy configuration for HAFAS API requests

Use cases

  • Delay monitoring and alerting — Run the actor on a fixed route daily or hourly and compare departure_time vs departure_time_realtime to build a delay histogram; trigger alerts when delay_minutes exceeds a threshold.
  • Commuter analytics — Track occupancy forecasts (occupancy_class_1, occupancy_class_2) across departure times to identify low-occupancy windows for regular business travel.
  • Journalism and research — Build a historical timetable dataset across the DB network to analyze punctuality trends, route disruptions, and seasonal patterns using ris_notizen disruption data.
  • Travel app integration — Embed live DB timetable data in your own application without licensing the HAFAS API directly — commercial HAFAS contracts start at thousands of euros per year.
  • Transport planning — Compare duration_minutes and transfers across routes to model effective travel times between German cities for logistics or workforce planning purposes.

FAQ

How much does this cost compared to a HAFAS licence? Commercial HAFAS API licences — the same data source powering this actor — start at thousands of euros per year. This actor costs $0.001 per journey result plus $0.10 per run. A daily query across 10 routes for a month costs under $1.

How do I build a delay history dataset? Schedule the actor to run at the same time each day with a fixed origin, destination, and date set to tomorrow. Each run writes its results to a fresh Apify dataset. Export and merge datasets weekly to build a longitudinal delay dataset. The journey_id field can be used to match the same scheduled service across runs.

Are real-time delays always available? departure_time_realtime and arrival_time_realtime are populated only when DB's RIS (Reise-Informations-System) has live data for that service. For future dates, only scheduled times are available.

Results are available for export in JSON, CSV, and Excel formats from the Apify dataset tab.