# Google Flights Scraper - Prices, Layovers, CO2 (`fabrikit/google-flights-scraper`) Actor

Scrape Google Flights for any route and dates: price, airlines, flight numbers, times, duration, stops and layovers, CO2 emissions and booking link. One-way, round-trip, cabin, stops, currency, date ranges. From US$2 per 1,000 flights.

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

## Pricing

from $2.00 / 1,000 flight itineraries

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

Search **Google Flights** for any route and date range and get every itinerary Google lists: price, airlines, flight numbers, departure/arrival times, duration, stops and layovers, aircraft, **CO2 emissions**, whether Google marks it as a "best" flight, and a link to the exact itinerary on Google Flights.

Plain HTTP, no browser, no login. One request returns the 10-35 itineraries of a search, so scanning dozens of dates or routes is fast and cheap.

### What you get

| Field | Description |
|---|---|
| `price`, `currency`, `priceScope` | Total for all passengers (one-way total, or round-trip price for the outbound flight; the final round-trip total with `includeReturnFlights`) |
| `isBest` | True for Google's "best flights" group |
| `airlines`, `airlineCodes`, `flightNumbers` | Carriers and flight numbers (every segment) |
| `departureAirport`, `arrivalAirport`, `departureTime`, `arrivalTime`, `durationMinutes` | Journey summary (local times) |
| `stops`, `layovers` | Layover airport, city and minutes, airport changes |
| `legs` | Per segment: flight number, aircraft, airports, times, duration, legroom |
| `co2Grams`, `co2TypicalGrams`, `co2DiffPercent` | Emissions for this flight vs typical for the route |
| `returnFlight` | Cheapest matching return journey (round trip + `includeReturnFlights`) |
| `url`, `searchUrl` | Google Flights links (itinerary and search) |

### Input examples

Cheapest nonstop flights JFK to London every day in a 3-week window, in euros:

```json
{ "origins": ["JFK"], "destinations": ["LHR"], "departureDate": "+30", "departureDateTo": "+51", "maxStops": "nonstop", "currency": "EUR", "maxItems": 500 }
```

Round trip Santiago to Madrid or Barcelona, 10-day trips, business class, 2 adults:

```json
{ "origins": ["SCL"], "destinations": ["MAD", "BCN"], "tripType": "round-trip", "departureDate": "2026-12-01", "departureDateTo": "2026-12-15", "dateStepDays": 7, "tripLengthDays": 10, "cabin": "business", "adults": 2 }
```

Dates accept `YYYY-MM-DD` or `+N` (N days from today). Every origin x destination x date is one search (up to 300 per run).

### Output example

```json
{
  "price": 295, "currency": "USD", "priceScope": "one-way total", "isBest": true,
  "airlines": ["JetBlue"], "flightNumbers": ["B6 1107"],
  "departureAirport": "JFK", "arrivalAirport": "LHR",
  "departureTime": "2026-12-10T09:26", "arrivalTime": "2026-12-10T21:40",
  "durationMinutes": 434, "stops": 0, "layovers": [],
  "co2Grams": 588000, "co2TypicalGrams": 432000, "co2DiffPercent": 36,
  "legs": [{ "flightNumber": "B6 1107", "aircraft": "Airbus A321neo", "legroom": "32 in" }],
  "url": "https://www.google.com/travel/flights?tfs=..."
}
```

### Notes

- **Round trips:** by default each outbound flight carries the round-trip price Google shows for it ("from"). Switch on `includeReturnFlights` to look up the cheapest matching return and get the final total (one extra request per outbound flight).
- **Prices** are totals for all passengers and depend on the Google country/currency you pick.
- Google lists a limited number of itineraries per search (usually 10-35), best first.

### Pricing

Pay per result: **US$2 per 1,000 itineraries** (event `flight-result`) plus the small standard Apify start event.

### FAQ

**Does it need a browser or login?** No.
**Which airport codes work?** 3-letter IATA airport (JFK, LHR) or metropolitan codes (NYC, LON).
**What if Google shows a consent or unusual-traffic page?** The actor retries and moves from datacenter to residential proxy automatically; if every search is blocked the run fails with a clear message instead of returning nothing.

### Use cases

Fare monitoring, route and seasonality research, travel deal sites, corporate travel benchmarking, emissions comparisons.

***

### En espanol

Consulta Google Flights por ruta y fechas (ida o ida y vuelta) y devuelve precio, aerolineas, numeros de vuelo, horarios, duracion, escalas y conexiones, emisiones de CO2 y enlace al itinerario. Admite rangos de fechas, cabina, pasajeros, escalas maximas, moneda e idioma. Precio: US$2 por cada 1.000 vuelos.

# Actor input Schema

## `origins` (type: `array`):

3-letter IATA airport or city codes to fly from (JFK, SCL, MAD, NYC, LON...). Several origins are searched one after another.

## `destinations` (type: `array`):

3-letter IATA airport or city codes to fly to.

## `tripType` (type: `string`):

One-way, or round trip (prices are then the round-trip price for each outbound flight).

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

YYYY-MM-DD, or +N for N days from today (+30 = a month from now). First day when you also set a last day below.

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

To scan a range of departure days, set the last day here (YYYY-MM-DD or +N). One search per day (or per step).

## `dateStepDays` (type: `integer`):

When scanning a range, search every N-th day (1 = every day, 7 = weekly).

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

Fixed return date for a single departure date (YYYY-MM-DD or +N). Ignored when 'Trip length' is set.

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

Return N days after each departure date. Use this together with a date range. Defaults to 7 when no return date is given.

## `includeReturnFlights` (type: `boolean`):

Round trips only. For every outbound flight, look up the cheapest matching return flight and show the final round-trip total. Costs one extra request per outbound flight, so it is much slower.

## `cabin` (type: `string`):

Cabin to price.

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

Number of adult passengers (prices are totals for all passengers).

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

Children aged 2-11.

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

Infants under 2 with their own seat.

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

Infants under 2 travelling on an adult's lap.

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

Maximum number of stops.

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

Only these airlines, by 2-letter IATA code (BA, LA, AA, IB). Alliances also work: STAR_ALLIANCE, SKYTEAM, ONEWORLD.

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

3-letter currency code for the prices (USD, EUR, GBP, CLP, MXN...).

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

Google interface language code (en, es, de, fr, pt-BR...). Airline and airport names follow it.

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

2-letter country code that Google uses for pricing (us, gb, cl, de...). Leave empty to use the proxy's location.

## `maxItemsPerSearch` (type: `integer`):

Keep only the first N itineraries of every search (Google lists the best ones first). Leave empty for all of them.

## `maxItems` (type: `integer`):

Maximum number of itineraries to save in total.

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

Apify datacenter proxy by default. If Google shows its consent or unusual-traffic page, the actor switches to a residential proxy automatically.

## Actor input object example

```json
{
  "origins": [
    "JFK"
  ],
  "destinations": [
    "LHR"
  ],
  "tripType": "one-way",
  "departureDate": "+30",
  "dateStepDays": 1,
  "includeReturnFlights": false,
  "cabin": "economy",
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "maxStops": "any",
  "currency": "USD",
  "language": "en",
  "maxItems": 40,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All records collected during the run

# 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 = {
    "origins": [
        "JFK"
    ],
    "destinations": [
        "LHR"
    ],
    "departureDate": "+30",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("fabrikit/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 = {
    "origins": ["JFK"],
    "destinations": ["LHR"],
    "departureDate": "+30",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("fabrikit/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 '{
  "origins": [
    "JFK"
  ],
  "destinations": [
    "LHR"
  ],
  "departureDate": "+30",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call fabrikit/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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