# Google Flights Scraper — Prices & Itineraries (`s-r/google-flights`) Actor

Search Google Flights for any route and date: price, airlines, stops, departure and arrival times, duration, connections, and carbon emissions. One-way or round-trip, any cabin, market-specific pricing.

- **URL**: https://apify.com/s-r/google-flights.md
- **Developed by:** [SR](https://apify.com/s-r) (community)
- **Categories:** Travel, E-commerce
- **Stats:** 3 total users, 2 monthly users, 100.0% 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

Search Google Flights for any route and date and get the results as clean,
structured data: price, airlines, flight numbers, stops and layovers, departure
and arrival times, duration, aircraft, legroom, carbon emissions, and a deep
link back to the exact search. One row per flight option, ready for a
spreadsheet, a price-tracker, or a dashboard.

One-way or round-trip, any cabin, any market, and a full set of filters. Search
several routes in a single run, and because Google Flights prices a route
differently by country, every row records which country and currency it was
priced in.

### What you get

For every flight option, one dataset row with:

- **price** and **currency** — the fare in the market you chose.
- **airlines** / **airline\_codes** — operating carrier names and codes.
- **stops** and **layover\_airports** — 0 for nonstop, plus the connection codes.
- **departure** / **arrival** — ISO 8601 date-times for the whole itinerary.
- **duration\_minutes** — total travel time.
- **legs** — each segment: from/to airport (code + name), its own departure and
  arrival, duration, **flight\_number**, **airline\_name**, **plane\_type**,
  **legroom**, and an **overnight** flag.
- **carbon\_emissions\_g** — estimated emissions, plus the route typical.
- **booking\_token** and **google\_flights\_url** — the option's booking token and a
  deep link that reopens this exact search on Google Flights.
- **origin**, **destination**, **country**, **trip\_type** — echoed on every row.

### Example output

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "country": "us",
  "currency": "USD",
  "trip_type": "one-way",
  "price": 229,
  "airlines": ["JetBlue"],
  "airline_codes": ["B6"],
  "stops": 0,
  "layover_airports": [],
  "departure": "2026-11-15T05:45",
  "arrival": "2026-11-15T08:55",
  "duration_minutes": 370,
  "legs": [
    {
      "from": { "code": "JFK", "name": "John F. Kennedy International Airport" },
      "to": { "code": "LAX", "name": "Los Angeles International Airport" },
      "departure": "2026-11-15T05:45",
      "arrival": "2026-11-15T08:55",
      "duration_minutes": 370,
      "airline_code": "B6",
      "airline_name": "JetBlue",
      "flight_number": "B6 623",
      "plane_type": "Airbus A321",
      "legroom": "32 inches",
      "overnight": false
    }
  ],
  "carbon_emissions_g": 374000,
  "carbon_typical_g": 410000,
  "booking_token": "CjRI…",
  "google_flights_url": "https://www.google.com/travel/flights/search?tfs=…&gl=us",
  "booking_url": "https://www.google.com/travel/flights/booking?tfs=…&tfu=…"
}
```

### Input

#### Route and trip

| Field | Type | Description |
|---|---|---|
| `origin` | string | **Required.** Departure airport IATA code (e.g. `JFK`). Comma-separate several (`JFK, EWR`) to search each. |
| `destination` | string | **Required.** Arrival airport IATA code(s). Every origin × destination pair is searched. |
| `departure_date` | string | **Required.** Outbound date, `YYYY-MM-DD`. |
| `return_date` | string | Optional. Return date for a round-trip; empty = one-way. |
| `seat` | string | `economy` (default), `premium-economy`, `business`, `first`. |
| `adults` / `children` / `infants` | integer | Passenger counts. Default 1 adult. |
| `currency` | string | Price currency (`USD`, `EUR`…). Default `USD`. |
| `country` | string | Market country (`us`, `gb`, `de`…). Prices differ by market. Default `us`. |
| `language` | string | Interface language. Default `en`. |

#### Filters

| Field | Type | Description |
|---|---|---|
| `max_stops` | integer | Max stops (`0` = nonstop only). |
| `max_price` | integer | Only fares at or below this price. |
| `airlines` | array | Restrict to these airline/alliance codes (e.g. `["DL","AS"]`). |
| `exclude_basic_economy` | boolean | Drop basic-economy fares. |
| `hide_separate_and_self_transfer` | boolean | Hide separate-ticket / self-transfer itineraries. |
| `carry_on_bags` / `checked_bags` | integer | Bags to include in fee estimates. |
| `earliest_departure_hour` / `latest_departure_hour` | integer | Departure time window (0-23). |
| `earliest_arrival_hour` / `latest_arrival_hour` | integer | Arrival time window (0-23). |
| `max_duration_minutes` | integer | Cap total itinerary duration. |
| `connecting_airports` | array | Restrict connections to these airports. |
| `layover_min_minutes` / `layover_max_minutes` | integer | Layover duration bounds. |
| `less_emissions_only` | boolean | Only lower-emission itineraries. |
| `fetch_booking_options` | boolean | One-way only. Also fetch each flight's **booking options** (see below). One extra request per flight, so runs are slower. |

### Deep linking

Every row carries three ways back to Google Flights:

- **`google_flights_url`** — reopens the exact search (same route, dates,
  passengers, cabin and filters).
- **`booking_url`** — for one-way options, a deep link straight to that specific
  itinerary's **booking page**, where Google lists the airline and travel-agency
  options with prices and book buttons. Hand it to a user and they land on the
  page that books the flight.
- **`booking_token`** — the identifier of that specific option, stored alongside
  your snapshot.

#### Booking options

Turn on `fetch_booking_options` (one-way searches) and every flight also gets a
**`booking_options`** array — the airline and travel-agency offers for that
itinerary, each with the vendor, fare name (e.g. Main Base / Main / Main Flex),
price, and a book link:

```json
"booking_options": [
  { "vendor": "JetBlue", "vendor_code": "B6", "price": 229,
    "fare_name": "Main Base", "booking_token": "CjRI…",
    "book_url": "https://www.google.com/travel/clk/…" }
]
```

This costs one extra request per flight, so runs take longer; leave it off when
you only need the headline fares.

### Common uses

- **Fare tracking** — run a route on a schedule and store each snapshot to chart
  how the price moves toward the travel date.
- **Route matrices** — list several origins and destinations in one run to
  compare a whole set of city pairs at once.
- **Deal filtering** — combine `max_price`, `max_stops` and a departure-time
  window to surface only the itineraries you would actually book.
- **Greener travel** — filter with `less_emissions_only` or sort by
  `carbon_emissions_g`.
- **Meta-search feeds** — power a price-comparison page or internal tool, with a
  deep link back to Google Flights on every row.

### How it is billed

Pay per result: you are charged once for each flight option returned, plus a
small fixed charge when a run starts. A route with no results (or a temporary
block) returns no billable results and is reported in the run's error record.
See the Pricing tab for the exact amounts.

### Notes and limits

- **Prices are market-specific.** The `country` sets the currency and fares; the
  row records it, so a rotating job never mixes markets silently.
- **Round-trip** is priced as a whole when you set `return_date`; each returned
  option is a full itinerary.
- **Route matrix.** Multiple origins/destinations run as every pairing; keep the
  set sensible, since each pair is its own search.
- **Live availability.** Results reflect what Google Flights shows at request
  time; prices and seats change constantly, so store the timestamp with each run.

# Actor input Schema

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

Origin airport IATA code (3 letters), e.g. AMS

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

Destination airport IATA code (3 letters), e.g. BCN

## `departure_date` (type: `string`):

YYYY-MM-DD

## `return_date` (type: `string`):

YYYY-MM-DD; omit for one-way

## `seat` (type: `string`):

seat — zie de productdocumentatie.

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

adults — zie de productdocumentatie.

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

children — zie de productdocumentatie.

## `infants` (type: `integer`):

Infants in seat

## `infants_on_lap` (type: `integer`):

infants\_on\_lap — zie de productdocumentatie.

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

ISO 4217, e.g. EUR, USD, GBP

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

ISO-3166 code (e.g. US, GB, NL) — search from a residential exit in that country; Google prices differ per country. Empty = direct.

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

language — zie de productdocumentatie.

## `max_stops` (type: `integer`):

0 = nonstop only

## `max_price` (type: `integer`):

max\_price — zie de productdocumentatie.

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

Include only these airline/alliance codes

## `exclude_basic_economy` (type: `boolean`):

exclude\_basic\_economy — zie de productdocumentatie.

## `hide_separate_and_self_transfer` (type: `boolean`):

hide\_separate\_and\_self\_transfer — zie de productdocumentatie.

## `carry_on_bags` (type: `integer`):

carry\_on\_bags — zie de productdocumentatie.

## `checked_bags` (type: `integer`):

checked\_bags — zie de productdocumentatie.

## `earliest_departure_hour` (type: `integer`):

earliest\_departure\_hour — zie de productdocumentatie.

## `latest_departure_hour` (type: `integer`):

latest\_departure\_hour — zie de productdocumentatie.

## `earliest_arrival_hour` (type: `integer`):

earliest\_arrival\_hour — zie de productdocumentatie.

## `latest_arrival_hour` (type: `integer`):

latest\_arrival\_hour — zie de productdocumentatie.

## `max_duration_minutes` (type: `integer`):

max\_duration\_minutes — zie de productdocumentatie.

## `connecting_airports` (type: `array`):

Route via these connection airport IATA codes

## `layover_min_minutes` (type: `integer`):

layover\_min\_minutes — zie de productdocumentatie.

## `layover_max_minutes` (type: `integer`):

layover\_max\_minutes — zie de productdocumentatie.

## `less_emissions_only` (type: `boolean`):

less\_emissions\_only — zie de productdocumentatie.

## `fetch_booking_options` (type: `boolean`):

Per itinerary: who sells it (airline + booking sites), price, fare, baggage and a click-through link. One-way and round trip. Best with country set.

## `booking_max` (type: `integer`):

With fetch\_booking\_options: resolve at most this many top itineraries. Default: all returned itineraries, as far as the time budget allows (see warnings).

## `price_calendar` (type: `boolean`):

Cheapest fare for every departure (and, round trip, return) date within ±flex\_days. Best with country set.

## `flex_days` (type: `integer`):

flex\_days — zie de productdocumentatie.

## `max_results` (type: `integer`):

max\_results — zie de productdocumentatie.

## `from` (type: `string`):

Alias van origin

## `to` (type: `string`):

Alias van destination

## `date` (type: `string`):

Alias van departure\_date

## `depart_after` (type: `integer`):

Alias van earliest\_departure\_hour

## `depart_before` (type: `integer`):

Alias van latest\_departure\_hour

## `arrive_after` (type: `integer`):

Alias van earliest\_arrival\_hour

## `arrive_before` (type: `integer`):

Alias van latest\_arrival\_hour

## `max_duration_min` (type: `integer`):

Alias van max\_duration\_minutes

## `infants_in_seat` (type: `integer`):

Alias van infants

## `include_booking_options` (type: `boolean`):

Alias van fetch\_booking\_options

## Actor input object example

```json
{
  "origin": "AMS",
  "destination": "BCN",
  "departure_date": "2026-10-15",
  "seat": "economy",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "infants_on_lap": 0,
  "currency": "USD",
  "country": "us",
  "language": "en",
  "exclude_basic_economy": false,
  "hide_separate_and_self_transfer": false,
  "less_emissions_only": false,
  "fetch_booking_options": false,
  "price_calendar": false,
  "flex_days": 3,
  "max_results": 50
}
```

# Actor output Schema

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

Dataset rows produced by this run, one per flight option.

## `output` (type: `string`):

OUTPUT record with the run's counts and status flags.

## `errors` (type: `string`):

Failures with a code and message. Absent when the run had none.

# 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": "AMS",
    "destination": "BCN",
    "departure_date": "2026-10-15"
};

// Run the Actor and wait for it to finish
const run = await client.actor("s-r/google-flights").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": "AMS",
    "destination": "BCN",
    "departure_date": "2026-10-15",
}

# Run the Actor and wait for it to finish
run = client.actor("s-r/google-flights").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": "AMS",
  "destination": "BCN",
  "departure_date": "2026-10-15"
}' |
apify call s-r/google-flights --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,s-r/google-flights"
        }
    }
}
```

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/hHo8xfk3XaG1KmZk3/builds/mBb2dBUGIidt8cryO/openapi.json
