Transport for Switzerland API

⭐ Beginner's Pick Transportation / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

Transport for Switzerland (transport.opendata.ch) is a free, community-maintained API for querying Swiss public transport connections, stations, and live departure boards. No authentication is needed — just send a request and get JSON data back. It covers trains, buses, and trams across the entire Swiss transport network.

💡

Beginner Tip

Try the /v1/locations endpoint to search for stations by name and get their IDs, then use those IDs with /v1/stationboard to see live departures. No sign-up or API key required.

Available Data

match scores and results
team standings
player statistics
schedule and fixtures
Use case: Integrate swiss public transport api data into web and mobile applications

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

station.name The official name of the queried station.
station.id Unique identifier for the station in the Swiss transport system.
stationboard List of upcoming departures from the station.
stationboard[].name Line or service name (e.g., IC 1, S1).
stationboard[].stop.departure Scheduled departure time in ISO 8601 format.
stationboard[].to Final destination of the transport service.

Implementation Example

const url = "https://transport.opendata.ch/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

No station found The station name provided does not match any known station in the system.
Use partial names or check spelling — for example, use "Bern" instead of "Berne" or "Bahnhof Bern".
429 Too Many Requests Sending too many requests in a short period.
Add delays between requests and cache results locally, as this is a community-maintained free service.
Connection not found The from/to parameters may have ambiguous station names.
Use station IDs from the /v1/locations endpoint instead of plain text names for more reliable results.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 265ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →