# Flixbus Scraper (`saswave/flixbus-scraper`) Actor

Flixbus scraper. Collect tickets data on specific trips. Get departure and return informations with prices and available seats remaining.
Collect data at scale and plan your next trips easily with flexible dates and average prices. For new feature, please create an issue

- **URL**: https://apify.com/saswave/flixbus-scraper.md
- **Developed by:** [SASWAVE](https://apify.com/saswave) (community)
- **Categories:** Automation, Travel, Social media
- **Stats:** 12 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$29.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## 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 – Bus & Train Ticket Price Extractor

Extract real-time ticket data from FlixBus routes automatically and at scale.

This actor allows you to collect live departures, return trips, prices, duration, available seats, and amenities from FlixBus journeys.

Perfect for travelers, data analysts, travel apps, and pricing intelligence use cases.

### 🎟️ Ticket Data Extraction

Retrieve structured travel results including:

Departure & return dates

City and station IDs

Trip duration

One-way and round-trip prices

Platform/service fees

Seat availability

Bus and train segments

Remaining capacity

Amenities (WiFi, power sockets)

Bike and wheelchair availability

Operator and transport type

### 📊 Pricing Intelligence

Use the scraper to:

Monitor ticket volatility

Calculate average prices

Track cheapest routes

Detect demand surges

Compare different travel dates

Automate fare monitoring

Perform route profitability analysis

### 🔁 Multi-leg Journey Support

Automatically extract:

Transfers and wait times

Mixed transport routes (bus + train)

Segment-by-segment details

Vehicle and seat types

Marketplace vs direct operators

### Ouput example

```json
{
    "uid": "ic:7f6214cd-95d7-4bbf-8283-55af226fa33a:394a5408-d778-4959-a63e-973253443ed2/425342f2-1bbc-41e9-bac3-035fea77ac6e:dcbbe1ef-9603-11e6-9066-549f350fcb0c:dcbbe1ef-9603-11e6-9066-549f350fcb0c:2cf8fab3-cc48-4f8d-97bd-77bb1f149890",
    "status": "available",
    "transfer_type": "Transfer",
    "transfer_type_key": "fast#train",
    "provider": "flixbus",
    "departure": {
      "date": "2025-05-19T20:40:00+02:00",
      "city_id": "40de8964-8646-11e6-9066-549f350fcb0c",
      "station_id": "7f6214cd-95d7-4bbf-8283-55af226fa33a"
    },
    "arrival": {
      "date": "2025-05-20T13:12:00+02:00",
      "city_id": "40d8f682-8646-11e6-9066-549f350fcb0c",
      "station_id": "394a5408-d778-4959-a63e-973253443ed2"
    },
    "duration": {
      "hours": 16,
      "minutes": 32
    },
    "price": {
      "total": 81.48,
      "original": 81.48,
      "average": 81.48,
      "total_with_platform_fee": 82.47,
      "average_with_platform_fee": 82.47
    },
    "remaining": {
      "seats_left_at_price": null,
      "seats": null,
      "bike_slots": 0,
      "capacity": "low"
    },
    "available": {
      "seats": 21,
      "bike_slots": 0
    },
    "legs": [
      {
        "departure": {
          "date": "2025-05-19T20:40:00+02:00",
          "city_id": "40de8964-8646-11e6-9066-549f350fcb0c",
          "station_id": "7f6214cd-95d7-4bbf-8283-55af226fa33a"
        },
        "arrival": {
          "date": "2025-05-20T09:45:00+02:00",
          "city_id": "40db4593-8646-11e6-9066-549f350fcb0c",
          "station_id": "dcbbe1ef-9603-11e6-9066-549f350fcb0c"
        },
        "means_of_transport": "bus",
        "amenities": [
          "WIFI",
          "POWER_SOCKETS"
        ],
        "is_marketplace": false,
        "operator_id": "flixpl",
        "brand_id": "a18f138c-68fa-4b45-a42f-adb0378e10d3",
        "vehicle_details": [],
        "seat_types": [
          {
            "seat_type_key": "SEATER",
            "seat_type": "premium-seat"
          }
        ]
      },
      {
        "departure": {
          "date": "2025-05-20T11:22:00+02:00",
          "city_id": "40db4593-8646-11e6-9066-549f350fcb0c",
          "station_id": "dcbbe1ef-9603-11e6-9066-549f350fcb0c"
        },
        "arrival": {
          "date": "2025-05-20T13:12:00+02:00",
          "city_id": "40d8f682-8646-11e6-9066-549f350fcb0c",
          "station_id": "394a5408-d778-4959-a63e-973253443ed2"
        },
        "means_of_transport": "train",
        "amenities": [
          "WIFI",
          "POWER_SOCKETS"
        ],
        "is_marketplace": false,
        "operator_id": "train",
        "brand_id": "adf3cadd-7991-436c-be53-eb0f9c5ac165",
        "vehicle_details": [],
        "seat_types": []
      }
    ],
    "messages": [
      "Please transfer to the train station to reach your FlixTrain. Follow the posted signs. Coach numbering starts from the front. Coach 100 is located in the middle of the train."
    ],
    "restrictions": {
      "sale_restriction": false,
      "info_title": "",
      "info_title_hint": "",
      "info_message": "",
      "bikes_allowed": true,
      "wheelchair_status": "unknown"
    },
    "type": "aller"
  }
```

### 🧠 Use Cases

Ideal for:

✈️ Travel platforms

📱 Booking applications

🏨 Tourism agencies

📈 Price comparison websites

🤖 Travel automation bots

📊 Market analysis

🧮 Route optimization

🔔 Fare alerts

### ⚡ Performance

Fast crawling

Scales to thousands of trips

Reliable scheduling via Apify

Clean JSON output

Fault-tolerant sweeps

### 🛟 SUPPORT

Share your runs with the developer team and create issues on error to help us improve actor quality.

You might discover edge case we didn't test yet

We stay available anytime

# Actor input Schema

## `search_url` (type: `string`):

search url, not providing the 'rideDate' inside url will use default today date

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

Select price currency

## `depart_flex_day_before` (type: `integer`):

Select X days before departure date. Allow to be flexible on dates and find the cheapest tickets

## `depart_flex_day_after` (type: `integer`):

Select X days after departure date. Allow to be flexible on dates and find the cheapest tickets

## `return_flex_day_before` (type: `integer`):

Select X days before return date. Allow to be flexible on dates and find the cheapest tickets

## `return_flex_day_after` (type: `integer`):

Select X days after return date. Allow to be flexible on dates and find the cheapest tickets

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

The best option is usually Automatic proxy. But you can also use your own proxies or no proxy

## Actor input object example

```json
{
  "search_url": "https://shop.flixbus.com/search?departureCity=40de8964-8646-11e6-9066-549f350fcb0c&arrivalCity=40d8f682-8646-11e6-9066-549f350fcb0c&route=Paris-Berlin&adult=1&_locale=en_US&departureCountryCode=FR&arrivalCountryCode=DE",
  "currency": "EUR",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "search_url": "https://shop.flixbus.com/search?departureCity=40de8964-8646-11e6-9066-549f350fcb0c&arrivalCity=40d8f682-8646-11e6-9066-549f350fcb0c&route=Paris-Berlin&adult=1&_locale=en_US&departureCountryCode=FR&arrivalCountryCode=DE",
    "currency": "EUR",
    "depart_flex_day_before": 0,
    "depart_flex_day_after": 0,
    "return_flex_day_before": 0,
    "return_flex_day_after": 0,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": []
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("saswave/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 = {
    "search_url": "https://shop.flixbus.com/search?departureCity=40de8964-8646-11e6-9066-549f350fcb0c&arrivalCity=40d8f682-8646-11e6-9066-549f350fcb0c&route=Paris-Berlin&adult=1&_locale=en_US&departureCountryCode=FR&arrivalCountryCode=DE",
    "currency": "EUR",
    "depart_flex_day_before": 0,
    "depart_flex_day_after": 0,
    "return_flex_day_before": 0,
    "return_flex_day_after": 0,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": [],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("saswave/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 '{
  "search_url": "https://shop.flixbus.com/search?departureCity=40de8964-8646-11e6-9066-549f350fcb0c&arrivalCity=40d8f682-8646-11e6-9066-549f350fcb0c&route=Paris-Berlin&adult=1&_locale=en_US&departureCountryCode=FR&arrivalCountryCode=DE",
  "currency": "EUR",
  "depart_flex_day_before": 0,
  "depart_flex_day_after": 0,
  "return_flex_day_before": 0,
  "return_flex_day_after": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}' |
apify call saswave/flixbus-scraper --silent --output-dataset

```

## MCP server setup

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