# Google Flights Scraper (`flash_kpi/google-flights-scraper`) Actor

Scrape Google Flights between any airports: prices, airlines, stops, durations, departure and arrival times, CO₂ and Google price insights. One-way or round trip. Full-depth mode goes beyond the first page of results.

- **URL**: https://apify.com/flash_kpi/google-flights-scraper.md
- **Developed by:** [YEVHEN VDOVIN](https://apify.com/flash_kpi) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.30 / 1,000 flight scrapeds

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

Get flight prices and schedules from Google Flights for any route and date — fast and cheap. The scraper talks to Google Flights over plain HTTP (no browser), so a search takes about a second and hundreds of routes finish in a couple of minutes.

### What you get

For every search (route + date):

- **Flights** — price, airlines, flight numbers, departure and arrival times, total duration, number of stops
- **Layovers** — airport, city, duration, airport change flag
- **Every segment** — aircraft, legroom, Wi‑Fi / power / video, codeshares, overnight flag, CO₂ emissions
- **Google's verdict** — which flights Google marks as "best", and whether today's price is **low, typical or high** for this route
- **Price insights** — typical price range and about 60 days of price history (one extra free record per search)
- **Round trips** — outbound flights with "round trip from" prices, and optionally the matching return flights with the final price
- A direct link to the search on Google Flights

### Typical uses

- Price monitoring for routes you sell or fly often — schedule the Actor and compare runs
- Finding the cheapest day: set **Scan departure dates until** and get prices for every date in the range
- Bulk fare research across hundreds of city pairs with **Bulk routes**
- Feeding travel apps, deal alerts, newsletters and AI agents with fresh fares

### Input

| Field | Description |
|---|---|
| `origin`, `destination` | IATA airport codes (`JFK`) or city codes (`NYC`, `LON`); several airports with commas: `JFK,EWR` |
| `departureDate`, `returnDate` | Dates in `YYYY-MM-DD`. No return date = one-way |
| `departureDateTo` | Scan every departure date up to this one (trip length is kept for round trips) |
| `routes` | Bulk mode: `[{"from": "JFK", "to": "LHR", "date": "2026-12-01", "returnDate": "2026-12-08"}]` |
| `adults`, `children`, `infantsInSeat`, `infantsOnLap` | Passengers |
| `cabinClass` | `economy`, `premium_economy`, `business`, `first` |
| `maxStops` | `any`, `0` (nonstop), `1`, `2` |
| `airlines` | Only these airlines or alliances: `["BA", "LH"]`, `["STAR_ALLIANCE"]` |
| `searchDepth` | `standard` — Google's best and cheapest flights (10–30 per search, one request). `full` — one more request per airline on the route, several times more flights |
| `returnFlightsFor` | Round trips: fetch return flights for the first N outbound flights |
| `maxFlightsPerSearch` | Cap on saved flights per search |
| `includePriceInsights` | Extra record with typical price range and price history |
| `currency`, `language`, `country` | e.g. `EUR`, `de`, `de` |

Minimal example:

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-12-01",
  "returnDate": "2026-12-08"
}
```

### Output

```json
{
  "type": "flight",
  "origin": "JFK",
  "destination": "LHR",
  "departureDate": "2026-11-12",
  "returnDate": null,
  "tripType": "one_way",
  "position": 1,
  "price": 293,
  "currency": "USD",
  "isBest": true,
  "airlines": ["Aer Lingus"],
  "flightNumbers": ["EI 104", "EI 152"],
  "from": "JFK",
  "to": "LHR",
  "departure": "2026-11-12T17:00",
  "arrival": "2026-11-13T08:05",
  "durationMinutes": 605,
  "stops": 1,
  "layovers": [{ "airport": "DUB", "airportName": "Dublin Airport", "city": "Dublin", "durationMinutes": 125, "changeOfAirport": false }],
  "segments": [
    { "airline": "Aer Lingus", "flightNumber": "EI 104", "from": "JFK", "to": "DUB", "departure": "2026-11-12T17:00", "arrival": "2026-11-13T04:30", "durationMinutes": 390, "aircraft": "Airbus A330", "legroom": "31 inches", "wifi": true, "power": false, "onDemandVideo": true, "co2Grams": 341888 }
  ],
  "co2Grams": 394000,
  "co2TypicalGrams": 432000,
  "co2DiffPercent": -9,
  "priceLevel": "typical",
  "typicalPriceLow": 170,
  "typicalPriceHigh": 300,
  "totalFlightsOnGoogle": 113,
  "searchUrl": "https://www.google.com/travel/flights/search?tfs=..."
}
```

Times are local to each airport. Prices are for all passengers of the search, in the currency you choose.

With **Price insights** on, each search also adds a record with `"type": "priceInsights"`: `lowestPrice`, `typicalPriceLow`, `typicalPriceHigh`, `priceLevel` and `priceHistory` (`[{ "date": "2026-10-08", "price": 293 }, ...]`).

### Good to know

- Google shows its best flights and the cheapest ones first; a standard search returns that first screen (usually 10–30 flights, always including the lowest price). Use `searchDepth: "full"` when you need the long tail.
- `totalFlightsOnGoogle` tells you how many flights Google has for the search in total.
- For round trips the outbound price is Google's "round trip from" price. Set `returnFlightsFor` to get exact prices for specific return flights.
- If a route has no flights on a date, the search simply returns nothing and is not charged.
- No proxy is needed in most cases. If Google starts limiting requests, the Actor switches to Apify Proxy by itself.

### Pricing

You pay per flight saved to the dataset. Price-insight records, empty searches and failed requests are free.

# Actor input Schema

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

IATA airport code (JFK) or city code (NYC, LON). Several airports can be combined with commas: JFK,EWR.

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

IATA airport code (LHR) or city code (LON, PAR). Several airports can be combined with commas: LHR,LGW.

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

Departure date (YYYY-MM-DD). Leave empty to use the date 30 days from today.

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

Return date (YYYY-MM-DD) for a round trip. Leave empty for a one-way search.

## `departureDateTo` (type: `string`):

Optional. Search every departure date from "Departure date" to this date — handy for finding the cheapest day. For round trips the trip length stays the same.

## `routes` (type: `array`):

Optional. Many searches in one run: \[{"from": "JFK", "to": "LHR", "date": "2026-12-01", "returnDate": "2026-12-08"}, ...]. Passengers, cabin and filters below apply to every route.

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

Number of adult passengers.

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

Number of children.

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

Number of infants with their own seat.

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

Number of infants on lap.

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

Cabin class.

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

Maximum number of stops.

## `airlines` (type: `array`):

Optional. Only these airlines: IATA codes (BA, LH) or alliances (ONEWORLD, SKYTEAM, STAR_ALLIANCE).

## `returnFlightsFor` (type: `integer`):

Round trips only. For the first N outbound flights also fetch the matching return flights with the final round-trip price (one extra request per outbound flight). 0 = outbound flights with "round trip from" prices only.

## `searchDepth` (type: `string`):

Standard: one request per search — Google's best flights plus the cheapest ones (usually 10–30 flights). Full: additionally one request per airline flying the route, which collects several times more flights (remember to raise "Max flights per search").

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

How many flights to save for each route and date.

## `includePriceInsights` (type: `boolean`):

Add one extra record per search with Google's price insights: lowest price, typical price range, whether the price is low / typical / high, and about 60 days of price history. Free of charge.

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

Three-letter currency code for prices, e.g. USD, EUR, GBP.

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

Two-letter language code of the results (hl), e.g. en, de, es.

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

Two-letter country code Google should treat the search as coming from (gl), e.g. us, gb, de. Affects available fares.

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

Optional. The scraper tries without a proxy first and switches to Apify Proxy automatically if Google starts limiting requests.

## Actor input object example

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "routes": [],
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "economy",
  "maxStops": "any",
  "airlines": [],
  "returnFlightsFor": 0,
  "searchDepth": "standard",
  "maxFlightsPerSearch": 30,
  "includePriceInsights": true,
  "currency": "USD",
  "language": "en",
  "country": "us",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All scraped flight options as dataset items.

# 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",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("flash_kpi/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",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("flash_kpi/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",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call flash_kpi/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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