TransportationDocumentedScanned

swiss-transport

Swiss Public Transport real-time information.

Share:

Installation

npx clawhub@latest install swiss-transport

View the full skill documentation and source below.

Documentation

Swiss Public Transport

Query Swiss public transport (SBB, BLS, ZVV, etc.) using the official transport.opendata.ch API.

Quick Commands

Search stations

curl -s "" | jq -r '.stations[] | "\(.name) (\(.id))"'

Get next departures

curl -s "" | \
  jq -r '.stationboard[] | "\(.stop.departure[11:16]) \(.category) \(.number) → \(.to)"'

Plan journey from A to B

curl -s "" | \
  jq -r '.connections[] | "Departure: \(.from.departure[11:16]) | Arrival: \(.to.arrival[11:16]) | Duration: \(.duration[3:]) | Changes: \(.transfers)"'

Get connection details with sections

curl -s "" | \
  jq '.connections[0].sections[] | {from: .departure.station.name, to: .arrival.station.name, departure: .departure.departure, arrival: .arrival.arrival, transport: .journey.category, line: .journey.number}'

API Endpoints

/v1/locations - Search stations

curl ""

Parameters:

  • query (required): Station name to search

  • type (optional): Filter by type (station, address, poi)


/v1/stationboard - Departure board


curl ""

Parameters:

  • station (required): Station name or ID

  • limit (optional): Number of results (default 40)

  • transportations[] (optional): Filter by type (ice_tgv_rj, ec_ic, ir, re_d, ship, s_sn_r, bus, cableway, arz_ext, tramway_underground)

  • datetime (optional): Date/time in ISO format


/v1/connections - Journey planner


curl ""

Parameters:

  • from (required): Starting station

  • to (required): Destination station

  • via[] (optional): Intermediate station(s)

  • date (optional): Date (YYYY-MM-DD)

  • time (optional): Time (HH:MM)

  • isArrivalTime (optional): 0 (departure, default) or 1 (arrival)

  • limit (optional): Number of connections (max 16)


Helper Script

Use scripts/journey.py for formatted journey planning:

python3 scripts/journey.py "Zürich HB" "Bern"
python3 scripts/journey.py "Basel" "Lugano" --limit 5

Notes

  • All times are in Swiss local time (CET/CEST)
  • Station names support autocomplete (e.g., "Zürich" finds "Zürich HB")
  • API returns JSON by default
  • No API key required
  • Real-time data includes delays and platform changes