# FlixBus Connections Scraper (`jindrich.bar/flixbus-connections`) Actor

Scrape bus connections from FlixBus with departure dates, prices, vacancy levels, and more.

- **URL**: https://apify.com/jindrich.bar/flixbus-connections.md
- **Developed by:** [Jindřich Bär](https://apify.com/jindrich.bar) (community)
- **Categories:** Travel, Agents, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.50 / 1,000 search results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 connection scraper

Search bus connections via the [Flixbus](https://www.flixbus.com/) API and get back a
structured dataset of routes, times, leg-by-leg breakdowns, and prices.

### What it does

Given a departure city, a destination, and an optional date, the actor:

1. Resolves the city names to Flixbus city IDs via the Flixbus autocomplete endpoint.
2. Calls the Flixbus connection-search API for the requested date.
3. Walks forward day by day until enough connections are collected or the day-scan cap is hit.

For each connection you get:

- Departure and arrival as ISO 8601 timestamps with timezone offsets
- Total travel time in minutes
- Number of transfers
- Per-leg breakdown: ride ID, from/to station + city, departure / arrival, operator, brand, amenities
- Total price and price including the Flixbus platform fee, in the requested currency
- Seat availability and whether bikes can be booked

### Inputs

| Field | Required | Default | Description |
| --- | --- | --- | --- |
| `from` | yes | — | Departure city name (resolved via Flixbus autocomplete) |
| `to` | yes | — | Destination city name (resolved via Flixbus autocomplete) |
| `date` | no | today | Departure date (date picker, ISO `YYYY-MM-DD`) |
| `adults` | no | `1` | Number of adult passengers (affects the returned price) |
| `currency` | no | `EUR` | ISO 4217 currency code used to price the connections |
| `locale` | no | `en_US` | Locale passed to the Flixbus API |
| `onlyDirectConnections` | no | `false` | Only return single-leg, no-transfer connections |
| `maxResults` | no | `20` | Maximum number of connections to push to the dataset |

#### Example input

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

### Output

Each item in the dataset describes one connection.

#### Example item

```json
{
    "id": "direct:93d81544-1986-4a6d-a112-162812c4ff17:9b6adf5b-3ecb-11ea-8017-02437075395e:dcbb994f-9603-11e6-9066-549f350fcb0c",
    "from": "Prague ÚAN Florenc",
    "to": "Berlin Südkreuz",
    "fromCity": "Prague",
    "toCity": "Berlin",
    "departure": "2026-05-20T01:00:00+02:00",
    "arrival": "2026-05-20T05:50:00+02:00",
    "timeLengthMinutes": 290,
    "changesCount": 0,
    "transferType": "Direct",
    "status": "available",
    "provider": "flixbus",
    "legs": [
        {
            "rideId": "93d81544-1986-4a6d-a112-162812c4ff17",
            "from": "Prague ÚAN Florenc",
            "to": "Berlin Südkreuz",
            "fromCity": "Prague",
            "toCity": "Berlin",
            "departure": "2026-05-20T01:00:00+02:00",
            "arrival": "2026-05-20T05:50:00+02:00",
            "timeLengthMinutes": 290,
            "meansOfTransport": "bus",
            "operator": "FlixBus DACH GmbH",
            "brand": "FlixBus",
            "amenities": ["WIFI", "POWER_SOCKETS"]
        }
    ],
    "price": 22.49,
    "priceWithPlatformFee": 26.48,
    "currency": "EUR",
    "seatsAvailable": 59,
    "bikesAllowed": true
}
```

`price` is in the currency requested via the `currency` input; `null` means the price could not
be retrieved. `changesCount` is `0` for direct, single-leg connections.

### Pricing

The actor uses Apify pay-per-event pricing — one `search-result` event is charged for every
connection pushed to the dataset.

### Agentic use

The actor is built for use by AI agents:

- **Structured input schema.** Every input has a title, type, description, and validation rules.
- **Structured output schema.** Each dataset item has a stable, typed shape — agents can read fields
  like `departure`, `price`, or `changesCount` without parsing prose.
- **ISO timestamps.** Departures and arrivals are emitted as ISO 8601 strings with the original
  timezone offset, ready to be diffed, sorted, or compared.
- **Numeric quantities.** `timeLengthMinutes`, `changesCount`, `price` are numbers, not formatted
  strings — no parsing required.
- **Predictable output.** Connections are returned in chronological order; duplicates are removed.
- **Event-level cost control.** Pay-per-event billing means an agent that sets a small `maxResults`
  pays only for what it consumes.

Typical agent prompts that map cleanly onto this actor:

- *"Find the cheapest Flixbus from Prague to Berlin tomorrow."*
- *"How long does the direct Flixbus from Berlin to Madrid take?"*
- *"List all direct overnight Flixbus rides from London to Paris in the next two weeks."*

# Actor input Schema

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

Departure city name (e.g. "Prague", "Berlin", "London"). Resolved against the Flixbus city autocomplete.

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

Destination city name. Resolved against the Flixbus city autocomplete.

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

Departure date (ISO YYYY-MM-DD). Leave empty to use 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 the Flixbus API (affects city/station names in the response).

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

If enabled, only direct connections (single leg, no transfers) are pushed.

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

Maximum number of connections to push to the dataset. The actor stops after this many items.

## Actor input object example

```json
{
  "from": "Prague",
  "to": "Berlin",
  "adults": 1,
  "currency": "EUR",
  "locale": "en_US",
  "onlyDirectConnections": false,
  "maxResults": 20
}
```

# Actor output Schema

## `connections` (type: `string`):

Default dataset items — one entry per Flixbus connection, each with the per-leg breakdown and the total price.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jindrich.bar/flixbus-connections").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("jindrich.bar/flixbus-connections").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call jindrich.bar/flixbus-connections --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=jindrich.bar/flixbus-connections",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "FlixBus Connections Scraper",
        "description": "Scrape bus connections from FlixBus with departure dates, prices, vacancy levels, and more.",
        "version": "0.0",
        "x-build-id": "gdZu9GPoK9I1ZCnQQ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jindrich.bar~flixbus-connections/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jindrich.bar-flixbus-connections",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/jindrich.bar~flixbus-connections/runs": {
            "post": {
                "operationId": "runs-sync-jindrich.bar-flixbus-connections",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/jindrich.bar~flixbus-connections/run-sync": {
            "post": {
                "operationId": "run-sync-jindrich.bar-flixbus-connections",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "from",
                    "to"
                ],
                "properties": {
                    "from": {
                        "title": "From city",
                        "type": "string",
                        "description": "Departure city name (e.g. \"Prague\", \"Berlin\", \"London\"). Resolved against the Flixbus city autocomplete.",
                        "default": "Prague"
                    },
                    "to": {
                        "title": "To city",
                        "type": "string",
                        "description": "Destination city name. Resolved against the Flixbus city autocomplete.",
                        "default": "Berlin"
                    },
                    "date": {
                        "title": "Departure date",
                        "type": "string",
                        "description": "Departure date (ISO YYYY-MM-DD). Leave empty to use today."
                    },
                    "adults": {
                        "title": "Adult passengers",
                        "minimum": 1,
                        "maximum": 9,
                        "type": "integer",
                        "description": "Number of adult passengers (used by Flixbus to compute the price).",
                        "default": 1
                    },
                    "currency": {
                        "title": "Currency",
                        "enum": [
                            "USD",
                            "EUR",
                            "GBP",
                            "CZK",
                            "PLN",
                            "CHF",
                            "DKK",
                            "SEK",
                            "NOK",
                            "HUF"
                        ],
                        "type": "string",
                        "description": "ISO 4217 currency code used to price the connections.",
                        "default": "EUR"
                    },
                    "locale": {
                        "title": "Locale",
                        "type": "string",
                        "description": "Locale passed to the Flixbus API (affects city/station names in the response).",
                        "default": "en_US"
                    },
                    "onlyDirectConnections": {
                        "title": "Only direct connections",
                        "type": "boolean",
                        "description": "If enabled, only direct connections (single leg, no transfers) are pushed.",
                        "default": false
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of connections to push to the dataset. The actor stops after this many items.",
                        "default": 20
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
