# FlixBus Scraper (`crawlerbros/flixbus-scraper`) Actor

Scrape FlixBus - Europe and North America's largest intercity bus network. Search bus and train journeys by route and date, look up cities and stations, and fetch popular routes. Get departure/arrival times, duration, transfers, prices, operators, and amenities.

- **URL**: https://apify.com/crawlerbros/flixbus-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Travel, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## FlixBus Scraper

Scrape **FlixBus** — Europe and North America's largest intercity bus network (also covering FlixTrain rail services). Search bus and train journeys by route and date, look up stations, and fetch popular routes per country. HTTP-only via the public `global.api.flixbus.com` JSON API. No auth required; optional proxy engaged automatically only if FlixBus blocks direct requests.

### What this actor does

- **Three modes:** `search` (bus & train journeys), `stationLookup`, `popularRoutes`
- **Route search:** origin → destination → date with up to 4 passengers
- **Filters:** depart-after / arrive-by times, max price, max transfers, service type (bus/train)
- **Currencies:** 14 ISO 4217 currencies (`EUR`, `USD`, `GBP`, …)
- **Countries:** 19 countries with popular-route homepages
- **Empty fields are omitted**

### Data Source

FlixBus (flixbus.com) — Europe and North America's largest intercity bus network (also covering FlixTrain rail services). The actor reads the public JSON API behind the website (`global.api.flixbus.com` — the same endpoints the website's search uses), including the journey-search API (`/search/service/v4/search`) and the station autocomplete. HTTP-only, no login or API key required; the optional proxy is engaged automatically only if FlixBus blocks direct requests.

### Output per journey (mode = `search`)

- `journeyId`, `status` — FlixBus journey identifier and availability
- `provider` — journey provider key (e.g. `flixbus`)
- `origin`, `destination` — resolved city names
- `departureCity`, `arrivalCity`, `departureStation`, `arrivalStation`
- `departureCityId`, `arrivalCityId`, `departureStationId`, `arrivalStationId`
- `departureTime`, `arrivalTime` — ISO 8601 UTC timestamps
- `durationMinutes` — total journey time
- `transfers` — number of connections (0 = direct)
- `intermediateStationsCount` — stops between origin and destination
- `legCount`, `serviceType` — `bus` / `train` / mixed
- `serviceTypes[]`, `amenities[]` — e.g. `WIFI`, `POWER_SOCKETS`, `TOILET`
- `operators[]` — operating companies (e.g. `FlixBus DACH GmbH`, `FlixTrain`)
- `rideIds[]`, `brandIds[]`, `seatTypes[]`, `cheapestSeat` — per-leg details
- `isMarketplace` — true when a partner operator sells the leg
- `bikesAllowed`, `wheelchairStatus` — accessibility flags from the API (`wheelchairStatus` is omitted when the API reports `unknown`)
- `notices[]` — informational messages attached to the journey
- `price`, `originalPrice`, `pricePerPassenger`, `totalWithPlatformFee`, `currency`
- `availableSeats`, `capacity`, `seatsLeftAtPrice`
- `sourceUrl` — booking deep-link for this route and date
- `recordType: "journey"`, `scrapedAt`

### Output per station (mode = `stationLookup`)

- `stationId`, `stationName`, `slug`, `address`, `zipcode`
- `cityId`, `cityName`, `citySlug`, `countryCode`, `countryName`
- `latitude`, `longitude`, `isTrain`, `legacyId`, `importanceOrder`, `searchQuery`
- `sourceUrl` — the autocomplete API endpoint that produced the record (stations have no public web page)
- `recordType: "station"`, `scrapedAt`

### Output per route (mode = `popularRoutes`)

