Does Deutsche Bahn have an API? How an AI agent searches trains
As of 2026-11-11, Deutsche Bahn has an official Timetables API on its DB API Marketplace: a free, beta service for station arrival and departure boards and planned timetables, with registration and 60 calls a minute. It does not search connections between two stations or return fares. Wield gives your AI agent one tool, bahn.de/search-connections, which runs bahn.de's own search on wield.run's servers or in your browser.
Deutsche Bahn Search train connections between two stations with prices
Read-only, no loginRuns hosted in a cloud browser
Parameters (8)
| Metric | Wield recipe | Browser Use + Claude Sonnet 5.5 |
|---|---|---|
| Success | 100% | 0% |
| Median time | 2.1 s | 676 s |
| Cost per run | $0 | $0.589 |
9 runs each, 7 November 2026. How we measure
What your agent gets
| Recipe | What it does | Login | Status (11 Nov 2026) |
|---|---|---|---|
bahn.de/search-connections | Finds ICE, IC, regional, S-Bahn and bus connections between two stations on a date, like bahn.de's search. Returns departure and arrival times, duration, transfers, trains with platforms, and the cheapest fare for the class, or none when bahn.de shows no price. Pages later connections with page_ref. | No | Benchmark on 7 Nov 2026: 9 of 9 runs passed, median 2.1 seconds. Registry health is browser only, and the live check is still pending. |
The recipe needs from, to and date (YYYY-MM-DD). time is in Europe/Berlin local time and defaults to 08:00. mode is ABFAHRT (depart at or after the time) or ANKUNFT (arrive by the time). travel_class is second or first class, and adults takes 1 to 9. Station names are free text, and the recipe returns the stations it actually used, so your agent can check them.
The price is the "ab" fare that bahn.de shows, Sparpreis where available. It is not a booking. You buy on bahn.de yourself. bahn.de's Akamai protection rejects plain server requests, so the registry marks the recipe browser only. wield.run runs it in a cloud browser, keyless, and it took about 20 s on 11 Nov 2026. In your own browser it uses the cookies that browser already has. Wield does not store your cookies.
Use it in 60 seconds
- Remote MCP server (
https://wield.run/mcp). Add it to ChatGPT, Claude, Cursor or any MCP client. No key is needed. Without a key you get 60 runs an hour per network. A free key comes from wield.run/signin, with $1 of credit at sign-up. - Hosted API. This recipe runs in a cloud browser, so expect seconds, not under a second. With a key, a cloud-browser read costs $0.03 instead of $0.002.
curl -X POST https://wield.run/api/v1/run \
-H "Content-Type: application/json" \
-d '{"recipe": "bahn.de/search-connections", "params": {"from": "Berlin Hbf", "to": "München Hbf", "date": "2027-03-14", "time": "09:00"}}' Or send {"task": "Trains from Berlin Hbf to München Hbf on 14 March 2027 after 09:00"} to https://wield.run/api/v1/do.
- Local install. Run
npx -y wield-mcp initto connect Claude Desktop, Claude Code, Cursor or Codex. Then install the Wield Chrome extension from wield.run/install and open bahn.de once in the same browser. No login is needed to search. On the hosted route the request and the result pass through wield.run. Results stay on your device only on the local route.
Example prompts
- "Find trains from Berlin Hbf to München Hbf on 14 March 2027, departing after 09:00. Show the cheapest second-class fare."
- "Show ICE connections from Hamburg to Frankfurt on Friday morning with at most one transfer."
- "Find a train from Berlin that arrives in Köln by 18:00 on 20 January 2027, and show first-class prices."
- "Get the next page of connections from Leipzig to Dresden for tomorrow and list the departure platforms."
Limits and the site's terms
- The recipe is read only. It searches and shows prices. It cannot book, change or cancel a ticket.
- Prices change, and some connections show no fare. In that case
price_euris empty, not zero. - Times are scheduled. Real-time forecasts appear only close to departure.
- Wield's registry notes that bahn.de's terms do not allow automated bulk queries of timetable or fare data, so the recipe performs one search at a time that you start yourself, at human pace. Read the site's terms.
- Run one search at a time, hosted or in your own browser. Do not loop the recipe to watch for cheaper fares.
- If bahn.de shows a check, Wield stops with
site_challengeand asks you to complete it in your own tab.
FAQ
Does Deutsche Bahn have an official API for timetables?
Yes, for station boards. The DB API Marketplace lists a Timetables API (version 1.0.287 when we read it on 11 November 2026). It returns arrivals and departures as station boards, the planned timetable and current changes for a station. It is marked beta, has a free usage plan with 60 calls a minute, needs a registration, and the page says it will be replaced by a new OpenBoards API. It is licensed under CC BY 4.0.
Does the official API search connections or fares?
Not that we could find. The Timetables endpoints take a station, a date and an hour, not a start and a destination. We found no official fare or connection-search API on the Marketplace product list as of 11 November 2026. Wield's recipe covers that gap by using bahn.de's own search, in a cloud browser on wield.run or in your own browser.
Can an AI agent book a train with Wield?
No. Wield's bahn.de recipe is read only. It searches connections and shows prices. You book on bahn.de.
Why does a connection show no price?
bahn.de shows no fare for some connections, so the recipe returns an empty price for them.
Is the recipe faster than a browser agent?
In our preliminary benchmark on 7 November 2026, the recipe passed all 9 runs with a median of 2.1 seconds. The browser agent made one run, and bot protection blocked it after about 11 minutes. The benchmark is still running.
Sources
- DB API Marketplace: Timetablesdevelopers.deutschebahn.com
- DB API Marketplace product listdevelopers.deutschebahn.com
- Wield registry entry for bahn.de/search-connectionswield.run