Transport for Switzerland

Transport for Switzerland

Transportation

Swiss public transport API

Visit API

📚 Documentation & Examples

Everything you need to integrate with Transport for Switzerland

🚀 Quick Start Examples

Transport for Switzerland Javascript Examplejavascript
// Transport for Switzerland API Example
const response = await fetch('https://transport.opendata.ch/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

The Swiss public transport API is a comprehensive and powerful tool that provides up-to-date information directly from Switzerland's public transport data. This API stands out in its capacity to offer broad-ranging data, from specific station timetables to nationwide connections, all of which are in a simple and user-friendly JSON format. Designed with developers in mind, it constituent an ideal platform not just for creating creative applications or websites focused on Swiss public transport but also for integrating Swiss transport data into existing projects or platforms.

This API also shines in its adherence to the principles of openness and accessibility. With its documentation hosted on https://transport.opendata.ch/, it crushes barriers and positions itself as an enticing proposition for developers around the globe. In effect, it is an intuitive and straightforward interface that, while Swiss-focused, has benefits that go beyond the borders of Switzerland.

The benefits of using the Swiss public transport API include:

  • Providing real-time, accurate information on Swiss public transport
  • Offering broad-ranging data, including specific station timetables and nationwide connections
  • Encouraging innovation with its user-friendly JSON format
  • Empowering developers with its open and accessible design
  • Enriching existing platforms with integrated Swiss transport data

Here is a JavaScript code example for calling the API:

const axios = require('axios');

axios.get('https://transport.opendata.ch/v1/stationboard', {
    params: {
        station: 'Zurich',
        limit: 5
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(`Error: ${error}`);
});

This code makes a GET request to the Swiss public transport API, retrieving the next 5 departures from Zurich station. All results are logged into the console, while any possible error triggers a console error message delivery.

🔒

Security Assessment

F
🔒HTTPS
Enabled
SSL Grade: T
đŸ›Ąī¸Headers
0/100
🕒Last Assessed
2 weeks ago
â„šī¸Click for detailed analysis

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jun 30Jul 2Jul 4Jul 6Jul 8Jul 1104008001440Minutes
Online
Offline

Related APIs in Transportation