Swiss Train & Transit Connections API

Train, bus and tram connections between two places in Switzerland: departure and arrival times, duration, transfers, train and line names, platform, delay, crowding level and the legs of each journey.

$0.50 per 1,000 records

You pay only for the records you get. Zero records cost zero. 10,000 free records of this API to start (5,000 at the base price of $1 per 1,000), no card.

Try it
Ready-made, maintained by usRecords, 13 fieldsv1.0

Data from transport.opendata.ch

Get this data

Try it here with a few records, download the sample, fill a Google Sheet, or call it from your own code.

Try it

From
Departure station or place, such as Zurich or Bern Bahnhof.
Example: Zurich
To
Arrival station or place.
Example: Bern
Dateoptional
Travel day as YYYY-MM-DD. Today when left empty.
Example: 2026-12-07
Timeoptional
Earliest departure time as HH:MM, Swiss local time. Now when left empty.
Example: 08:00

Run it on this page, or call it from your code with the endpoint in the developer section. A free key covers 10,000 records of this API, no card. Create a free key

For developers: the API and MCPThe endpoint, code in curl, JavaScript and Python, every input, and files for your tools
Endpoint
POSThttps://pullrow.dev/v1/apis/swiss-public-transport/run
  • Small runs answer in the same request; longer ones answer 202 with a run to poll.
  • fields returns only the fields you name. The examples send the ones picked on this page.
  • Idempotency-Key is optional. A retry with it is never charged twice.
  • You pay for records returned. Zero records cost zero.

Every run option, explained

Calling it needs a key
10,000 free records of this API to start. No card.
curl
curl -X POST "https://pullrow.dev/v1/apis/swiss-public-transport/run" \
  -H "Authorization: Bearer $PULLROW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"from":"Zurich","to":"Bern"},"max_items":50}'

Inputs

Send them as input in the request body. Leave one out to use its default.

fromtextrequired
Departure station or place, such as Zurich or Bern Bahnhof.
example: Zurich
totextrequired
Arrival station or place.
example: Bern
datetext
Travel day as YYYY-MM-DD. Today when left empty.
example: 2026-12-07
timetext
Earliest departure time as HH:MM, Swiss local time. Now when left empty.
example: 08:00

What's in each record

13 fields: 12 here, 1 technical one under Technical details.

Basics

  • From station

    Name of the departure station.

    Example Zürich HB

  • To station

    Name of the arrival station.

    Example Bern

  • Minimum duration

    Total travel time in minutes.

    Example 78

  • Transfers

    Number of changes.

    Example 2

  • Products

    Trains and lines used, such as IC 61 or S23.

    Example IR 37, S23

  • Departure platform

    Example 14

  • Minimum delay

    Current departure delay in minutes.

    Example 0

  • Capacity 1st

    Expected crowding in first class, 1 low to 3 high.

    Example 1

  • Capacity 2nd

    Expected crowding in second class, 1 low to 3 high.

    Example 1

  • Sections

    One text per leg: line, from and to stations and times (Swiss local time), or Walk.

    Example IR 37: Zürich HB 05:08 -> Aarau 05:35, S 23: Aarau 05:40 -> Olten 05:53

Dates

  • Departure at

    Departure time (UTC).

    Example Dec 6, 2026

  • Arrival at

    Arrival time (UTC).

    Example Dec 6, 2026

Technical detailsField names and types for developers, and the 1 field hidden above

Hidden by default

This field comes with each record too. It is an internal code, a note about how the record was read or a copy of what was searched for, so the lists above leave it out.

  • ID idMade from the two station ids and the departure time; unique for a connection.

Field names and types

The names your code reads in each record. "Filled" counts how many of the 3 sample records carry the field.

Field nameTypeShown on this page asFilled
idtextID (hidden)3 of 3
from_stationtextFrom station3 of 3
to_stationtextTo station3 of 3
departure_atdate and timeDeparture at3 of 3
arrival_atdate and timeArrival at3 of 3
duration_minnumberMinimum duration3 of 3
transfersnumberTransfers3 of 3
productslistProducts3 of 3
platformtextDeparture platform3 of 3
delay_minnumberMinimum delay3 of 3
capacity_1stnumberCapacity 1st3 of 3
capacity_2ndnumberCapacity 2nd3 of 3
sectionslistSections3 of 3

How it reads the site

Runs on a reader we built and maintain by hand for this site.

Sample records

Sample records
RecordFrom stationTo stationMinimum durationTransfersProductsDeparture platformMinimum delayCapacity 1stCapacity 2ndSectionsDeparture atArrival at
1Zürich HBBern782IR 37, S23, IC 6114011IR 37: Zürich HB 05:08 -> Aarau 05:35, S 23: Aarau 05:40 -> Olten 05:53, IC 61: Olten 05:58 -> Bern 06:26Dec 6, 2026Dec 6, 2026
2Zürich HBBern690IC 113011IC 1: Zürich HB 05:19 -> Bern 06:28Dec 6, 2026Dec 6, 2026
3Zürich HBBern560IC 88011IC 8: Zürich HB 06:02 -> Bern 06:58Dec 6, 2026Dec 6, 2026

Sample records from the example output this API publishes. Email addresses and phone numbers in them are masked. Hover over a column name to see the field name your code reads.

Reliability

Counted from real runs. Our own health checks are left out. A run succeeded when it finished and the site neither blocked it nor broke it.

Incidents and repairs

How it is kept working What a repair can't do

A ready-made API, maintained by us. It is not part of the daily check or the automatic rebuild yet.

  • You pay only for records returned. A run that returns none costs nothing.
Known limits
  • One run returns at most 16 connections for one origin and destination pair; the source gives no more than that per request. Run again with a later time for further connections.
  • Station names are matched by the source, so Zurich finds Zürich HB; use a full station name when a place has several stops.
  • delay_min, platform at the arrival end and the crowding levels (capacity_1st, capacity_2nd; 1 low, 2 medium, 3 high) are filled only when the railway publishes them, so they are often empty for connections more than a few hours ahead.
  • Timetable data covers the current timetable year and a limited window ahead; dates far in the future return nothing.
  • Times are given as ISO 8601 in UTC, converted from Swiss local time.
  • Free community service over Swiss open transport data with fair-use limits (about 1,000 requests a day per address); there is no key. Not affiliated with SBB or the operators.

Version history

A run uses the live version unless the request names another one with version.