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

Scrape Google Flights route offers with price, airline, flight number, departure and arrival times, duration, stops, layovers, aircraft and CO2. Search one-way or round-trip in any cabin, filter stops or max price, and use direct HTTP extraction without browser runtime.

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

## Pricing

$1.00 / 1,000 flight offers

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

## 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

## Google Flights Scraper

Google Flights Scraper returns one clean dataset row per route offer, so travel teams can compare fares without manually copying search results. Each row includes price, airline, flight number, departure and arrival times, total duration, stops, layovers, aircraft, estimated CO2, segment details, and the Google Flights search URL. Use it for route monitoring, itinerary research, fare comparison, and travel-planning workflows.

### What Google Flights Scraper returns

The actor searches one origin and destination at a time. It supports one-way and round-trip trips, adult passenger counts, economy through first class, currency selection, stop limits, maximum fare filters, and a result cap. Filters are applied before records are written, which keeps a scoped run predictable.

### Quick start

1. Enter three-letter IATA codes such as `JFK` and `LHR`.
2. Enter a future departure date. Add a return date for a round trip.
3. Choose cabin, currency, stop limit, and maximum offers.
4. Run the actor and open the default dataset.

Example input:

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "departDate": "2026-12-15",
  "returnDate": "2026-12-22",
  "adults": 1,
  "cabinClass": "ECONOMY",
  "maxStops": "1",
  "currency": "USD",
  "maxResults": 10,
  "dryRun": false
}
```

### Google Flights Scraper input

`origin`, `destination`, and `departDate` are required. `returnDate` is optional; omit it for a one-way search. `maxPrice` is interpreted in the selected currency. The page currently exposes up to 25 offers for a route search, so `maxResults` accepts values from 1 through 25.

### Google Flights Scraper output

Each dataset item is an offer. Dates and local times are preserved as strings, while prices, stops, durations, and emissions are numeric. `segments` contains the per-flight details for connecting itineraries.

Example output:

```json
{
  "id": "AA:100:2026-12-15T09:35:LHR",
  "resultGroup": "best",
  "origin": "JFK",
  "destination": "LHR",
  "departDate": "2026-12-15",
  "returnDate": "2026-12-22",
  "airline": "American",
  "airlineCode": "AA",
  "flightNumber": "100",
  "operatingAirlines": null,
  "departureTime": "2026-12-15T09:35",
  "arrivalTime": "2026-12-15T21:40",
  "durationMinutes": 425,
  "stops": 0,
  "layovers": [],
  "legroom": "31 in",
  "aircraft": "Boeing 777",
  "emissionsKg": 407,
  "price": 793,
  "currency": "USD",
  "segments": [{
    "airline": "American Airlines",
    "airlineCode": "AA",
    "flightNumber": "100",
    "origin": "JFK",
    "destination": "LHR",
    "departureTime": "2026-12-15T09:35",
    "arrivalTime": "2026-12-15T21:40",
    "durationMinutes": 425,
    "aircraft": "Boeing 777"
  }],
  "googleFlightsUrl": "https://www.google.com/travel/flights/search?tfs=...",
  "scrapedAt": "2026-08-10T16:00:00.000Z"
}
```

### Pricing and limits

The actor is pay per emitted flight offer. The first public price is set after a deployed smoke run and is shown on the actor page before you start. Apify's free usage credit can be used for testing. A single run handles one route search and returns at most 25 selected offers. To control spend, set `maxStops`, `maxPrice`, and `maxResults`; excluded offers are not written to the dataset.

### Use cases

- Monitor a fixed route for fare changes on a schedule.
- Build a shortlist of nonstop or low-stop travel options.
- Compare airlines, journey duration, emissions, and fare levels.
- Feed itinerary options into a travel-planning or operations workflow.

### Related actors

- [Skyscanner Flight Scraper API](https://apify.com/makework36/flight-price-scraper) — useful when you want a multi-source fare comparison across several travel sites.
- [Google Flights Scraper - Fares, Routes & Price Tracking](https://apify.com/scrapesage/google-flights-scraper) — useful for broader price tracking and fare-change workflows.

### FAQ

#### Is it legal to scrape Google Flights?

You are responsible for using the output lawfully and respecting the rules that apply to your project, location, and intended use. Use the data for permitted purposes, avoid representing results as an official Google service, and review current Google terms and applicable privacy, consumer-protection, and aviation rules before deploying a commercial workflow.

#### Does the actor need a Google account or API key?

No account or API key is required in the actor input. The actor performs a route search and returns the fare data available in that search response.

#### Does it return booking links?

It returns the Google Flights search URL used for the result set. Airline or agency booking links are not promised as a stable output field.

#### Why are some fields null?

Google does not expose every enrichment field for every itinerary. Aircraft, operating-airline names, and layover details can be absent for some offers; the core route, price, schedule, and stop fields are validated before writing.

### Run locally

```bash
npm install
npm test
npm start
```

Set the normal Apify environment variables for a live run. Fixture tests do not make network requests.

# Actor input Schema

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

Three-letter IATA airport code for the departure airport, such as JFK, LAX, or LHR.

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

Three-letter IATA airport code for the arrival airport, such as LHR, CDG, or SFO.

## `departDate` (type: `string`):

Departure date in YYYY-MM-DD format. Use a future date for a live fare search.

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

Optional return date in YYYY-MM-DD format. Leave blank for a one-way search.

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

Number of adult passengers, from 1 to 9.

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

Cabin used for the route search.

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

Keep only offers with this many stops or fewer. Choose any to keep nonstop and connecting offers.

## `maxPrice` (type: `number`):

Optional maximum fare in the selected currency. Offers above this amount are excluded before billing.

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

Three-letter currency code for displayed fares, such as USD, EUR, or GBP.

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

Maximum number of matching offers to emit, from 1 to 25. Filters are applied before this cap.

## `dryRun` (type: `boolean`):

Fetch and filter the route without writing dataset records. Useful for checking an input.

## Actor input object example

```json
{
  "origin": "JFK",
  "destination": "LHR",
  "departDate": "2026-12-15",
  "returnDate": "2026-12-22",
  "adults": 1,
  "cabinClass": "ECONOMY",
  "maxStops": "any",
  "maxPrice": 1000,
  "currency": "USD",
  "maxResults": 25,
  "dryRun": false
}
```

# Actor output Schema

## `flightOffers` (type: `string`):

Default dataset of route offers. Key fields: price, airline, flightNumber, departureTime, arrivalTime, durationMinutes, stops, layovers, emissionsKg, and segments.

# 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",
    "departDate": "2026-12-15",
    "returnDate": "2026-12-22",
    "adults": 1,
    "cabinClass": "ECONOMY",
    "maxStops": "any",
    "maxPrice": 1000,
    "currency": "USD",
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("schnellscrapers/google-flights-route-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",
    "departDate": "2026-12-15",
    "returnDate": "2026-12-22",
    "adults": 1,
    "cabinClass": "ECONOMY",
    "maxStops": "any",
    "maxPrice": 1000,
    "currency": "USD",
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("schnellscrapers/google-flights-route-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",
  "departDate": "2026-12-15",
  "returnDate": "2026-12-22",
  "adults": 1,
  "cabinClass": "ECONOMY",
  "maxStops": "any",
  "maxPrice": 1000,
  "currency": "USD",
  "maxResults": 25
}' |
apify call schnellscrapers/google-flights-route-scraper --silent --output-dataset

```

## MCP server setup

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