# Train & Bus Fares: FlixBus, Trenitalia, RegioJet & More (`zaiq/train-bus-fares`) Actor

Journey times, operators, durations, changes, available fares and booking links from FlixBus, Trenitalia, RegioJet and Swiss Transport API. Compare trains and buses by route and date in one call. One schema, time-zone-aware times and a free comparison per trip.

- **URL**: https://apify.com/zaiq/train-bus-fares.md
- **Developed by:** [Zaiq](https://apify.com/zaiq) (community)
- **Categories:** Travel
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 1,000 journeys

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Train & Bus Fares: FlixBus, Trenitalia, RegioJet & More

Get journey times, operators, durations, changes, available fares and booking links from FlixBus, Trenitalia, RegioJet and Swiss Transport API. Give it routes and travel dates; get the same fields for every train, bus or coach journey, plus a free comparison for each trip.

FlixBus and RegioJet cover intercity coach routes and rail inventory where available. Trenitalia returns Italian rail fares and some international timetable solutions. Swiss Transport API is an independent public Swiss timetable service: its rows have no fares or seat counts. A source can answer one route and have no coverage for another.

The Actor reads public, signed-out HTTP data only. It does not book a ticket. Tested in Apify's cloud: all four sources answered (Berlin > Prague, Rome > Naples, Zurich > Bern), with fares from FlixBus, RegioJet and Trenitalia.

Use recordType=journey for paid results and recordType=comparison for free summaries. A summary reports per-source counts, cheapest fares by currency, the fastest delivered journey, cheapest per mode and reasons for missing sources. Comparisons cover the limited results delivered, not every possible departure that day.

### What you get

| Field | What it holds |
|---|---|
| source / operator | Source key and the operating carrier where identifiable; unknown carriers stay null. |
| mode / modes | train, bus or coach. Coach is an intercity bus. modes lists all modes in a mixed journey; mode favours train when rail is present. |
| from / to | The actual departure and arrival stations returned by the source, which can differ across city-level searches. |
| departAt / arriveAt | ISO 8601 timestamps including UTC offset, using the requested local departure date. |
| durationMinutes / changes | Elapsed minutes and transfers when the source exposes them. Hidden transfers are null, not guessed. |
| price / currency / adults | Party total for the requested adults, in the source currency. Null when there is no public fare. |
| fareClass | Fare name and class when supplied, for example Economy / 2ª Classe Easy. RegioJet search does not label the minimum fare class. |
| seatsLeft / seatsLeftBasis | Seat count where supplied: at-fare or whole-journey. Unlimited/sentinel or absent counts stay null. |
| bookingUrl | Public planner/search or source-supplied booking link. It may require re-entering or checking trip details. |
| tripRequest / rank / scrapedAt | Original normalized route/date, source departure-order rank and UTC collection time. |
| priceBasis / priceNote | Party-total basis, included fees, fixed currency and timetable-only explanations. |
| cheapest / cheapestByCurrency | Free comparison: cheapest overall only with one quoted currency; separate minima for every currency otherwise. |
| bySource / fastest / cheapestPerMode / failedSources | Free comparison: counts, priced counts, source status, fastest journey, mode minima and missing-source reasons. |

### What people use it for

- **Travel search tools:** Show train and coach options from several public planners behind one input and one row schema.
- **Trip-planning agents:** Ask for a route and date, then use the free comparison to identify cheaper or faster delivered options.
- **Fare monitoring:** Run the same route and date on a schedule and compare snapshots in your own storage. Prices and availability can change.
- **Transport research:** Compare travel times, transfers and fares for a set of routes, keeping timetable-only and priced rows distinguishable.

### How to use it

1. Enter trips as objects with from, to and date, or strings such as Prague > Vienna. Omit date to use tomorrow in Europe/Berlin.
2. Choose any of the four sources, the number of adults and the maximum journeys per source and trip. Default: all sources, one adult, five journeys.
3. Select a preferred currency. It applies where supported; each returned row states its actual currency.
4. Run the Actor. Filter recordType=journey for results or recordType=comparison for free comparisons. Check bySource for coverage and failures.
5. Open a booking link and recheck the actual stations, date, passengers, fare conditions and availability before purchasing.

### Input

| Field | Example | Notes |
|---|---|---|
| trips | \[{"from":"Prague","to":"Vienna","date":"2026-11-19"}] | 1–20 unique trips; also accepts strings such as Prague > Vienna. |
| sources | \["flixbus","regiojet","trenitalia","swiss"] | Default all. Each source is attempted independently. |
| date | "2026-11-19" | Optional default for strings or undated objects. Omit for tomorrow in Europe/Berlin. Per-trip date takes precedence. |
| adults | 1 | 1–5 full-fare adults; no children, discount cards or concessions. |
| maxJourneysPerSource | 5 | 1–100 per source and trip, in departure order. Not a full-day minimum-fare guarantee. |
| currency | "EUR" | FlixBus: selected currency. RegioJet: EUR/CZK, otherwise EUR. Trenitalia: EUR. Swiss: null. |

### Output

Each result is one row in the run's dataset (download it as JSON, CSV, Excel, XML or HTML, or read it through the API). An example row (values shortened):

```json
{
  "recordType": "journey",
  "resultId": "66bde293fdeed043805a74b662f91884d422304e40aab191742d6d6b0716912c",
  "source": "trenitalia",
  "operator": null,
  "mode": "train",
  "modes": [
    "train"
  ],
  "from": "Roma Termini",
  "to": "Napoli Centrale",
  "departAt": "2026-11-19T05:00:00+01:00",
  "arriveAt": "2026-11-19T08:07:00+01:00",
  "durationMinutes": 187.0,
  "changes": 1,
  "price": 14.05,
  "currency": "EUR",
  "fareClass": "Ordinaria / 2ª Classe",
  "seatsLeft": null,
  "seatsLeftBasis": null,
  "bookingUrl": "https://www.lefrecce.it/Channels.Website.WEB/?referrer=www.trenitalia.com&lang=en&departureStation=Roma+%28+Tutte+Le+Stazioni+%29&arrivalStation=Napoli+%28+Tutte+Le+Stazioni+%29&departureDate=2026-11-19&adults=1",
  "tripRequest": {
    "from": "Rome",
    "to": "Naples",
    "date": "2026-11-19"
  },
  "adults": 1,
  "rank": 1,
  "scrapedAt": "2026-11-12T15:46:32Z",
  "priceBasis": "party-total",
  "priceNote": "Public selected party fare in EUR; ancillary purchases excluded.",
  "journeysCompared": null,
  "pricedJourneys": null,
  "bySource": null,
  "cheapest": null,
  "cheapestByCurrency": null,
  "fastest": null,
  "cheapestPerMode": null,
  "failedSources": null,
  "partial": null,
  "comparisonNote": null
}
```

The example is an unchanged real result from 12 November 2026. All journey and comparison rows share one nullable schema. Here is a real free comparison from the default local test, shortened to the main fields:

```json
{
  "recordType": "comparison",
  "tripRequest": {
    "from": "Prague",
    "to": "Vienna",
    "date": "2026-11-19"
  },
  "journeysCompared": 10,
  "pricedJourneys": 10,
  "partial": true,
  "failedSources": [
    {
      "source": "swiss",
      "status": "not-found",
      "reason": "no matching Swiss timetable station for 'Prague'; fuzzy suggestions are rejected"
    }
  ],
  "bySource": [
    {
      "source": "flixbus",
      "count": 5,
      "pricedCount": 5,
      "status": "ok",
      "reason": null
    },
    {
      "source": "regiojet",
      "count": 5,
      "pricedCount": 5,
      "status": "ok",
      "reason": null
    },
    {
      "source": "trenitalia",
      "count": 0,
      "pricedCount": 0,
      "status": "empty",
      "reason": null
    },
    {
      "source": "swiss",
      "count": 0,
      "pricedCount": 0,
      "status": "not-found",
      "reason": "no matching Swiss timetable station for 'Prague'; fuzzy suggestions are rejected"
    }
  ],
  "cheapest": {
    "source": "regiojet",
    "mode": "coach",
    "departAt": "2026-11-19T07:00:00+01:00",
    "durationMinutes": 280.0,
    "price": 15.9,
    "currency": "EUR"
  },
  "fastest": {
    "source": "flixbus",
    "mode": "coach",
    "departAt": "2026-11-19T02:20:00+01:00",
    "durationMinutes": 240.0,
    "price": 17.48,
    "currency": "EUR"
  },
  "cheapestPerMode": [
    {
      "mode": "train",
      "currency": "EUR",
      "price": 16.9,
      "source": "regiojet"
    },
    {
      "mode": "coach",
      "currency": "EUR",
      "price": 15.9,
      "source": "regiojet"
    }
  ]
}
```

`SUMMARY` in the key-value store contains source outcomes, runtime, traffic and charged event counts. `COMPARISONS` contains only the free comparison records. Some sources legitimately have no coverage for a route; those reasons remain visible even when other sources succeed.

### Pricing

- **$0.002 per delivered journey ($2 per 1,000)**; $0.0018 on Silver and $0.0016 on Gold and higher plans, plus Apify's $0.00005 start.
- A delivered timetable-only journey is also a paid journey. Comparison records, missing sources, failed calls, retries and rejected results are free.
- Searches with no journeys, failed sources and comparisons are free.

What typical jobs cost at the list price:

| Job | Cost |
|---|---|
| Measured default: 10 journeys + 1 comparison | $0.020 |
| Measured all-source test: 21 journeys + 3 comparisons | $0.042 |
| 20 routes × 4 sources × at most 5 journeys | At most 400 journeys: $0.80 |
| 1,000 delivered journeys + free comparisons | $2.00 |

Set Maximum cost per run in Apify. The Actor checks whether one whole journey event fits before delivering it, and still writes free comparisons after stopping. A local $0.006 cap delivered exactly three journeys; a $0.001 cap made no source requests. Comparison.partial flags spending stops and missing coverage.

### Tips

- Use city names for FlixBus and RegioJet. City searches can include several stations or airports; compare the actual from and to fields.
- For Trenitalia, use Italian cities or station names. English city aliases Rome, Naples, Milan, Florence, Venice, Turin and Genoa are recognized.
- Use Swiss station names such as Zurich or Bern. Unrelated fuzzy suggestions are rejected rather than substituted.
- If currencies differ, use cheapestByCurrency. The Actor never compares the numeric amounts of EUR, GBP and CZK as if they were equivalent.
- Increase maxJourneysPerSource to see more departures. The first five departures may include overnight connections and need not contain the cheapest fare all day.
- For recurring alerts, retain tripRequest, source, timestamps and resultId in your own database. This build returns snapshots and does not send notifications.

### Use it through the API

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("zaiq/train-bus-fares").call(run_input={"trips": ["Prague > Vienna"], "sources": ["flixbus", "regiojet", "trenitalia", "swiss"], "maxJourneysPerSource": 5, "currency": "EUR", "adults": 1})
for row in client.dataset(run.default_dataset_id).iterate_items():
    print(row)
```

**JavaScript**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('zaiq/train-bus-fares').call({"trips": ["Prague > Vienna"], "sources": ["flixbus", "regiojet", "trenitalia", "swiss"], "maxJourneysPerSource": 5, "currency": "EUR", "adults": 1});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**HTTP (one call, results back)**

```bash
curl -X POST 'https://api.apify.com/v2/acts/zaiq~train-bus-fares/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"trips": ["Prague > Vienna"], "sources": ["flixbus", "regiojet", "trenitalia", "swiss"], "maxJourneysPerSource": 5, "currency": "EUR", "adults": 1}'
```

### Integrations and schedules

- **Schedules:** run it every hour, day or week from the Apify Console (Schedules) and keep a history of results.
- **Make, Zapier, n8n, Google Sheets, Slack, Airtable:** connect it through Apify's integrations, or send each finished run to a **webhook**.
- **Datasets:** results stay in the run's dataset; export them or read them by API whenever you need them.

### Use it with AI agents (MCP)

Add Apify's MCP server with this Actor already pinned (`https://mcp.apify.com?tools=zaiq/train-bus-fares`) to Claude, ChatGPT, Cursor, VS Code or any MCP client. The agent can find this Actor and run it for you: ask it for "Compare trains and coaches from Prague to Vienna next Thursday. Show the cheapest delivered fare per mode, the fastest journey and any missing sources.". AI agents can also pay for runs directly through Apify's agentic payments.

### Limits

- Local direct tests passed, but Apify cloud transport, runtime and operating cost remain unverified. This is an unpublished build.
- Working sources are FlixBus, RegioJet, Trenitalia and Swiss Transport API. Trainline, Omio, Rome2rio, BlaBlaCar Bus, Deutsche Bahn, SNCF Connect, Renfe and Eurostar are not included in this version.
- Only public, signed-out responses are read. A login stops the source. Refused addresses are retired through the shared transport pool; persistent refusal is reported, and other sources continue. No check is solved.
- Swiss Transport API is an independent national timetable service, not SBB fare access. Its prices, currencies and seat counts are null. Some international Trenitalia solutions also lack fares.
- FlixBus prices include the platform fee when the API supplies that total. RegioJet uses priceFrom for the requested full-fare party; account-credit prices are excluded. Trenitalia uses the selected public party fare. Ancillary purchases and later checkout changes may differ.
- Unknown carriers, transfer counts, fare classes and seat counts remain null. In particular, FlixBus third-party train inventory can omit operating-carrier and transfer details.
- Booking links open public planners or source booking pages. The build verifies returned data, not the full interactive checkout or ticket issuance.
- Coverage, advance-booking windows and fare availability depend on the source. An empty result does not prove that no journey exists on another service.

### FAQ

**Does every row have a price?**

No. Swiss timetables and some international Trenitalia results have null price and currency. Delivered journeys are charged, including timetable-only rows.

**Are prices per person?**

They are party totals for passengers.adults. RegioJet receives one REGULAR tariff per adult; FlixBus and Trenitalia receive the adult count directly.

**Can it use Trainline or Omio?**

Not in this build. Their tested public data calls refused this Mac, so they are not advertised as working sources. No login session or paid API is used.

**Why can cheapest be null?**

There may be no priced rows, or prices may use multiple currencies. cheapestByCurrency holds each currency separately.

**Why is a source missing?**

It may not recognize a place, have no route/date coverage, return a check or error, or be stopped by the spending cap. bySource and failedSources explain the outcome.

**Does a city name mean the same station on every source?**

No. The row shows the actual stations. FlixBus and RegioJet city searches can include several stops; inspect from and to before comparing.

**Does it find the cheapest train or bus all day?**

The comparison covers only delivered rows, capped in departure order per source. Increase the limit to examine more departures.

**Does it book or pay?**

No. It reads public journey information and returns links. Recheck all details on the source website before paying.

### Related Actors from Zaiq

- [google-flights-scraper](https://apify.com/zaiq/google-flights-scraper): compare air alternatives for a route and date

### Support

Questions, a site that changed, or a field you need? Open an issue on this Actor's **Issues** tab: we answer there, usually within a day.

***

Also found as: train and bus fares, FlixBus fare API, Trenitalia train prices, RegioJet prices, Swiss train timetable, train bus price comparison, coach journey scraper, public transport journeys API.

# Actor input Schema

## `trips` (type: `array`):

1-20 trips, one per line: from > to, or from > to > YYYY-MM-DD for a date (otherwise the Date field below, or tomorrow). Use city or station names.

## `sources` (type: `array`):

Default: all four working public sources. FlixBus and RegioJet use city names; Trenitalia accepts Italian cities/stations. Swiss Transport API supplies national timetables, with null fares.

## `date` (type: `string`):

YYYY-MM-DD for trips without their own date. Omit to use tomorrow in Europe/Berlin. Each trip object's date overrides this field.

## `adults` (type: `integer`):

1-5 adults aged 26-64 without discount cards. Prices are the party total, not per person. Children, loyalty fares and concessions are not supported.

## `maxJourneysPerSource` (type: `integer`):

1–100 journeys per source and trip, in departure order. Comparisons cover only delivered rows; this is not a guaranteed whole-day cheapest-fare search.

## `currency` (type: `string`):

FlixBus uses this currency. RegioJet supports EUR and CZK here, otherwise EUR. Trenitalia uses EUR. Swiss timetables have no currency. Comparisons group different currencies without conversion.

## Actor input object example

```json
{
  "trips": [
    "Prague > Vienna",
    "Milan > Rome",
    "Zurich > Bern"
  ],
  "sources": [
    "flixbus",
    "regiojet",
    "trenitalia",
    "swiss"
  ],
  "adults": 1,
  "maxJourneysPerSource": 5,
  "currency": "EUR"
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset: the results.

## `summary` (type: `string`):

What each input returned, and notes.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "trips": [
        "Prague > Vienna",
        "Milan > Rome",
        "Zurich > Bern"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zaiq/train-bus-fares").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "trips": [
        "Prague > Vienna",
        "Milan > Rome",
        "Zurich > Bern",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("zaiq/train-bus-fares").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "trips": [
    "Prague > Vienna",
    "Milan > Rome",
    "Zurich > Bern"
  ]
}' |
apify call zaiq/train-bus-fares --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zaiq/train-bus-fares"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bhyfUkiehVZACEcFx/builds/u7egRaaWe6WOMH0Zy/openapi.json
