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.
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
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
- Small runs answer in the same request; longer ones answer
202with a run to poll. fieldsreturns only the fields you name. The examples send the ones picked on this page.Idempotency-Keyis optional. A retry with it is never charged twice.- You pay for records returned. Zero records cost zero.
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.
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 name | Type | Shown on this page as | Filled |
|---|---|---|---|
id | text | ID (hidden) | 3 of 3 |
from_station | text | From station | 3 of 3 |
to_station | text | To station | 3 of 3 |
departure_at | date and time | Departure at | 3 of 3 |
arrival_at | date and time | Arrival at | 3 of 3 |
duration_min | number | Minimum duration | 3 of 3 |
transfers | number | Transfers | 3 of 3 |
products | list | Products | 3 of 3 |
platform | text | Departure platform | 3 of 3 |
delay_min | number | Minimum delay | 3 of 3 |
capacity_1st | number | Capacity 1st | 3 of 3 |
capacity_2nd | number | Capacity 2nd | 3 of 3 |
sections | list | Sections | 3 of 3 |
How it reads the site
Runs on a reader we built and maintain by hand for this site.
Save as pipeline
A pipeline remembers this API, your inputs and the fields you picked. It can run on a schedule and email you the results.
Sample records
| Record | From station | To station | Minimum duration | Transfers | Products | Departure platform | Minimum delay | Capacity 1st | Capacity 2nd | Sections | Departure at | Arrival at |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Zürich HB | Bern | 78 | 2 | IR 37, S23, IC 61 | 14 | 0 | 1 | 1 | IR 37: Zürich HB 05:08 -> Aarau 05:35, S 23: Aarau 05:40 -> Olten 05:53, IC 61: Olten 05:58 -> Bern 06:26 | Dec 6, 2026 | Dec 6, 2026 |
| 2 | Zürich HB | Bern | 69 | 0 | IC 1 | 13 | 0 | 1 | 1 | IC 1: Zürich HB 05:19 -> Bern 06:28 | Dec 6, 2026 | Dec 6, 2026 |
| 3 | Zürich HB | Bern | 56 | 0 | IC 8 | 8 | 0 | 1 | 1 | IC 8: Zürich HB 06:02 -> Bern 06:58 | Dec 6, 2026 | Dec 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.
- 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.
Manage this API
Only your workspace sees this part.
Automatic repair
Off: a rebuilt version is stored and waits for you in the version history.
Delete this API
Removes the API, its versions and the saved records of its runs. Calls to its address then answer 404. Records already charged stay charged. This cannot be undone.