# FlixBus Connections Scraper (`bovi/flixbus-scraper`) Actor

Scrape FlixBus bus connections between two cities: departure and arrival times, duration, transfers, per-leg operators, prices in your currency, seats left and bike policy. No login needed.

- **URL**: https://apify.com/bovi/flixbus-scraper.md
- **Developed by:** [Vitalii Bondarev](https://apify.com/bovi) (community)
- **Categories:** Travel, Automation
- **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 flixbus connections scrapers

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## FlixBus Connections Scraper

For trip planning and fare checks, extract public FlixBus bus connections between two cities, with no login or API key. You get stations, times, duration, transfers, a leg-by-leg breakdown, fares, seats left, and whether bikes can be booked, ready to export.

- Compare fares and journey times when you are choosing a bus between two cities.
- Check seats still available and whether a bike can be booked before you travel.
- Review each leg's operator, brand, bus or train mode, and amenities such as WIFI and power sockets.
- Resolve both city names with FlixBus autocomplete and return connections in departure order.
- Run it with your Apify account only; no FlixBus login or API key is required.

### What you get

You enter city names. The Actor calls the FlixBus public JSON API for city autocomplete and city-to-city search, then saves one dataset item per connection. On each item, `from` and `to` are stations; `fromCity` and `toCity` are cities. `changesCount` is the number of legs minus one (0 when the trip is direct). `currency` is the currency you requested, and `price` is the total for the adult count you set.

| Field group | Fields | Detail |
| --- | --- | --- |
| Identity | `id`, `provider`, `status`, `transferType` | Connection id from FlixBus, provider key, availability status (for example `available`), and transfer label (for example Direct, Regional, or Transfer). |
| Route and time | `from`, `to`, `fromCity`, `toCity`, `departure`, `arrival`, `timeLengthMinutes`, `changesCount` | Station and city names, ISO 8601 departure and arrival with the local offset, total minutes, and how many transfers the trip has. |
| Fares and seats | `price`, `priceWithPlatformFee`, `currency`, `seatsAvailable`, `bikesAllowed` | Total for the passengers you set, that total including the FlixBus platform fee, the currency you asked for, seats left, and whether bikes can be booked. |
| Legs | `rideId`, `from`, `to`, `fromCity`, `toCity`, `departure`, `arrival`, `meansOfTransport`, `operator`, `brand`, `amenities` | One object per leg, in travel order. `meansOfTransport` is bus or train. `amenities` is a list of strings, such as `WIFI` and `POWER_SOCKETS`. |

### Sample output

One connection returned for Prague to Berlin:

```json
{
  "id": "direct:7b476459-0eb4-4722-8ea4-730c3ecc2e48:9b6adf5b-3ecb-11ea-8017-02437075395e:dcbaaee6-9603-11e6-9066-549f350fcb0c",
  "from": "Prague (Main Station)",
  "to": "Berlin central bus station",
  "fromCity": "Prague",
  "toCity": "Berlin",
  "departure": "2026-11-15T04:00:00+01:00",
  "arrival": "2026-11-15T09:05:00+01:00",
  "timeLengthMinutes": 305,
  "changesCount": 0,
  "transferType": "Direct",
  "status": "available",
  "provider": "flixbus",
  "legs": [{"rideId": "7b476459-0eb4-4722-8ea4-730c3ecc2e48", "from": "Prague (Main Station)", "to": "Berlin central bus station", "fromCity": "Prague", "toCity": "Berlin", "departure": "2026-11-15T04:00:00+01:00", "arrival": "2026-11-15T09:05:00+01:00", "meansOfTransport": "bus", "operator": "FlixBus CZ s.r.o.", "brand": "FlixBus", "amenities": ["WIFI", "POWER_SOCKETS"]}],
  "price": 27.49,
  "priceWithPlatformFee": 28.48,
  "currency": "EUR",
  "seatsAvailable": 26,
  "bikesAllowed": true
}
```

### Pricing

Billing is pay per event. Every dollar amount below is the Free-plan price.

| Event | When it is charged | Price on Free |
| --- | --- | --- |
| Actor Start (`apify-actor-start`) | When the run starts. Events depend on memory: one per GB, minimum one. Default memory is 512 MB, so one event. | $0.00005 on the Free plan |
| FlixBus Connections Scraper (`apify-default-dataset-item`) | Once for each connection delivered to the dataset. | $0.0016 on the Free plan |

On the Free plan, 1,000 Actor Start events cost $0.05 and 10,000 Actor Start events cost $0.50; 1,000 dataset-item events cost $1.60 and 10,000 dataset-item events cost $16.00. On the Free plan, one Actor Start at the default 512 MB plus 1,000 dataset-item events totals $1.60005; this is a price calculation, not a promise of Free-plan run capacity.

The Apify Free plan includes $5 of monthly platform credit. For the Free plan, the exact credit arithmetic for one Actor Start at the default 512 MB and 3,124 dataset-item charges is 3,124 × $0.0016 = $4.9984, plus $0.00005 = $4.99845; this is a credit calculation, not a promise that a Free-plan run can return 3,124 connections.

If the run reaches your charge limit, it stops. Connections already delivered stay in the dataset. A run that delivers no connections adds no dataset-item charges.

Platform usage — compute, Apify Proxy traffic including residential proxy, and storage — is included in these event prices and is paid by the Actor developer. Pay per event + usage is off, so those platform costs are not billed to you on top.

### How to use

1. Sign in to Apify and open FlixBus Connections Scraper.
2. Enter the departure city in `from` and the destination city in `to`.
3. Set the first departure date, adult count, currency, locale, direct-only switch, and maximum number of connections.
4. Leave the residential proxy on for reliable access, unless you set `useApifyProxy` to false and do not pass proxy URLs.
5. Start the run. Cities are resolved, the first day is searched, later days are scanned until enough connections are stored, and rows are ordered by departure.
6. Repeat the run with Apify Schedules. Daily is a practical starting point for fares and seats; treat that as a starting point only.

```json
{
  "from": "Prague",
  "to": "Berlin",
  "date": "2026-11-23",
  "adults": 1,
  "currency": "EUR",
  "onlyDirectConnections": true,
  "maxResults": 20
}
```

Export the dataset as JSON or CSV, or read it through the Apify dataset API.

### Input parameters

`from` and `to` are required. Other fields are optional. City matching prefers an exact case-insensitive name and otherwise uses the top FlixBus autocomplete hit.

| Parameter | What it does | Default |
| --- | --- | --- |
| `from` | Required departure city. Sent to FlixBus city autocomplete, then used as the origin city id. | Prague |
| `to` | Required destination city, resolved the same way. | Berlin |
| `date` | First search day, `YYYY-MM-DD`. An empty, invalid, or past value starts today. | today |
| `adults` | Adult count sent with the search so FlixBus can price the trip. Values are kept between 1 and 9. | 1 |
| `currency` | ISO currency passed to search and stored on each row. Accepted values: EUR, USD, GBP, CZK, PLN, CHF, DKK, SEK, NOK, HUF. | EUR |
| `locale` | Locale sent to search. The language before the underscore is used for autocomplete, which sets city and station language. Example: `en_US` or `de_DE`. | en_US |
| `onlyDirectConnections` | When true, connections with `changesCount` greater than 0 are not saved. | false |
| `maxResults` | Stop after this many saved connections. The form accepts 1 to 1000. Days after the start date are searched until this count or 30 days. | 50 |
| `proxyConfiguration` | Proxy built before the first request. An explicit `useApifyProxy: false` with no `proxyUrls` runs with no proxy. | Apify residential |

### Limits and edge cases

| Condition | What you see | What to do |
| --- | --- | --- |
| Free plan still needs more days | On the Free plan, only 1 departure day is requested. Status text is a Free-plan preview that names `result pages`, and the key-value `OUTPUT` record describes the cap. | Use a paid Apify plan to scan following days, up to `maxResults` or 30 days. |
| First day already fills `maxResults` | Those connections only, with status `Collected N records.` No preview record is written when the day cap never cuts the run. | Raise `maxResults` if you wanted later days. |
| City not resolved | Status `City not found on FlixBus:` plus the name. No dataset rows. | Use a name the FlixBus autocomplete returns, and check spelling. |
| Name is not an exact city match | Rows are for the top autocomplete hit, visible in `fromCity` and `toCity`. | Pass the exact FlixBus city name. |
| Past, empty, or invalid `date` | Search starts today. Past dates are not queried. | Pass today or a future `YYYY-MM-DD` date. |
| Direct-only filter | Trips with one or more transfers are skipped. The dataset can be empty even when connecting trips exist. | Set `onlyDirectConnections` to false. |
| Trip missing departure or arrival | That trip is not saved. | Nothing to send back; only trips with both timestamps are kept. |
| Same connection on two days | After-midnight rides can appear on two consecutive days. Each connection `id` is saved once. | Expect one row per id. |
| 30 search days | The walk stops at 30 days even if `maxResults` is still short. Status reports how many rows were collected. | Narrow the city pair or accept the partial set. |
| Charge limit reached | The log says the charge limit was reached and how many rows were kept. Rows already saved stay. | Raise the run charge limit and run again for more. |
| Request fails after retries | Up to 6 attempts, each with a 40 second timeout, then waits of 1, 2, 4, 8, and 16 seconds. The last error fails the run. Earlier days' rows remain. | Run again and keep the default residential proxy. |

> **Note:** A Free-plan cap never adds placeholder rows. When it stops the run, `OUTPUT` holds `free_plan_preview`, `items_returned`, `items_requested`, `limits_applied`, `upgrade_url`, and `message`.

### FAQ

#### How much does it cost to scrape FlixBus?

On the Free plan, each delivered connection is $0.0016 and Actor Start is $0.00005 (one event at the default 512 MB). The price calculation for 1,000 dataset-item events is $1.60 on the Free plan, or $1.60005 on the Free plan with that Actor Start. The Apify Free plan includes $5 of monthly platform credit; its exact credit arithmetic reaches 3,124 dataset-item charges plus one Actor Start at that default memory, but this is not a promise that a Free-plan run can return 3,124 connections. Residential proxy traffic and other platform usage are included in the event prices and are not billed to you on top.

#### Why did the run return no connections?

The status message is the first check. `City not found on FlixBus:` means autocomplete did not resolve that name. A direct-only run drops every trip that has a transfer, so the dataset can be empty while connections with changes exist. Trips with no departure or arrival timestamp are dropped. Turn direct-only off, use an exact city name, or start from a date FlixBus still sells.

#### What if the run fails or stops early?

A failed request is retried up to 6 times with a 40 second timeout and the waits listed above. If every attempt fails, the run errors and connections already saved from earlier days stay in the dataset. A charge limit stops further saves and leaves a log line with the row count. On the Free plan, a second search day is not requested; the status message and `OUTPUT` record say when that cap applied. Keep the default residential proxy and run again after you change the input or the charge limit.

#### Is it legal to collect this FlixBus data?

The Actor reads public FlixBus data from the FlixBus public JSON API (city autocomplete and connection search). Whether that use is allowed depends on FlixBus terms and the law that applies to your use case. This page does not guarantee that your use is lawful.

### Usage statistics

This Actor creates a small, content-free summary at the end of each run, used only to monitor reliability and improve this Actor. No input values, credentials or scraped data are sent.

A copy of the exact record for your run is saved as `USAGE_STATS` in your own Apify key-value store.

To opt out, set `disableUsageStats` to `true` in the input. Nothing is sent then.

[Full list of collected fields](https://api.apify.com/v2/key-value-stores/v9rgHjMKLDGtHf8tD/records/index.html)

# Actor input Schema

## `from` (type: `string`):

Departure city name, for example Prague, Berlin or London. Resolved against the FlixBus city autocomplete.

## `to` (type: `string`):

Destination city name. Resolved against the FlixBus city autocomplete.

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

First departure date in ISO format YYYY-MM-DD. Leave empty to start today. Past dates are moved to today.

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

Number of adult passengers, used by FlixBus to compute the price.

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

ISO 4217 currency code used to price the connections.

## `locale` (type: `string`):

Locale passed to FlixBus, for example en_US or de_DE. It sets the language of city and station names.

## `onlyDirectConnections` (type: `boolean`):

If enabled, only single-leg connections without transfers are returned.

## `maxResults` (type: `integer`):

Maximum number of connections to collect. The actor scans following days until it has this many.

## `proxyConfiguration` (type: `object`):

Proxy settings. A residential proxy is used by default for reliable access.

## Actor input object example

```json
{
  "from": "Prague",
  "to": "Berlin",
  "adults": 1,
  "currency": "EUR",
  "locale": "en_US",
  "onlyDirectConnections": false,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset with the collected records.

# 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 = {
    "from": "Prague",
    "to": "Berlin",
    "adults": 1,
    "currency": "EUR",
    "locale": "en_US",
    "maxResults": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/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 = {
    "from": "Prague",
    "to": "Berlin",
    "adults": 1,
    "currency": "EUR",
    "locale": "en_US",
    "maxResults": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/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 '{
  "from": "Prague",
  "to": "Berlin",
  "adults": 1,
  "currency": "EUR",
  "locale": "en_US",
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bovi/flixbus-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bovi/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/W5OhCo1i73romnoan/builds/5dk85TS8cFAtT16s2/openapi.json
