# Google Flights Scraper — Prices & Schedules (`workstream/google-flights-scraper`) Actor

Scrape Google Flights live fares: prices, airlines, flight numbers, times, stops, layovers and CO2. One-way or round-trip with return options, any cabin and currency, plus cheapest-day sweep. No proxies needed.

- **URL**: https://apify.com/workstream/google-flights-scraper.md
- **Developed by:** [Ahmad Shaaban](https://apify.com/workstream) (community)
- **Categories:** Travel, E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 87.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Google Flights Scraper — Prices, Stops & Schedules

Scrape **Google Flights** results: live fares, airlines, flight numbers, times, stops, layovers and CO2. One-way or round-trip with return options, any cabin and currency. No proxies.

### Who this is for

- Fare research and price-alert products
- Travel agencies and OTAs enriching search
- Analysts tracking airline pricing
- Apps that need structured flight data

### What you get

| Field | Example |
|---|---|
| price, currency | 412, USD |
| airlines, flight numbers | BA178 |
| departure / arrival times | local times + duration |
| stops, layovers | 0 / 1 / 2+ |
| cabin, CO2 | ECONOMY, emissions |
| returnOptions | return flights + combined price |
| bookingUrl | deep link into Google Flights |

### Features

- Full results page (not just the first few)
- Round trips with return options for top outbound flights
- Cheapest-day date sweep across a range
- Cabins: Economy, Premium Economy, Business, First
- Any currency (USD, EUR, GBP, AED…)

### Input example

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-12-05",
  "returnDate": "2026-12-12",
  "returnOptionsForTopN": 3,
  "cabinClass": "ECONOMY",
  "currency": "USD",
  "maxFlightsPerSearch": 50
}
```

If you leave the date empty, the Actor searches 30 days ahead so Start always returns results.

### Pricing

Pay per search + per flight (+ return-options when used). See Pricing. Competitive with Actors charging $2–3 per 1,000 fares plus start fees.

### FAQ

**Proxies?** Not required.
**Multi-city?** One origin–destination per search; pass multiple searches in one run.
**Calendar cheapest day?** Yes — use the date-sweep options.

# Actor input Schema

## `origin` (type: `string`):

3-letter airport code, e.g. JFK, BEY, DXB.

## `destination` (type: `string`):

3-letter airport code, e.g. LHR.

## `departureDate` (type: `string`):

YYYY-MM-DD. If omitted (and no dates/sweep given), defaults to 30 days from today.

## `returnDate` (type: `string`):

Leave empty for one-way. With a return date, outbound prices are round-trip totals, and return options are fetched for the top N outbound flights.

## `returnOptionsForTopN` (type: `integer`):

Round trips only: fetch return flights (with combined round-trip price and booking link) for the first N outbound flights in Google's order. 0 = off. Charged as 'return-options' per outbound flight expanded.

## `maxReturnOptions` (type: `integer`):

Cap on return flights listed under each expanded outbound flight.

## `departureDates` (type: `array`):

Optional: search the same route on more dates (YYYY-MM-DD), e.g. to find the cheapest day.

## `sweepStartDate` (type: `string`):

Cheapest-day mode: search every departure date from this date...

## `sweepEndDate` (type: `string`):

...to this date (max 90 days). Results go to the CHEAPEST_DAYS record.

## `tripLengthDays` (type: `integer`):

Optional: make each swept date a round trip returning after this many days.

## `sweepSummaryOnly` (type: `boolean`):

Only produce the cheapest-day summary (charged per search), without pushing every flight to the dataset.

## `searches` (type: `array`):

Optional list of searches, e.g. \[{"origin":"BEY","destination":"DXB","departureDate":"2026-11-20"}]. Missing fields fall back to the values above.

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

Number of adult passengers.

## `children` (type: `integer`):

Children (2-11).

## `infantsInSeat` (type: `integer`):

Infants with own seat.

## `infantsOnLap` (type: `integer`):

Infants on lap.

## `cabinClass` (type: `string`):

Cabin class.

## `maxStops` (type: `string`):

ANY, 0 (nonstop), 1 or 2.

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

ISO currency code, e.g. USD, EUR, AED.

## `maxFlightsPerSearch` (type: `integer`):

Cap on flights returned per search.

## `maxConcurrency` (type: `integer`):

Parallel searches (keep low to avoid rate limits).

## `verifyAgainstPage` (type: `boolean`):

Also loads the Google Flights page and compares prices (slower; for testing).

## Actor input object example

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "returnOptionsForTopN": 3,
  "maxReturnOptions": 20,
  "sweepSummaryOnly": false,
  "searches": [],
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "ECONOMY",
  "maxStops": "ANY",
  "currency": "USD",
  "maxFlightsPerSearch": 100,
  "maxConcurrency": 4,
  "verifyAgainstPage": false
}
```

# Actor output Schema

## `flights` (type: `string`):

One item per flight option

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

Per-search counts, cheapest price and errors

## `cheapestDays` (type: `string`):

Cheapest price per route and departure date (date sweep)

# 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 = {
    "origin": "JFK",
    "destination": "LHR",
    "searches": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("workstream/google-flights-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 = {
    "origin": "JFK",
    "destination": "LHR",
    "searches": [],
}

# Run the Actor and wait for it to finish
run = client.actor("workstream/google-flights-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 '{
  "origin": "JFK",
  "destination": "LHR",
  "searches": []
}' |
apify call workstream/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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