# Google Flights Scraper API: Airfare, Prices & Price History (`johnveds15/google-flights-fares`) Actor

Google Flights API for any route and dates: flight prices, airlines, times, duration, stops, every segment (flight number, aircraft, legroom), layovers, CO2, plus Google's lowest price and ~60-day price history for fare tracking. No browser, no login. $0.20 per 1,000 flights.

- **URL**: https://apify.com/johnveds15/google-flights-fares.md
- **Developed by:** [John Vedovino II](https://apify.com/johnveds15) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 flight itineraries

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 — fares, segments, price history

**Google Flights results for any route and dates — price, airlines, times, duration, stops, every segment with flight number, aircraft and legroom, layovers, CO2 — plus Google's own lowest price and its ~60-day daily price history for each search.** One plain HTTP request per search. No browser, no login, no API key. $0.20 per 1,000 itineraries.

### Why it is cheap and fast

A Google Flights search page carries its results as structured JSON inside the page. This Actor builds the search URL directly (the `tfs` query parameter), fetches it once and reads that JSON — it does not launch a headless browser or click through the UI. A search takes about 2–3 seconds, and the Actor's compute cost is a fraction of a browser-based scraper's.

### What you get

| Field | Notes |
|---|---|
| `price` | Total for all passengers in your currency. For a round trip it is Google's **round-trip** total for that outbound option. |
| `isBest`, `rank` | Google's "Best" group and the row's position in its list. |
| `airlines`, `departure`, `arrival`, `durationMinutes`, `stops` | Local times, `YYYY-MM-DDTHH:MM`. |
| `segments[]` | Each leg: `flightNumber` (e.g. `B61023`), `aircraft`, `legroom`, `from`/`to`, times, minutes, `co2Grams`. |
| `layovers[]` | Airport, city, minutes on the ground. |
| `co2Grams` vs `co2TypicalGrams` | Google's emissions estimate for the itinerary and for a typical flight on the route. |
| **insight row** (`type: "insight"`) | One per search: `lowestPrice`, `cheapestListed`, `flightsListed`, and `priceHistory` — ~60 daily `{date, price}` points. This is the input for a price-drop alert. |

### A real record

From a live run on 2026-10-04 (JFK → LAX, nonstop only):

```json
{
  "type": "flight",
  "origin": "JFK", "destination": "LAX",
  "departureDate": "2026-11-03", "returnDate": null, "tripType": "one-way",
  "cabin": "economy", "adults": 1, "currency": "USD",
  "rank": 1, "price": 204, "isBest": true,
  "airlines": ["JetBlue"], "airlineCode": "B6",
  "departure": "2026-11-03T09:15", "arrival": "2026-11-03T12:36",
  "durationMinutes": 381, "stops": 0, "layovers": [],
  "segments": [{"from": "JFK", "to": "LAX", "departure": "2026-11-03T09:15", "arrival": "2026-11-03T12:36",
                "durationMinutes": 381, "airline": "JetBlue", "flightNumber": "B6223",
                "aircraft": "Airbus A320", "legroom": "32 in", "co2Grams": 411426}]
}
```

The same run's insight row: `lowestPrice: 204`, `flightsListed: 29`, and 62 daily price points starting at $174 two months earlier.

### How to use it

- **Price watch:** `routes: ["JFK-LAX"]`, `departureDates: ["+30", "+45", "+60"]`, schedule it daily. `+N` means N days after the run date, so a schedule keeps looking the same distance ahead. Compare each insight row's `lowestPrice` with yesterday's.
- **Fare grid:** several routes × several dates in one run — every route is searched on every date (up to 200 searches a run).
- **Round trips:** `tripLengthDays: 7` returns outbound options priced as a 7-day round trip.
- **n8n / Make / Zapier:** call the Actor's run-sync endpoint and read the dataset; filter `type == "insight"` for alerts, `type == "flight"` for the itineraries.

### Inputs

| Input | Default | Notes |
|---|---|---|
| `routes` | `["JFK-LAX"]` | Two IATA codes per line: `EWR-LHR`. |
| `departureDates` | `+30` | `YYYY-MM-DD` or `+N` days from today. Past dates are skipped. |
| `tripLengthDays` | `0` | 0 = one-way; N = round trip returning N days later. |
| `cabin` | economy | economy · premium-economy · business · first |
| `adults`, `children` | 1, 0 | |
| `maxStops` | any | any · 0 (nonstop) · 1 · 2 |
| `currency` | USD | Any currency Google Flights supports. |
| `maxResultsPerSearch` | 50 | Caps rows and cost per route × date. |
| `includePriceInsights` | true | The insight row per search. |
| `proxyConfiguration` | off | Only if the log reports `blocked`. |

### Pricing (pay per event)

| Event | Price |
|---|---|
| Flight itinerary | $0.0002 each — **$0.20 per 1,000** |
| Price insight | $0.0002 per successful search |

No start fee. Searches that fail or are blocked are not charged. Example: 10 routes × 3 dates with 50 itineraries each = 1,500 rows + 30 insights = **$0.31**. The default input (one route, one date) costs about one cent.

### Limits, stated plainly

- Google can change its page layout without notice. Every field is read defensively (a layout change yields `null`, not a crash), and the Actor is tested against a pinned fixture of the live response; if Google moves things, fields go null until it is updated.
- Searches are paced at ≥ 2 seconds apart and that is not configurable — it keeps runs from tripping Google's rate wall.
- Return-leg options for a round trip are a second, outbound-specific page on Google Flights; this Actor returns the outbound options with their round-trip price.
- Prices are what Google Flights displays for the given locale and currency at run time; book on the airline or agent site Google links to.

### More Actors by johnveds15

Same pay-per-result pricing, same JSON/CSV output, no login needed:

- [SEC Form D funding rounds](https://apify.com/johnveds15/sec-form-d-funding-rounds)
- [FMCSA new trucking carrier leads](https://apify.com/johnveds15/fmcsa-new-carrier-leads)
- [US building permit leads, 6 cities](https://apify.com/johnveds15/us-building-permit-leads)
- [Competitor ad library scraper (Google Ads + LinkedIn)](https://apify.com/johnveds15/ad-library-competitor-ads)

# Actor input Schema

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

One per line, as two IATA airport codes: JFK-LAX, EWR-LHR. Every route is searched on every departure date.

## `departureDates` (type: `array`):

YYYY-MM-DD, or +N for N days from the run date (+30 = a month out; handy for scheduled price watches). Empty = +30.

## `tripLengthDays` (type: `integer`):

0 searches one-way. N > 0 searches a round trip returning N days after departure; each row is an outbound option and its price is Google's ROUND-TRIP total.

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

Seating class Google prices.

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

Passengers aged 12+. Prices are totals for everyone.

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

Passengers aged 2-11.

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

Most stops allowed per itinerary (applied in the Google query itself).

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

ISO code Google prices in: USD, EUR, GBP, CAD, ...

## `maxResultsPerSearch` (type: `integer`):

Google lists roughly 10-100 itineraries per search, 'best' ones first. This caps rows (and cost) per route x date.

## `includePriceInsights` (type: `boolean`):

One extra row per search (type=insight) with Google's lowest price and its ~60-day daily price history for the route. The input for a price-drop alert.

## `proxyConfiguration` (type: `object`):

Off by default — searches are paced at >=2 s and run without one. Turn it on only if the run log reports 'blocked'.

## Actor input object example

```json
{
  "routes": [
    "JFK-LAX"
  ],
  "departureDates": [
    "+30"
  ],
  "tripLengthDays": 0,
  "cabin": "economy",
  "adults": 1,
  "children": 0,
  "maxStops": "any",
  "currency": "USD",
  "maxResultsPerSearch": 50,
  "includePriceInsights": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `flights` (type: `string`):

type=flight rows: price, airlines, departure/arrival, duration, stops, layovers, segments, CO2; plus type=insight rows with the lowest price and daily price history per search.

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

searches, outcomes (ok / no-results / blocked / error), rows pushed and the pay-per-event counts charged 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 = {
    "routes": [
        "JFK-LAX"
    ],
    "departureDates": [
        "+30"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("johnveds15/google-flights-fares").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"],
    "departureDates": ["+30"],
}

# Run the Actor and wait for it to finish
run = client.actor("johnveds15/google-flights-fares").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"
  ],
  "departureDates": [
    "+30"
  ]
}' |
apify call johnveds15/google-flights-fares --silent --output-dataset

```

## MCP server setup

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

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/9B5HQxNtlzMaSY0g3/builds/RLAFnqZ92ajOv03kH/openapi.json
