# DB Bahn

> Query Deutsche Bahn train connections and prices.

- Skill: `diegosouzapw/db-bahn` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add diegosouzapw/db-bahn`
- Raw SKILL.md: https://api.skillmd.com/api/skills/diegosouzapw/db-bahn/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: diegosouzapw (https://skillmd.com/u/diegosouzapw)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/diegosouzapw/db-bahn

---


# DB Bahn Skill 🚂

Query train connections and prices via the Deutsche Bahn API.

## CLI: dbrest

**Binary:** `dbrest` (Homebrew: `timkrase/tap/dbrest`)

### Find stations
```bash
dbrest locations "station name"
```

Output: Tab-separated list with ID, Name, Type.

### Search connections
```bash
dbrest journeys --from <ID> --to <ID> [--departure ISO8601] [--results N]
```

**Important:** `--from` and `--to` require station IDs (IBNR), not names!

**Workflow:**
```bash
# 1. Find station IDs
dbrest locations "Köln Hbf"        # → 8000207
dbrest locations "München Hbf"     # → 8000261

# 2. Search journeys
dbrest journeys --from 8000207 --to 8000261 --results 5
```

### With prices (JSON)
```bash
dbrest --json journeys --from 8000207 --to 8000261 --results 5
```

Prices are at `journeys[].price.amount` and `journeys[].price.currency`.

### Live departures
```bash
dbrest departures --stop <ID> --results 10
```

### Live arrivals
```bash
dbrest arrivals --stop <ID> --results 10
```

## Notes

- **Prices only for long-distance trains** — S-Bahn/regional trains often have no price
- **International stations** (CH, AT, etc.) work ✅
- **Global flags before command:** `dbrest --json journeys ...`

