Get live departures for any railway station
Tutorial: list every railway station in a German city, then fetch live departures and arrivals for any station including local trains, delays and disruptions via the free keyless InfraNode API.
1. List every station in a city
The catalog /cities/{slug}/stations returns every DB
station within the city with EVA number, name, category, coordinates and ZIP.
It maps stations via the official municipality key, so it covers all cities.
import requests
base = "https://infranode.dev/api/v1"
# 1) All stations in a city (with EVA number)
stations = requests.get(f"{base}/cities/berlin/stations", timeout=10).json()
for s in stations["data"]["payload"]["stations"][:5]:
print(s["eva"], s["name"], "cat.", s["category"]) 2. Live departures per station (incl. local trains)
With the EVA number you fetch the live board of each individual station, all categories, with real-time delay and platform:
# 2) Live departures of any station by its EVA
eva = "8011160" # Berlin Hauptbahnhof (from the catalog above)
board = requests.get(f"{base}/stations/{eva}/departures", timeout=10).json()
for d in board["data"]["payload"]["departures"][:10]:
delay = d.get("delay_minutes")
print(d["planned_time"], d["line"], "->", d["destination"],
f"(+{delay} min)" if delay else "", "platform", d.get("platform")) 3. Disruptions and messages
Every departure/arrival carries cancelled and
messages (disruption and info messages with type, code, category
and timestamp):
# 3) Disruptions and messages per departure
for d in board["data"]["payload"]["departures"]:
if d.get("cancelled"):
print("Cancelled:", d["line"], "->", d["destination"])
for m in d.get("messages", []):
print("Message:", m.get("type"), m.get("code"), m.get("category")) Also via MCP
AI agents use the same data through the stations,
station_board_departures and station_board_arrivals
tools of the InfraNode MCP server.
FAQ
- How is this different from station-departures?
- /cities/{slug}/station-departures returns the merged board of a city's main station, derived automatically from the official StaDa catalog (full coverage across all 84 cities). /stations/{eva}/departures returns the board of EVERY individual station by its EVA number, including local trains (S-Bahn, RB, RE).
- Where do I get the EVA number?
- From the catalog /cities/{slug}/stations. Each station carries an eva field that you pass straight into /stations/{eva}/departures.
- Are local trains and disruptions included?
- Yes. The boards include all categories (ICE/IC/RE/RB/S) plus real-time delays, cancellations and disruption messages (messages per entry).
- Do I need a key?
- Not for calling the public InfraNode API. Internally the board is sourced from the DB Timetables API (CC BY 4.0); show the attribution Deutsche Bahn AG.