dbahn-search
v1.1.1
Published
CLI tool to search Deutsche Bahn train journeys with BahnCard and Deutschlandticket support
Maintainers
Readme
dbahn-search
CLI tool for searching Deutsche Bahn train journeys. Built on db-vendo-client, the current library for DB's Vendo/Movas API.
Install
npm install -g dbahn-searchOr run directly with npx:
npx dbahn-search "Berlin Hbf" "Hamburg Hbf"Usage
dbahn-search <from> <to> [datetime] [options]Examples
# Search for trains departing now
dbahn-search "Berlin Hbf" "Hamburg Hbf"
# Specific date and time
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20 10:00"
# Time only (uses today's date)
dbahn-search "Frankfurt Hbf" "Köln Hbf" "14:30"
# Find cheapest journeys across the day
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20" --bestprice
# With BahnCard 50 discount
dbahn-search "Berlin Hbf" "Hamburg Hbf" --bahncard 50
# With Deutschlandticket
dbahn-search "Berlin Hbf" "Dresden Hbf" --deutschlandticket
# Combine discounts
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20" --bahncard 50 --deutschlandticket --bestprice
# Limit transfers
dbahn-search "Marburg (Lahn)" "Berlin Hbf" --transfers 1
# JSON output (for scripting)
dbahn-search "Berlin Hbf" "Hamburg Hbf" --jsonFind the cheapest day
# Cheapest day in the next 7 days
dbahn-search "Berlin Hbf" "München Hbf" --cheapest
# Cheapest day in a specific range
dbahn-search "Berlin Hbf" "München Hbf" --cheapest 2026-04-14 2026-04-28
# Cheapest day in a full month
dbahn-search "Berlin Hbf" "Hamburg Hbf" --cheapest 2026-05
# Combine with BahnCard and Deutschlandticket
dbahn-search "Berlin Hbf" "München Hbf" --cheapest --bahncard 50 --deutschlandticketOptions
| Flag | Description |
|------|-------------|
| --results N | Number of results (default: 5) |
| --bestprice | Find cheapest journeys across the day |
| --cheapest [start] [end] | Find cheapest day in a date range |
| --first-class | Search first class prices |
| --transfers N | Maximum number of transfers |
| --bahncard N | Apply BahnCard discount (25, 50, or 100) |
| --deutschlandticket | Show prices with Deutschlandticket |
| --json | Output raw JSON |
| -h, --help | Show help |
Output
Each result shows departure/arrival times, duration, transfers, train types, price, and a direct booking link to bahn.de:
Berlin Hbf -> Hamburg Hbf · Sat, 20 Apr 2026
────────────────────────────────────────────────────────────
#1 10:02 -> 11:45 (1h 43m) · direct · ICE 1007
Price: 23.90 EUR
https://www.bahn.de/buchung/fahrplan/suche#...
#2 11:02 -> 12:45 (1h 43m) · direct · ICE 1009
Price: 27.90 EUR
https://www.bahn.de/buchung/fahrplan/suche#...How it works
dbahn-search queries Deutsche Bahn's current APIs via db-vendo-client. Station names are resolved using both the DB Navigator API and bahn.de's location API (for generating accurate booking links).
Prices shown are Sparpreis/Super Sparpreis fares when available. For exact fares and booking, follow the provided bahn.de links.
Support
If you find this useful, consider buying me a coffee.
License
MIT
