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

Scrape Google Flights: itineraries with price, airlines, legs, stops, duration and emissions for any route and dates; a cheapest-fare date grid; return-leg and booking options (which airline or OTA sells it, at what price); airport code lookup. No proxies needed.

- **URL**: https://apify.com/scrapercompany/google-flights-scraper.md
- **Developed by:** [ScraperCompany](https://apify.com/scrapercompany) (community)
- **Categories:** Travel
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 flights requests

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

Google Flights Scraper returns Google Flights results as structured data. **Flight search** lists itineraries for a route and dates with total price, airlines, every leg with times and aircraft, stops, layovers, duration and CO2 emissions, plus Google's price insights. **Price calendar** finds the cheapest fare for each date around your target dates. **Return options** and **Booking options** follow Google's tokens to the next leg and to the list of sellers (airline and OTAs) with their prices. It supports the filters you know from Google Flights: stops, airlines, alliances, bags, times, layovers and price caps.

Proxies, retries and anti-bot handling are built in, so you don't need your own proxies or an API key. Start a run, get structured JSON.

### What can this scraper do?

- **Itineraries** for one-way, round-trip and multi-city trips: price, airlines, legs, stops, layovers, duration, emissions.
- **Price insights**: price level, typical range and history.
- **Date grid**: cheapest fare per departure/return date in a window up to +/-30 days.
- **Booking options**: which airline or OTA sells an itinerary and at what price.
- Filters: **stops, airlines and alliances, bags, cabin, time windows, layovers, connecting airports, max price, max duration**, basic economy, lower emissions.
- **Airport/city lookup** to IATA codes. Batch many routes per run.

#### Modes

| Mode | What it returns | Price per request |
| --- | --- | --- |
| `search` | Itineraries for a route and dates: price, airlines, legs, stops, duration, emissions | $0.005 |
| `calendar` | Cheapest fare for each date around your target dates | $0.008 |
| `return` | Options for the next leg of a round trip or multi-city trip, from a departure_token | $0.005 |
| `booking` | Where to book an itinerary (airline and OTAs) with each seller's price, from a booking_token | $0.005 |
| `locations` | IATA airport and city codes for a place name | $0.002 |

### What data can you extract?

| Field | Description |
| --- | --- |
| `itineraries[].price / display_price / currency` | Total fare |
| `itineraries[].legs` | Each flight: airline, flight number, airports, times, aircraft, duration |
| `itineraries[].total_stops / total_duration_minutes / is_direct` | Trip shape |
| `itineraries[].carbon_emissions_kg / carbon_emissions_comparison` | Emissions vs typical |
| `itineraries[].departure_token / booking_token` | Tokens for Return options and Booking options |
| `price_insights` | Lowest price, price level, typical range, price history |
| `prices[] (Price calendar)` | Cheapest fare per date pair |
| `booking_options[] (Booking options)` | Sellers with price and booking link |
| `locations[] (Airport lookup)` | Airports and cities with IATA codes |

Every dataset item also carries `input` (the exact request that was sent), `request_id` (quote it to support), `billed` and `scraped_at`.

### How to use Google Flights Scraper

1. Open Google Flights Scraper in Apify Console and go to the **Input** tab.
2. Enter routes as `JFK-LAX` and dates (exact or relative, such as `30 days`). Leave the return date empty for one-way.
3. Adjust the options if needed. Dates accept an exact date (`2026-12-01`) or a relative one (`30 days` from today), so saved tasks and schedules never go stale.
4. Click **Start** and wait for the run to finish.
5. Download the results from the **Output** tab as JSON, CSV, Excel or HTML, or fetch them with the Apify API.

### Input example

This is the default input; running the Actor without changes uses it.

```json
{
  "mode": "search",
  "routes": [
    "JFK-LAX"
  ],
  "departure_date": "30 days",
  "return_date": "35 days",
  "places": [
    "paris"
  ],
  "includeErrors": true,
  "maxConcurrency": 3,
  "maxRetries": 2
}
```

### Output example

One dataset item per request (trimmed here; real items contain every field the API returns):

```json
{
  "mode": "search",
  "endpoint": "/v1/serp/google_flights",
  "input": {
    "departure": "YUL",
    "arrival": "CDG",
    "departure_date": "2026-11-04",
    "return_date": "2026-11-11"
  },
  "adults": 1,
  "arrival_airport": "CDG",
  "best_count": 3,
  "cheapest_price": 527,
  "currency": "USD",
  "departure_airport": "YUL",
  "departure_date": "2026-11-04",
  "elapsed_s": 0.942,
  "google_flights_url": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTExLTA0agcIARIDWVVMcgcIARIDQ0RHGh4SCjIwMjYtMTEtMTFqBwgBEgNDREdyBwgBEgNZVUxAAUgBcAGCAQsI____...",
  "itineraries": [
    {
      "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AC.png",
      "carbon_emissions": {
        "difference_percent": -19,
        "this_flight": 325000,
        "typical_for_this_route": 399000
      },
      "carbon_emissions_comparison": "19% lower than typical",
      "carbon_emissions_kg": 325,
      "carry_on_bags_included": 1,
      "currency": "USD",
      "departure_token": "gf1.eNqFUMkKwjAU_Jd3TiGpVqU3TVuhBO1iIhpyEhe09NJWBfHfTRexxS2BlxneMvNygzPYBMEObJkWSYKqQOpHKo0kQbi8Cr3yn4IsD6w4A12rVMmBOtOGVSW4VQ4mNgcGwQax4Dmg7u5k6hF1x5hqPhr2Q...",
      "display_price": "$527",
      "google_flights_url": "https://www.google.com/travel/flights/search?tfs=CBwQAho_EgoyMDI2LTExLTA0Ih8KA1lVTBIKMjAyNi0xMS0wNBoDQ0RHKgJBQzIDODc0agc...",
      "group": "best",
      "is_direct": true,
      "legs": [
        {
          "arrival_airport": "CDG",
          "arrival_time": "2026-11-05T07:20:00",
          "departure_airport": "YUL",
          "departure_time": "2026-11-04T18:10:00",
          "duration_minutes": 430,
          "is_direct": true,
          "stops": 0
        }
      ],
      "price": 527,
      "price_exact": 526.19,
      "total_duration_minutes": 430,
      "total_stops": 0,
      "trip_type": "round_trip"
    }
  ],
  "itinerary_count": 69,
  "leg_index": 0,
  "legs_total": 2,
  "price_insights": {
    "lowest_price": 527,
    "price_history": [
      [
        1790568000
      ]
    ],
    "price_level": "typical",
    "typical_price_range": [
      475
    ]
  },
  "return_date": "2026-11-11",
  "source": "rpc",
  "trip_type": "round_trip",
  "wire_bytes": 330950,
  "request_id": "req_3f9c0d6e2b8a4c1f9e7d5b3a1c0e8f6d",
  "billed": true,
  "scraped_at": "2026-10-01T14:03:27.512Z"
}
```

A request that fails is saved with an `error` message instead (turn off **Include failed requests** to skip those). Failed requests are never charged.

### How much does it cost?

This Actor uses **pay-per-event** pricing: you pay for successful API requests, not for compute time.

| Event | Charged when | Price | Per 1,000 |
| --- | --- | --- | --- |
| `flights-request` | One flight search, return-leg lookup or booking-options lookup. Searches with no itineraries are free. | $0.005 | $5.00 |
| `calendar-request` | One route priced over a window of departure (and return) dates. | $0.008 | $8.00 |
| `location-search` | One city or airport name resolved to IATA codes. Empty answers are free. | $0.002 | $2.00 |

For example, 1,000 requests in the default mode cost **$5.00**.

- Failed requests (errors, invalid input, blocked upstream after retries) are **free**.
- Requests where the source returns nothing at all (no results, nothing priced) are saved but **not charged**.
- Set **Maximum cost per run** when you start a run and the Actor stops cleanly before going over it.

### FAQ

#### Do I need proxies or an API key?

No. Proxy rotation, retries and anti-bot handling are built in, and the Actor is ready to run as is. You only pay the per-event prices above.

#### How do I get booking links?

Run Flight search, take an itinerary's `booking_token` (one-way) or follow its `departure_token` through Return options for round trips, then run Booking options with that token.

#### Are prices final?

They are the prices Google Flights shows at the time of the request, in the selected currency, including the bags you asked for. Airlines can change fares at any time.

#### Does Google have a Flights API?

No. Google shut down its QPX Express flight API in 2018. This Actor returns the public Google Flights results as structured data.

#### How do round trips work?

Search with a return date. Each outbound itinerary carries a departure_token: run the Return / next-leg options mode with it to get the matching return flights, then the Booking options mode with the complete trip's booking_token for sellers and fares.

#### Can I find the cheapest day to fly?

Yes. The Price calendar (date grid) mode returns the lowest fare for each departure date around the date you choose, in one request.

#### Is it legal to scrape this data?

The Actor collects publicly available information that anyone can see without logging in. You are responsible for how you use the results: respect the source site's terms, copyright and privacy law (such as GDPR) and do not collect personal data without a lawful basis. If in doubt, ask a lawyer.

#### What happens when a request is blocked or rate-limited?

Rate limits (HTTP 429) and temporary errors (5xx) are retried automatically with exponential backoff, respecting `Retry-After`. If a request still fails it is saved with the error message and not charged, and the rest of the batch keeps going. A run only fails when every request failed.

#### Why did a request return an error?

Read the `error` field: validation problems (for example a malformed date or an unknown id) are reported exactly as the API sees them. Fix the input and run again; failed requests cost nothing.

#### How many requests can I run at once?

Any number per run. The Actor sends up to 3 requests in parallel by default (change it under **Run options**); larger batches simply take longer.

### Use it from your code

Call the Actor from any language through the [Apify API](https://docs.apify.com/api/v2). With the JavaScript client (`npm install apify-client`):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scrapercompany/google-flights-scraper').call({
    "mode": "search",
    "routes": [
        "JFK-LAX"
    ],
    "departure_date": "30 days"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

With Python (`pip install apify-client`):

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("scrapercompany/google-flights-scraper").call(run_input={
    "mode": "search",
    "routes": ["JFK-LAX"],
    "departure_date": "30 days",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also schedule runs, chain them with webhooks, or connect them to Make, Zapier, n8n, Google Sheets and other integrations from the **Integrations** tab.

### Related scrapers

- [Google Hotels Search Scraper](https://apify.com/scrapercompany/google-hotels-search-scraper)
- [Airbnb Search Scraper](https://apify.com/scrapercompany/airbnb-search-scraper)

### Support

Questions, a field you need, or a site that stopped working? Open an issue on the **Issues** tab. Include the `request_id` from the dataset item so we can trace the request.

# Changelog

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

# Actor input Schema

## `mode` (type: `string`):

Start with <b>Flight search</b>. Its itineraries carry a <code>departure_token</code> (round trips: use it in <b>Return options</b>) or a <code>booking_token</code> (use it in <b>Booking options</b> to see where to buy).

## `routes` (type: `array`):

One route per line as <code>DEPARTURE-ARRIVAL</code> IATA codes: airports (<code>JFK-LAX</code>), cities (<code>NYC-LON</code>) or several airports (<code>JFK,EWR-LAX</code>). Used by Flight search and Price calendar.

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

Outbound date: exact (<code>2026-12-01</code>) or relative (<code>30 days</code> from today). For Price calendar it is the centre of the date grid.

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

Leave empty for one-way. Exact or relative (<code>35 days</code> from today).

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

Adult passengers (12+), 1-9.

## `cabin_class` (type: `string`):

Cabin to search.

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

Currency for prices.

## `sort_by` (type: `string`):

Result order. Anything other than Top flights returns Google's full list.

## `stops` (type: `integer`):

0 = nonstop only, 1 = at most one stop, 2 = at most two. Leave empty for any.

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

Children aged 2-11.

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

Infants under 2 with their own seat.

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

Lap infants under 2 (at most one per adult).

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

Carry-on bags per passenger to include in the price (0-1).

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

Checked bags per passenger to include in the price (0-2).

## `include_airlines` (type: `string`):

Comma-separated IATA airline codes or alliances (<code>STAR_ALLIANCE</code>, <code>SKYTEAM</code>, <code>ONEWORLD</code>), e.g. <code>AC,UA</code>. Not with Exclude airlines.

## `exclude_airlines` (type: `string`):

Comma-separated airline codes to drop, e.g. <code>B6</code>.

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

Only itineraries at or below this price, in the selected currency.

## `max_duration` (type: `integer`):

Maximum door-to-door time per leg, in minutes.

## `outbound_times` (type: `string`):

Departure hours <code>from,to</code> (0-23), optionally followed by arrival hours: <code>6,12</code> leaves 06:00-12:59.

## `return_times` (type: `string`):

Same format as the outbound window, for the return leg.

## `layover_duration` (type: `string`):

<code>min,max</code> minutes, e.g. <code>60,240</code>.

## `connecting_airports` (type: `string`):

Comma-separated IATA codes, e.g. <code>ORD,DTW</code>.

## `exclude_connecting_airports` (type: `string`):

Comma-separated IATA codes.

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

Hide basic-economy fares (US routes).

## `less_emissions` (type: `boolean`):

Only flights with lower-than-typical emissions.

## `date_window_days` (type: `integer`):

Days before and after the target dates to include in the grid (1-30).

## `tokens` (type: `array`):

A <code>departure_token</code> (Return options) or <code>booking_token</code> (Booking options) per line, copied from a Flight search result. Tokens start with <code>gf1.</code>.

## `places` (type: `array`):

City, airport or region names to resolve to IATA codes, e.g. <code>paris</code>, <code>Heathrow</code>.

## `gl` (type: `string`):

Two-letter market code.

## `hl` (type: `string`):

Language code for results, e.g. <code>en</code>.

## `customRequests` (type: `array`):

Optional list of JSON objects, one request each, using the API field names shown above. Each object is merged over the options above, so you only need to give what differs. Use this for multi-city trips (<code>multi_city</code>) or <code>departure_id</code>/<code>arrival_id</code> with Google city ids. Example: <code>{"departure":"YUL","arrival":"PAR","departure_date":"2026-12-15","multi_city":\[{"departure":"CDG","arrival":"FCO","date":"2026-12-20"},{"departure":"FCO","arrival":"YUL","date":"2026-12-27"}]}</code>

## `includeErrors` (type: `boolean`):

When on, a request that fails (for example an unknown property id) is saved as a dataset item with an <code>error</code> message so you can see what went wrong. Failed requests are never charged.

## `maxConcurrency` (type: `integer`):

How many API requests run at the same time.

## `maxRetries` (type: `integer`):

Retries for rate limits (HTTP 429), temporary server errors (5xx) and network errors, with exponential backoff. Validation errors are never retried.

## Actor input object example

```json
{
  "mode": "search",
  "routes": [
    "JFK-LAX"
  ],
  "departure_date": "30 days",
  "return_date": "35 days",
  "adults": 1,
  "cabin_class": "economy",
  "currency": "USD",
  "sort_by": "top_flights",
  "children": 0,
  "infants_in_seat": 0,
  "infants_on_lap": 0,
  "carry_on_bags": 0,
  "checked_bags": 0,
  "exclude_basic_economy": false,
  "less_emissions": false,
  "date_window_days": 7,
  "places": [
    "paris"
  ],
  "gl": "us",
  "hl": "en",
  "includeErrors": true,
  "maxConcurrency": 3,
  "maxRetries": 2
}
```

# Actor output Schema

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

One dataset item per request.

## `summary` (type: `string`):

Counts of succeeded, failed, skipped and charged requests.

# 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 = {
    "routes": [
        "JFK-LAX"
    ],
    "departure_date": "30 days",
    "return_date": "35 days",
    "places": [
        "paris"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapercompany/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 = {
    "routes": ["JFK-LAX"],
    "departure_date": "30 days",
    "return_date": "35 days",
    "places": ["paris"],
}

# Run the Actor and wait for it to finish
run = client.actor("scrapercompany/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 '{
  "routes": [
    "JFK-LAX"
  ],
  "departure_date": "30 days",
  "return_date": "35 days",
  "places": [
    "paris"
  ]
}' |
apify call scrapercompany/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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