- `origin`, `destination` — parsed from the country's homepage connections panel
- `routeUrl` — canonical route page URL
- `recordType: "route"`, `sourceUrl`, `scrapedAt`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `search` | `search` / `stationLookup` / `popularRoutes` |
| `originQuery` | string | `Berlin` | Departure city (mode=search) |
| `destinationQuery` | string | `Hamburg` | Arrival city (mode=search) |
| `travelDate` | string | tomorrow | `YYYY-MM-DD` departure date (mode=search) |
| `passengers` | int | `1` | Adult passengers (1–4) |
| `departAfter` | string | – | Earliest departure, `HH:MM` (mode=search) |
| `arriveBy` | string | – | Latest arrival, `HH:MM` (mode=search) |
| `maxPrice` | number | – | Price cap on journey total (mode=search) |
| `maxTransfers` | int | – | Max connections (0 = direct only, mode=search) |
| `serviceType` | string | – | `bus` / `train` (mode=search) |
| `currency` | string | `EUR` | ISO 4217 currency |
| `country` | string | `us` | Country for city resolution + popular routes |
| `stationQuery` | string | – | Station name to look up (mode=stationLookup) |
| `language` | string | `en` | Autocomplete locale (ISO 639-1) |
| `maxItems` | int | `50` | Hard cap (1–1000) |
| `proxyConfiguration` | object | Apify proxy | Optional; auto-engaged only if blocked |

#### Example: Berlin → Hamburg tomorrow, direct only, under €25

```json
{
  "mode": "search",
  "originQuery": "Berlin",
  "destinationQuery": "Hamburg",
  "passengers": 2,
  "departAfter": "08:00",
  "arriveBy": "22:00",
  "maxPrice": 25,
  "maxTransfers": 0,
  "currency": "EUR",
  "country": "de"
}
```

#### Example: US route, USD pricing

```json
{
  "mode": "search",
  "originQuery": "New York",
  "destinationQuery": "Boston",
  "travelDate": "2026-08-20",
  "currency": "USD",
  "country": "us",
  "maxItems": 20
}
```

#### Example: look up stations

```json
{
  "mode": "stationLookup",
  "stationQuery": "Berlin central",
  "country": "de",
  "maxItems": 20
}
```

#### Example: popular routes in the UK

```json
{
  "mode": "popularRoutes",
  "country": "gb",
  "maxItems": 20
}
```

### Limitations

- **No booking / fares endpoints** — FlixBus's separate booking and fares endpoints are anti-bot gated. The actor queries only the public journey-search API, which returns live prices, availability, and transfer details in the search response itself. If a route returns no journeys, the run reports it in the status message instead of falling through to a blocked endpoint.
- **Per-station-pair journeys** — a single ride bookable from multiple stations in the same city (e.g. Berlin ZOB and Berlin Alexanderplatz) produces one journey record per station pairing.
- **Search covers bookable future dates** — the API returns live schedules for upcoming dates; historical departures are not available.
- **`stationLookup` returns station-level records** — stations have no public web page, so `sourceUrl` points at the autocomplete endpoint that produced the record.

### Use cases

- **Price monitoring** — track FlixBus fares on commuter and long-haul routes
- **Travel apps** — feed journey schedules and durations into trip planners
- **Route planning** — compare direct vs. transfer journeys by price and time
- **Transit analytics** — analyze operator coverage and amenities per route
- **Competitive intelligence** — compare FlixBus/FlixTrain with other carriers

### FAQ

**What is the data source?** The public JSON API behind flixbus.com (`global.api.flixbus.com`) — the same endpoints the website's search uses. No login or API key required.

**Which routes are covered?** All FlixBus-operated routes in the EU, UK, US, Canada, and beyond — plus FlixTrain rail journeys where they appear in the same search results.

**Why do some journeys repeat?** A single ride can be bookable from multiple stations in the same city (e.g. Berlin ZOB and Berlin Alexanderplatz). Each station pairing is a distinct journey record.

**What does `transfers` mean?** `0` for direct journeys; for connecting journeys it's the number of legs minus one (e.g. a bus→train connection has 1 transfer).

