Deutsche Bahn Scraper - Train Schedules & Prices
Pricing
Pay per usage
Deutsche Bahn Scraper - Train Schedules & Prices
Scrape train connections, schedules, and prices from Deutsche Bahn (bahn.de). Extract ICE, IC, RE, and S-Bahn routes with departure/arrival times, duration, transfers, carriers, and live fares across Germany and Europe.
Pricing
Pay per usage
Rating
0.0
(0)
Developer
Studio Amba
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Share
Deutsche Bahn Scraper
Scrape train connections, schedules, and prices from Deutsche Bahn (bahn.de), Germany's national railway operator with over 50 million monthly visitors. Extract ICE, IC, RE, RB, and S-Bahn routes with departure/arrival times, durations, transfer counts, platform numbers, carrier information, and live ticket fares.
No login or cookies required. The actor handles bahn.de's complex SPA and anti-bot protections automatically using residential proxies and a headless browser.
How to scrape Deutsche Bahn data
- Go to Deutsche Bahn Scraper on the Apify Store.
- Click Try for free to open the actor in Apify Console.
- Enter your origin and destination stations (e.g., "Berlin Hbf" to "München Hbf").
- Optionally set a departure date and time.
- Click Start and wait for the results.
- Download your data in JSON, CSV, Excel, or connect it directly to your workflow via API.
Why use this actor?
- Comprehensive data — Get full connection details including train types, prices, platforms, transfer counts, and individual journey legs in a single run.
- No login needed — Extracts publicly available schedule and pricing data without any Deutsche Bahn account.
- Handles the SPA — bahn.de is a complex single-page application. This actor uses Playwright to properly render the page and extract data that simple HTTP scrapers miss.
- Scheduled runs — Set up daily or hourly schedules to monitor price changes on your preferred routes.
- API access — Integrate train data directly into your applications, dashboards, or business workflows using the Apify API.
Input
| Parameter | Type | Default | Description |
|---|---|---|---|
origin | string | Berlin Hbf | Departure station name. Partial names are resolved automatically. |
destination | string | München Hbf | Arrival station name. Partial names are resolved automatically. |
departureDate | string | Tomorrow | Search date in YYYY-MM-DD format. |
departureTime | string | 08:00 | Earliest departure time in HH:MM format (24h). |
travelClass | string | 2 | Travel class: 1 (First) or 2 (Second). |
maxResults | integer | 20 | Maximum number of connections to return (1-200). |
proxyConfiguration | object | Residential DE | Proxy settings. Residential proxies with a German exit node are recommended. |
Example input
{"origin": "Berlin Hbf","destination": "München Hbf","departureDate": "2026-06-15","departureTime": "08:00","travelClass": "2","maxResults": 20,"proxyConfiguration": {"useApifyProxy": true,"apifyProxyGroups": ["RESIDENTIAL"],"apifyProxyCountry": "DE"}}
Output
The actor produces a dataset with one item per train connection. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.
Example output
{"origin": "Berlin Hbf","destination": "München Hbf","departureTime": "2026-06-15T08:15:00+02:00","arrivalTime": "2026-06-15T12:10:00+02:00","duration": "3h 55min","durationMinutes": 235,"trainType": "ICE","trainNumber": "ICE 1001","price": 29.90,"currency": "EUR","travelClass": "2","transfers": 0,"legs": [{"origin": "Berlin Hbf","destination": "München Hbf","departureTime": "2026-06-15T08:15:00+02:00","arrivalTime": "2026-06-15T12:10:00+02:00","trainType": "ICE","trainNumber": "ICE 1001","carrier": "DB Fernverkehr","departurePlatform": "6","arrivalPlatform": "12"}],"carrier": "DB Fernverkehr","departurePlatform": "6","arrivalPlatform": "12","url": "https://int.bahn.de/en/buchung/fahrplanauskunft?...","scrapedAt": "2026-06-09T14:30:00.000Z"}
Data fields
| Field | Type | Description |
|---|---|---|
origin | string | Departure station name |
destination | string | Arrival station name |
departureTime | string | ISO 8601 departure timestamp |
arrivalTime | string | ISO 8601 arrival timestamp |
duration | string | Human-readable duration (e.g., "3h 55min") |
durationMinutes | number | Duration in minutes for easy sorting/filtering |
trainType | string | Primary train category: ICE, IC/EC, RE/RB, S-Bahn, TGV, etc. |
trainNumber | string | Full train identifier (e.g., "ICE 1001") |
price | number | Ticket price in EUR (0 if not available) |
currency | string | Always "EUR" |
travelClass | string | Travel class searched (1 or 2) |
transfers | number | Number of transfers/changes |
legs | array | Individual trip segments with per-leg train details |
carrier | string | Operating railway company (e.g., "DB Fernverkehr") |
departurePlatform | string | Departure platform/track number |
arrivalPlatform | string | Arrival platform/track number |
url | string | Direct link to this connection on bahn.de |
scrapedAt | string | ISO 8601 timestamp of when the data was collected |
How much does it cost to scrape Deutsche Bahn?
The actor uses Playwright with residential proxies, which consumes approximately 0.2-0.5 compute units per run for a typical search of 20 connections. That translates to roughly $0.05-$0.12 per run at standard Apify pricing. Running daily monitoring on a single route would cost approximately $1.50-$3.60 per month.
For high-volume usage, increase maxResults and use the pagination feature to get more connections per run rather than running multiple separate searches.
Tips
- Use German station names for best results. "München Hbf" works better than "Munich Central".
- Prices may not always be available — Deutsche Bahn shows prices dynamically and some connections may return a price of 0. This typically means the fare is not yet released or sold out.
- Schedule runs during off-peak hours for the most reliable results.
- Residential proxies with a German exit node (
DE) are strongly recommended. bahn.de has Akamai protection that blocks datacenter IPs. - Search ahead — Deutsche Bahn releases tickets 6 months in advance. Earlier searches tend to show lower "Sparpreis" fares.
FAQ
Is it legal to scrape Deutsche Bahn?
This actor extracts publicly available train schedule and pricing data from bahn.de. The data is accessible to any visitor without login. Always review Deutsche Bahn's Terms of Service and ensure your use case complies with applicable laws and regulations.
Why are some prices showing as 0?
Deutsche Bahn loads prices dynamically and some fare classes may not be available for all connections. A price of 0 means the fare was not displayed on the search results page. Try searching for a closer departure date when prices are more likely to be published.
The actor returned no results — what should I do?
- Make sure your station names are valid German station names (e.g., "Frankfurt (Main) Hbf" not "Frankfurt Airport").
- Check that your departure date is in the future.
- Ensure you are using residential proxies with a German exit node.
- Try a popular route like "Berlin Hbf" to "München Hbf" to verify the actor is working.
Can I scrape international routes?
Yes, Deutsche Bahn covers international connections to Austria, Switzerland, France, Netherlands, Belgium, Czech Republic, Poland, Denmark, and more. Enter the destination as it appears on bahn.de (e.g., "Wien Hbf", "Zürich HB", "Paris Est").
Support
If you encounter any issues or have feature requests, please open an issue in the Issues tab. For custom solutions or bulk data needs, reach out via the Apify platform.