# Google Flights Scraper — Fares, Stops, Layovers & CO₂ (`khadinakbar/google-flights-scraper`) Actor

Scrape Google Flights one-way and round-trip fares by route and date: price, airlines, stops, layovers, flight numbers, aircraft, carbon emissions and the Google Flights link. Filter by stops, airline and max price.

- **URL**: https://apify.com/khadinakbar/google-flights-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Travel, Automation, AI
- **Features:** Limited permissions
- **Stats:** 17 total users, 5 monthly users, 99.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 flight itinerary returneds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### What is Google Flights Scraper?

Google Flights Scraper returns one dataset row per flight option from Google Flights for the route and dates you choose. Each row has the price, currency, airlines, stops, total duration, departure and arrival times, every segment with flight number and aircraft, layovers, carbon emissions and a link back to the Google Flights search. Travel agencies, fare analysts, travel managers and AI agents use it to compare fares and schedules, with no Google account.

### Why travel teams use it

- **One-way and round trip.** Leave `returnDate` empty for one-way; add it for round-trip prices.
- **Segment detail.** Flight numbers, aircraft types, cabins and layover airports and durations.
- **Carbon data.** `carbonKg` and how it compares with a typical flight on the route.
- **32 currencies and markets.** Set `currency`, `country` and `language` for local prices.
- **Relative dates.** Use `+30 days` style dates for schedules that never go stale.

### How to use it