**Why is the departure date optional?** It defaults to tomorrow when empty, so the actor always returns live future schedules.

**How fresh is the data?** Live — every run queries the FlixBus booking API in real time.

**Why are prices sometimes equal to original price?** `originalPrice` is the pre-discount fare; when no discount applies it equals `price`.

**What if two cities share a name?** Autocomplete resolves the top match for the selected `country`. Use `stationLookup` first if you need an exact station.

**Is this affiliated with FlixBus?** No — this is a third-party actor using FlixBus's public website API.

**Is there a dedicated fares/booking endpoint?** FlixBus's separate booking/fares endpoints are anti-bot gated. This actor does not use them — it queries the public journey-search API (`/search/service/v4/search`), which returns live prices, availability, and transfer details in the search response itself. If a route returns no journeys, the run reports it in the status message instead of falling through to a blocked endpoint.

# Actor input Schema

## `mode` (type: `string`):

What to fetch.

## `originQuery` (type: `string`):

Departure city name, e.g. `Berlin`, `New York`, `Paris`. Resolved to a FlixBus city automatically.

## `destinationQuery` (type: `string`):

Arrival city name, e.g. `Hamburg`, `Boston`, `Amsterdam`.

## `travelDate` (type: `string`):

Departure date in `YYYY-MM-DD` (e.g. `2026-08-20`). Defaults to tomorrow when empty.

## `passengers` (type: `integer`):

Number of adult passengers (1–4).

## `departAfter` (type: `string`):

Only emit journeys departing at or after this local time, `HH:MM`.

## `arriveBy` (type: `string`):

Only emit journeys arriving at or before this local time, `HH:MM`.

## `maxPrice` (type: `number`):

Only emit journeys whose total price is at or below this amount.

## `maxTransfers` (type: `integer`):

Only emit journeys with at most this many transfers (0 = direct only).

## `serviceType` (type: `string`):

Only emit journeys operated with this transport mode.

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

ISO 4217 currency code for prices.

## `country` (type: `string`):

Country used for city resolution and popular-route homepages (mode=popularRoutes).

## `stationQuery` (type: `string`):

Station name or partial name, e.g. `Berlin central`, `Port Authority`.

## `language` (type: `string`):

Language code for autocomplete labels (ISO 639-1, e.g. `en`, `de`, `fr`).

## `maxItems` (type: `integer`):

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "search",
  "originQuery": "Berlin",
  "destinationQuery": "Hamburg",
  "passengers": 1,
  "currency": "EUR",
  "country": "us",
  "language": "en",
  "maxItems": 10
}
```

# Actor output Schema

## `journeys` (type: `string`):

Dataset containing scraped FlixBus journeys, stations, and popular routes.

# 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 = {
    "mode": "search",
    "originQuery": "Berlin",
    "destinationQuery": "Hamburg",
    "travelDate": "",
    "passengers": 1,
    "departAfter": "",
    "arriveBy": "",
    "currency": "EUR",
    "country": "us",
    "language": "en",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/flixbus-scraper").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 = {
    "mode": "search",
    "originQuery": "Berlin",
    "destinationQuery": "Hamburg",
    "travelDate": "",
    "passengers": 1,
    "departAfter": "",
    "arriveBy": "",
    "currency": "EUR",
    "country": "us",
    "language": "en",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/flixbus-scraper").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 '{
  "mode": "search",
  "originQuery": "Berlin",
  "destinationQuery": "Hamburg",
  "travelDate": "",
  "passengers": 1,
  "departAfter": "",
  "arriveBy": "",
  "currency": "EUR",
  "country": "us",
  "language": "en",
  "maxItems": 10
}' |
apify call crawlerbros/flixbus-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/flixbus-scraper"
        }
    }
}

```

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/RrWNX7P83ukw87Bpt/builds/oJTvURxv5dPb9QwOP/openapi.json
