# Google Flights Scraper — Fares, Returns & Booking Links (`thenetaji/google-flights-scraper`) Actor

Search Google Flights for one-way or round trips and export every option: airlines, times, stops, layovers, each segment's flight number, aircraft and legroom, CO2 and price. Add return flights and every airline or agency's fare and booking link.

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

## Pricing

from $0.76 / 1,000 flights

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

The Google Flights Scraper returns every flight option Google Flights lists for a route and date: airlines, departure and arrival times, total duration, stops and layovers, each segment with its flight number, aircraft and legroom, the CO2 estimate, and the price. A search with a return date is a round trip, and each row is then an outbound flight priced for the whole trip. Two add-ons attach the matching return flights and the booking options of every airline and agency selling the trip.

### Accepted input

- `origin` and `destination`: three-letter IATA airport codes such as `JFK` and `LAX`. Several airports may be combined with commas, `JFK,EWR,LGA`, and are searched together.
- `departureDate`, and `returnDate` for a round trip.
- `adults`, `children`, `infantsInSeat` and `infantsOnLap`: at most nine passengers in total and at most one lap infant per adult. Prices are the total for all passengers.
- `cabin`: `economy`, `premium_economy`, `business` or `first`.
- `stops`: `any`, `nonstop`, `one_stop` (one stop or fewer) or `two_stops`.
- `currency`: any three-letter code; prices default to `USD`.
- `maxItems`: the number of flights saved; `0` saves every option Google lists.

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17",
  "adults": 1,
  "cabin": "economy",
  "maxItems": 30
}
```

### Response fields

`position`, `is_best`, `trip_type`, `airlines`, `departure_airport`, `arrival_airport`, `departure_time`, `arrival_time`, `duration_minutes`, `stops`, `price`, `currency`, `segments`, `layovers`, `emissions_grams`, `emissions_typical_grams`, `emissions_difference_percent`, `search_departure_date`, `search_return_date`, and Google's price assessment for the route as `lowest_price`, `typical_price_low` and `typical_price_high`.

```json
{
  "position": 1,
  "is_best": true,
  "trip_type": "round_trip",
  "airlines": ["JetBlue"],
  "departure_airport": "JFK",
  "arrival_airport": "LAX",
  "departure_time": "2026-12-10T20:35",
  "arrival_time": "2026-12-10T23:54",
  "duration_minutes": 379,
  "stops": 0,
  "price": 372,
  "currency": "USD",
  "segments": [{ "flight_number": "B6 1723", "aircraft": "Airbus A320", "legroom": "32 in" }],
  "emissions_grams": 424000,
  "typical_price_low": 225,
  "typical_price_high": 550
}
```

Rows are in Google's order: the flights Google marks as best come first with `is_best` set, followed by the remaining options. Times are local to each airport.

### Add-ons

`enrichReturnFlights` applies to round trips. It adds `return_flights`, the return options that pair with each outbound flight, each priced for the whole trip. It costs one request per outbound flight and is charged only when return flights are returned.

`enrichBookingOptions` adds `booking_options`: every airline and online agency selling the trip, with `seller`, `fare_name`, `price` and `booking_url`. On a one-way search the options are for the row's own flight. On a round trip a booking needs both directions, so the options are for the cheapest return flight, which is added as `booking_return_flight`. The add-on is charged only when booking options are returned.

Neither add-on runs on the free plan's trial rows.

### Behaviour on partial results

A route that Google cannot price, such as a date in the past or an airport code it does not recognise, ends the run with a message rather than an empty success. An add-on that returns nothing leaves the row as it was, writes a line to the log, and is not charged.

### Related Actors

The [Google Flights Price Calendar](https://apify.com/thenetaji/google-flights-price-calendar) returns the cheapest fare for every departure date in a window of up to 93 days, which identifies the date to search here.

# Actor input Schema

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

Departure airport as a three-letter IATA code, such as JFK. Several airports, comma separated, search them together: JFK,EWR,LGA.

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

Arrival airport as a three-letter IATA code, or several comma separated.

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

Day of the outbound flight.

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

Day of the return flight. Leave empty for a one-way search. On a round trip each row is an outbound flight priced for the whole trip.

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

Adult passengers. Prices are the total for everyone travelling.

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

Passengers aged 2 to 11.

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

Infants under 2 with their own seat.

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

Infants under 2 on an adult's lap. At most one per adult.

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

Travel class.

## `stops` (type: `string`):

Most stops allowed.

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

Three-letter currency code for every price, such as USD, EUR or INR.

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

Maximum number of flights to save. Set 0 for every option Google shows.

## `enrichReturnFlights` (type: `boolean`):

Round trips only. Add the return flights that pair with each outbound flight, each with its round-trip price. One extra request per flight, billed per flight that gets them.

## `enrichBookingOptions` (type: `boolean`):

Add every airline and agency selling each flight, with fare name, price and booking link. On a round trip the options are for the cheapest return flight, which is added too. Billed per flight that gets them.

## Actor input object example

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17",
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabin": "economy",
  "stops": "any",
  "currency": "USD",
  "maxItems": 30,
  "enrichReturnFlights": false,
  "enrichBookingOptions": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

All records scraped by this 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 = {
    "origin": "JFK",
    "destination": "LAX",
    "departureDate": "2026-12-10",
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("thenetaji/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": "LAX",
    "departureDate": "2026-12-10",
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("thenetaji/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": "LAX",
  "departureDate": "2026-12-10",
  "maxItems": 30
}' |
apify call thenetaji/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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