**One-way fares from Los Angeles to New York in a month:**

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "+30 days",
  "maxResults": 20
}
```

**Business-class round trip London to New York, priced in euros:**

```json
{
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "+45 days",
  "returnDate": "+52 days",
  "cabinClass": "business",
  "currency": "EUR",
  "country": "uk",
  "maxResults": 10
}
```

| Input | What it controls |
|---|---|
| `origin`, `destination` | Airport codes such as `LAX`, `JFK`, `LHR` |
| `departureDate`, `returnDate` | `YYYY-MM-DD` or relative such as `+30 days`; empty `returnDate` = one-way |
| `adults`, `children`, `infantsInSeat`, `infantsOnLap` | Passengers |
| `cabinClass` | `economy` (default), `premium_economy`, `business` or `first` |
| `maxStops` | Most stops allowed; `0` for non-stop |
| `includeAirlines`, `excludeAirlines` | Airline codes such as `UA`, `BA` or an alliance (`STAR_ALLIANCE`, `SKYTEAM`, `ONEWORLD`); use one or the other |
| `maxPrice` | Highest total price to keep, in the chosen currency |
| `currency`, `country`, `language` | Price currency and Google market |
| `maxResults` | Most flight options to save (default 50) |

### Output: flight data you receive

A real round-trip row (segments shortened to the first leg's two flights):

```json
{
  "tripType": "round_trip",
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "2026-11-16",
  "returnDate": "2026-11-23",
  "price": 2191,
  "currency": "EUR",
  "isBestFlight": true,
  "cabinClass": "business",
  "totalDurationMinutes": 645,
  "stops": 1,
  "airlines": ["Icelandair"],
  "outbound": {
    "departureTime": "2026-11-16T12:15:00",
    "arrivalTime": "2026-11-16T18:00:00",
    "segments": [
      { "flightNumber": "FI 451", "aircraft": "Boeing 767", "origin": "LHR", "destination": "KEF", "cabin": "Business Class" },
      { "flightNumber": "FI 615", "aircraft": "Boeing 737MAX 9 Passenger", "origin": "KEF", "destination": "JFK", "cabin": "Business Class" }
    ],
    "layovers": [{ "airport": "KEF", "durationMinutes": 80, "overnight": false }]
  },
  "return": null,
  "carbonKg": 983,
  "carbonVsTypical": "-15%",
  "googleFlightsUrl": "https://www.google.com/travel/flights?hl=en&gl=uk&curr=EUR&tfs=..."
}
```

| Field | What it contains |
|---|---|
| `price`, `currency`, `isBestFlight` | Fare and whether Google ranks it a best flight |
| `airlines`, `stops`, `totalDurationMinutes` | The itinerary at a glance |
| `outbound.segments`, `outbound.layovers` | Flight numbers, aircraft, cabins and connections |
| `carbonKg`, `carbonVsTypical` | Emissions estimate |
| `googleFlightsUrl` | The search on Google Flights |
| `bookingUrl` | Google Flights booking-options page when Google returns one (mostly one-way); otherwise `null` |
| `tripType`, `departureDate`, `returnDate`, `cabinClass` | Search context |

For round trips, `price` is the round-trip fare and `outbound` describes the first leg; Google Flights chooses the return flight on a second screen, so `return` stays `null`.

### Example workflow: a fare tracker for a team trip

A travel manager watches fares for a team flying San Francisco to Seattle. Each Monday they collect non-stop options with `maxStops` 0 for the trip dates and record the lowest `price` per airline. When the price drops, they book. They continue with [Kayak Flights Scraper](https://apify.com/khadinakbar/kayak-flights-scraper) for the same route to compare booking-site prices and baggage fees.

### Pricing

This Actor uses **Pay per event** plus **Apify platform usage**. You pay a small start event, one event per completed search and one event per flight option saved, plus the platform usage of the job. The live Pricing tab on this page shows the current prices.

- 1 route with `maxResults` 20 = 1 search event + up to 20 flight events + platform usage.
- `maxStops`, airline filters, `maxPrice` and `maxResults` reduce the rows saved and charged.
- Invalid input stops before any search and is not charged. If the search service is unavailable, the run ends with a clear status message instead of empty rows.
- `maxResults` is the cost ceiling per search.

#### Free Apify plan

Runs started from a free Apify plan return up to 50 results per run, with every input mode and output field available. Paid Apify plans have no per-run limit, so your usual result settings apply.

### Flight data with AI agents (MCP)

Connect this Actor to an AI agent through [Apify MCP](https://mcp.apify.com) and ask in plain language:

> Find the cheapest non-stop flight from San Francisco to Seattle three weeks from today and tell me the airline and time.

Agent checklist:

1. Set `origin`, `destination` and `departureDate` (relative dates such as `+21 days` work).
2. Add `returnDate` only for round trips.
3. Use `maxStops: 0` for non-stop requests.
4. Read rows with `get-dataset-items` and sort by `price`.

### API example

```bash
curl -X POST "https://api.apify.com/v2/acts/khadinakbar~google-flights-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"origin": "SFO", "destination": "SEA", "departureDate": "+21 days", "maxStops": 0, "maxResults": 10}'
```

### Related travel tools from the same developer

| Your next step | Use | Why |
|---|---|---|
| When you compare booking-site prices and bag fees | [Kayak Flights Scraper](https://apify.com/khadinakbar/kayak-flights-scraper) | Booking options with baggage costs |
| When you look for award seats | [Flight Award Availability Scraper](https://apify.com/khadinakbar/flight-award-availability-scraper) | Points availability on routes |
| When you then price a hotel for the trip | [Booking Scraper PRO](https://apify.com/khadinakbar/booking-scraper-pro) | Hotel prices and review scores |

### Best results

| Starting situation | Helpful action | Expected outcome |
|---|---|---|
| Regular tracking | Use relative dates such as `+30 days` | A schedule that never goes stale |
| A local market | Set `currency` and `country` together | Prices as locals see them |
| Non-stop only | Set `maxStops` to 0 | Direct flights only |
| Premium cabins | Set `cabinClass` | Business or first fares |

### Builder's note

I found that people comparing flights look at stops, layover length and aircraft as much as price, so every row carries full segment and layover detail. I learned that saved searches with fixed dates go stale, so relative dates such as `+30 days` are accepted everywhere a date is.

### FAQ

#### Do I need a Google account?

No. The Actor reads public Google Flights results.

#### Why is `return` empty on round trips?

Google Flights shows the round-trip price with the outbound flight first and lists return flights on a separate screen. The `price` covers the whole round trip.

#### Does it return booking links?

It returns Google Flights links, and airline or travel-agency offers stay on Google Flights. Every row links to the Google Flights search (`googleFlightsUrl`). When Google returns a booking-options page for an itinerary, mostly on one-way searches, its link is in `bookingUrl`; otherwise that field is `null`.

#### Which airport codes work?

IATA airport codes such as `JFK`, `LHR` or `NRT`.

#### Can I get prices in my currency?

Yes. Set `currency` (for example `EUR`, `GBP`, `JPY`) and the matching `country`.

#### What do the carbon fields mean?

`carbonKg` is Google's emissions estimate for the itinerary, and `carbonVsTypical` compares it with a typical flight on the route.

### Responsible use

This Actor collects publicly visible Google Flights results. Use the data for fare research and travel planning, and follow Google's terms and the laws that apply to you. Read Apify's guide on [whether web scraping is legal](https://blog.apify.com/is-web-scraping-legal/) for more context. Google is a trademark of Google LLC. This independent Actor is not affiliated with, associated with, or endorsed by Google. For questions or bugs, open a ticket in the Issues tab.

# Changelog

This Actor's version history is a separate document: https://apify.com/khadinakbar/google-flights-scraper/changelog.md

# Actor input Schema

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

3-letter IATA airport code for departure (e.g., 'LAX', 'JFK', 'LHR'). Required. Use ALL CAPS. NOT a city name — for Tokyo, use 'HND' or 'NRT' explicitly; for London, use 'LHR'.

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

3-letter IATA airport code for arrival (e.g., 'JFK', 'CDG', 'HND'). Required. Use ALL CAPS. NOT a city name. For multi-airport cities, pick the specific airport you want results for.

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

Outbound departure date: YYYY-MM-DD (e.g., '2026-12-15') or a relative offset from today such as '+30 days'. Required. Must be today or later. Date only, no time.

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

Return date for round-trip searches: YYYY-MM-DD or a relative offset from today such as '+37 days'. Leave empty for one-way. Must be on or after departureDate.

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

Number of adult passengers (age 12+). Default: 1. Min 1, max 9. Most airlines cap total passengers per booking at 9.

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

Number of child passengers (age 2-11). Default: 0. Max 8. Children require an adult companion on most carriers.

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

Number of infants (under 2) with their own seat. Default: 0. Max 8. NOT 'lap infants' — those go in the infantsOnLap field.

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

Number of lap-held infants (under 2, no seat). Default: 0. Max equals number of adults — one lap infant per adult. NOT 'infants with their own seat' — those go in infantsInSeat.

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

Cabin class to search. Default 'economy'. Premium economy and business are not available on every route. NOT a price filter — for max-price use 'maxPrice' field.

## `maxStops` (type: `integer`):

Filter by maximum number of stops. 0=nonstop only, 1=up to one stop, 2=up to two stops. Leave empty for no limit. Applied to each leg of round-trips.

## `includeAirlines` (type: `array`):

Keep only itineraries flown by these airlines. Use 2-letter IATA airline codes (e.g. 'UA', 'DL', 'BA') or an alliance: 'STAR_ALLIANCE', 'SKYTEAM', 'ONEWORLD'. Leave empty for all airlines. Cannot be combined with 'Exclude airlines'.

## `excludeAirlines` (type: `array`):

Remove itineraries flown by these airlines. Same codes as 'Only these airlines'. Leave empty to keep all airlines.

## `maxPrice` (type: `integer`):

Only return itineraries at or below this total price, in the selected currency. Leave empty for no price limit.

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

ISO 4217 currency code for prices (e.g., 'USD', 'EUR', 'GBP', 'JPY'). Default 'USD'. Google Flights converts at its own rate. NOT the country of search — that is the 'country' field.

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

Two-letter ISO country code for Google's search market (e.g., 'us', 'uk', 'de', 'jp'). Default 'us'. Affects which airlines and prices Google shows. NOT the currency — for currency use 'currency'.

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

Two-letter ISO 639-1 language code for response (e.g., 'en', 'es', 'fr', 'de', 'ja'). Default 'en'. Affects airline/airport name strings only — prices and codes are unchanged.

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

Maximum number of flight itineraries to return per run. Default 50, max 200. Lower numbers run faster and cost less (PPE is .005 per flight). Free Apify plan runs return up to 50 results per run.

## Actor input object example

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "+30 days",
  "returnDate": "+37 days",
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "economy",
  "includeAirlines": [],
  "excludeAirlines": [],
  "currency": "USD",
  "country": "us",
  "language": "en",
  "maxResults": 50
}
```

# Actor output Schema

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

No description

## `csv` (type: `string`):

No description

# 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": "LAX",
    "destination": "JFK",
    "departureDate": "+30 days"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/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": "LAX",
    "destination": "JFK",
    "departureDate": "+30 days",
}

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

```

## MCP server setup

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