# Google Flights Scraper & MCP \[💰$1.50/1K] | Fares | Alerts (`ahmed_jasarevic/google-flights-scraper`) Actor

Scrape live Google Flights fares by route and date as clean JSON — airline, price, stops, duration, layovers and CO₂. Batch routes, filter by cabin and stops, monitor fares for price drops with webhooks, or call it from AI agents as a built-in MCP server.

- **URL**: https://apify.com/ahmed_jasarevic/google-flights-scraper.md
- **Developed by:** [Ahmed Jasarevic](https://apify.com/ahmed_jasarevic) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 & MCP Server — Live Fares, Price Alerts & No Browser

Scrape **Google Flights** fares, airlines, stops, times, durations and CO₂ estimates for any route and date — as clean, structured JSON rows ready for dashboards, price alerts and AI agents. This Actor reads the same result set the site renders by sending Google Flights' own `tfs` query over **plain HTTP**: no browser, no headless Chrome, no Playwright. One request per route, a few seconds per run.

Google retired the public Google Flights API (QPX Express) in 2018 and never replaced it. This Actor is a working alternative: it reads the full itinerary list from `google.com/travel/flights` (including Google's own "best flights" ranking) and adds a built-in **fare monitor** mode that emits a row only when a price actually changes. It also runs as a **Standby MCP server**, so AI agents (Claude, Cursor, n8n AI nodes) can call `search_flights`, `watch_route` and `price_history` as tools.

### Google Flights Fares For Fare Monitoring, Price Alerts & Travel Apps

- **Airfare price monitoring** — re-check routes on a schedule and emit a row only when the cheapest fare moves
- **Flight price alerts** — POST every drop or rise to a webhook so n8n, Make or Zapier can notify you
- **Google Flights API alternative** — structured fares without an API key, a Google account or a retired travel API
- **Travel price comparison and route research** — one request per route, batch many routes and dates in a single run
- **Building a flight-price dataset** — one row per itinerary with airline, stops, times, duration and CO₂ estimate
- **AI agent and LLM flight search** — a hosted MCP server exposes the fares as tools an agent can call

### How It Works

![How the Google Flights Scraper works: route queries become live itinerary rows with fares, segments and emissions.](https://api.apify.com/v2/key-value-stores/oeuA0kLOyhbRM4fzt/records/how-it-works-google-flights.webp)

The Actor encodes each route, date and filter set into Google Flights' own tfs protobuf, fetches the result page once with undici and parses the embedded ds:1 result data. Monitor mode re-checks routes and emits fare changes.

Each itinerary row includes price, currency, airline, stops, duration, departure and arrival times, segments and emissions. Use it to compare live fares or trigger alerts when a route moves.

1. Your search (route, dates, passengers, cabin, filters) is encoded into Google Flights' own `tfs` query parameter — the base64 protobuf the web app itself uses.
2. The fetched page embeds the complete result set in a `ds:1` data script; the Actor parses it into flat rows (Google's `best` and `other` ranking groups, deduplicated).
3. Everything runs on `undici` with a single GET per route — no browser binaries, low memory, a few seconds per search.

### Input Parameters

| Field | Type | Required | Default | Notes |
| --- | --- | --- | --- | --- |
| `mode` | string (select) | No | `search` | `search` = one-off fare search. `monitor` = re-check routes, diff the cheapest fare and emit changes (plus optional webhook). In `monitor` with no routes set, the MCP watchlist is used. |
| `routes` | array | No | — | One or more searches, each `{ origin, destination, departureDate, returnDate? }`. Takes priority over the single origin/destination fields below. |
| `origin` | string | No | `ZAG` (prefill) | 3-letter IATA code, used when `routes` is empty. |
| `destination` | string | No | `LHR` (prefill) | 3-letter IATA code, used when `routes` is empty. |
| `departureDate` | string | No | — | `YYYY-MM-DD`, used when `routes` is empty. |
| `returnDate` | string | No | — | `YYYY-MM-DD`. Set for round-trip fares. |
| `cabinClass` | string (select) | No | `economy` | `economy`, `premium-economy`, `business`, `first`. |
| `adults` | integer | No | `1` | Adult passengers (total passengers 1–9). |
| `children` | integer | No | `0` | Children aged 2–11. |
| `infantsInSeat` | integer | No | `0` | Infants under 2 with their own seat. |
| `infantsOnLap` | integer | No | `0` | Infants under 2 on a lap (one adult each). |
| `currency` | string | No | `USD` | ISO 4217 code — Google converts fares into this currency (`USD`, `EUR`, `GBP`, `BAM`, …). |
| `language` | string | No | `en` | Google UI language (`hl`), e.g. `en`, `de`, `hr`. |
| `maxStops` | integer | No | — | Maximum stops per itinerary. `0` = non-stop only. Leave empty for any number of stops. |
| `maxPrice` | integer | No | — | Only return itineraries up to this price in the selected currency. |
| `carryOnBags` | integer | No | `0` | Include estimated bag fees for this many carry-on bags in the fare. |
| `checkedBags` | integer | No | `0` | Include estimated bag fees for this many checked bags in the fare. |
| `earliestDepartureHour` | integer | No | — | Local airport time 0–23. Leave empty for no restriction. |
| `latestDepartureHour` | integer | No | — | Local airport time 0–23. Leave empty for no restriction. |
| `lessEmissionsOnly` | boolean | No | `false` | Only itineraries with lower CO₂ than typical for the route. |
| `hideSeparateAndSelfTransfer` | boolean | No | `false` | Hide tickets split across airlines that need a self-transfer or separate bookings. |
| `excludeBasicEconomy` | boolean | No | `false` | Exclude basic economy fares (usually no checked bag and no seat selection). |
| `maxResultsPerRoute` | integer | No | `50` | Cap on dataset rows pushed per route (1–1000). Google typically returns 50–150 itineraries per route. |
| `includeUnpriced` | boolean | No | `true` | Keep itineraries Google lists without a bookable fare (`price: null`) or drop them. |
| `cacheTtlSeconds` | integer | No | `900` | Reuse an identical search result from the last N seconds instead of hitting Google again. Makes repeated monitor runs cheap. `0` disables the cache. |
| `onlyChanges` | boolean | No | `true` | `monitor` mode only — push a record only when the cheapest price changed (or on the first check). Disable to push a snapshot every run. |
| `webhookUrl` | string | No | — | `monitor` mode only — POST a small JSON payload (route, event, previous price, current price, delta) here on every price drop or rise. |
| `proxyConfiguration` | object | No | Apify Proxy (auto) | On the Apify platform a proxy is applied automatically when this is left empty — Google answers bare datacenter IPs with an error. Datacenter is fine for light use; switch the group to RESIDENTIAL for heavy or scheduled monitoring. |

### Output Fields

One row per flight itinerary in `search` mode, or one row per fare-change event in `monitor` mode, in the run's default dataset.

| Field | Description |
| --- | --- |
| `routeId` | Stable key like `ZAG-LHR-2026-11-20` (or `ZAG-LHR-2026-11-20_2026-11-27` for round-trips). |
| `rank` | 1-based position in Google's combined result list. Search mode. |
| `section` | Google's ranking group: `best` or `other`. Search mode. |
| `isCheapest` | `true` for the lowest-priced itinerary in the result set. Search mode. |
| `origin`, `destination` | Route airport IATA codes. |
| `departureDate`, `returnDate` | Travel dates (`returnDate` is `null` for one-way). |
| `tripType` | `one-way` or `round-trip`. |
| `cabinClass` | Cabin searched. |
| `price`, `currency` | Total fare per passenger in the selected currency; `null` when Google lists no bookable price. Search mode. |
| `type` | Marketing carrier IATA code (e.g. `KL`, `LH`) or `multi` for mixed-airline itineraries. |
| `airlines` | Airline display names. |
| `stops` | Number of stops. |
| `durationMinutes` | Total duration, gate to gate, including layovers. |
| `layoverMinutes` | Total layover time in minutes. |
| `departure`, `arrival` | Objects with `airport`, `airportName`, `date` and local `time` of the first departure / final arrival. |
| `segments` | Every leg: airports, date/time, duration, plane type, carrier code, carrier name and flight number. |
| `emissionsGrams`, `typicalEmissionsGrams` | Estimated CO₂ for this itinerary vs typical for the route. |
| `event` | Monitor mode: `first_seen`, `price_drop`, `price_rise`, `unchanged` or `no_prices`. |
| `previousPrice`, `currentPrice`, `priceDelta`, `priceDeltaPct` | Monitor mode: cheapest fare before and now, and the change in absolute and percentage terms. |
| `sourceUrl` | The Google Flights URL (`tfs` query) that produced this row. |
| `scrapedAt` | ISO 8601 timestamp. |
| `checkedAt` | Monitor mode: ISO 8601 timestamp of the check. |

### Example Input

A single route, search mode:

```json
{
  "origin": "ZAG",
  "destination": "LHR",
  "departureDate": "2026-12-05",
  "currency": "EUR"
}
```

Batch routes with filters:

```json
{
  "routes": [
    { "origin": "ZAG", "destination": "LHR", "departureDate": "2026-12-05" },
    { "origin": "ZAG", "destination": "LHR", "departureDate": "2026-12-12", "returnDate": "2026-12-19" }
  ],
  "cabinClass": "economy",
  "maxStops": 1,
  "earliestDepartureHour": 6,
  "latestDepartureHour": 20,
  "checkedBags": 1,
  "maxResultsPerRoute": 100
}
```

Monitor mode with a webhook:

```json
{
  "mode": "monitor",
  "routes": [{ "origin": "ZAG", "destination": "LHR", "departureDate": "2026-12-05" }],
  "currency": "EUR",
  "cacheTtlSeconds": 600,
  "webhookUrl": "https://your-app.com/hooks/flight-price"
}
```

### Example Output

Search mode — one itinerary row (abridged):

```json
{
  "routeId": "ZAG-LHR-2026-12-05",
  "rank": 1,
  "section": "best",
  "isCheapest": true,
  "origin": "ZAG",
  "destination": "LHR",
  "departureDate": "2026-12-05",
  "returnDate": null,
  "tripType": "one-way",
  "cabinClass": "economy",
  "price": 102,
  "currency": "EUR",
  "type": "KL",
  "airlines": ["KLM", "Air Serbia"],
  "stops": 1,
  "durationMinutes": 305,
  "layoverMinutes": 75,
  "departure": { "airport": "ZAG", "airportName": "Franjo Tuđman Airport", "date": "2026-12-05", "time": "16:35" },
  "arrival": { "airport": "LHR", "airportName": "Heathrow Airport", "date": "2026-12-05", "time": "20:40" },
  "segments": [
    { "fromAirport": "ZAG", "toAirport": "AMS", "departureTime": "16:35", "arrivalTime": "18:40", "durationMinutes": 125, "planeType": "Embraer 190", "flightNumber": "KL 1968" },
    { "fromAirport": "AMS", "toAirport": "LHR", "departureTime": "19:55", "arrivalTime": "20:40", "durationMinutes": 45, "planeType": "Boeing 737", "flightNumber": "KL 1017" }
  ],
  "emissionsGrams": 128000,
  "typicalEmissionsGrams": 141000,
  "sourceUrl": "https://www.google.com/travel/flights?tfs=...&hl=en&curr=EUR",
  "scrapedAt": "2026-10-17T09:12:44.000Z"
}
```

Monitor mode — one fare-change row:

```json
{
  "routeId": "ZAG-LHR-2026-12-05",
  "event": "price_drop",
  "previousPrice": 161,
  "currentPrice": 138,
  "priceDelta": -23,
  "priceDeltaPct": -14.29,
  "currency": "EUR",
  "origin": "ZAG",
  "destination": "LHR",
  "departureDate": "2026-12-05",
  "returnDate": null,
  "tripType": "one-way",
  "cabinClass": "economy",
  "totalResults": 48,
  "pricedResults": 45,
  "checkedAt": "2026-10-17T09:12:44.000Z"
}
```

### Automate Fare Monitoring With Schedules, Webhooks & n8n

- **Schedule the Actor** (Apify scheduler or cron) in `monitor` mode — every 6–12 hours works well for fare tracking. Recurring runs build the price history the `price_history` MCP tool reads.
- **Webhooks** — set `webhookUrl` and the same record is POSTed on every drop or rise, so n8n, Make or Zapier can send an email, Slack or Telegram alert.
- **Apify API** — start runs and pull datasets programmatically with the JavaScript or Python client (`results` in the run's dataset).
- **Export** — download the dataset as JSON, CSV or Excel from the console, or pull it from the Apify dataset API.
- **AI agents** — connect any MCP client to the hosted Standby endpoint (see below).

### Related Actors

- [Google Flights Scraper — Most Comprehensive](https://apify.com/kaix/google-flights-scraper) — one-way, round-trip and multi-city fares with flexible-date and destination search.
- [Google Flights API](https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search) — one-way, round-trip and multi-city flight search with price and airline filters across many languages and countries.
- [Ticketmaster Scraper](https://apify.com/ahmed_jasarevic/ticketmaster-scraper) — event and ticket data for planning the rest of the trip.
- [SeatGeek Scraper](https://apify.com/ahmed_jasarevic/seatgeek-scraper) — concert and sports ticket price data.
- [Eventbrite Pro Event Scraper](https://apify.com/ahmed_jasarevic/eventbrite-pro-event-scraper) — global event and ticket listings.

### Frequently Asked Questions

#### Why use this Actor instead of the official Google Flights API?

There is no official public Google Flights API — Google shut down QPX Express in 2018 and never replaced it. This Actor reads the same public result set the site shows (including Google's own "best flights" ranking), returns it as structured JSON, and adds a fare-monitor mode that only emits rows when a price changes. It runs as plain HTTP (no browser) and needs no API key, no Google account and no OAuth.

#### What are alternatives to Google Flights for programmatic fare data?

Licensed or partner APIs are the usual alternatives: Amadeus and Sabre/Travelport (GDS), Duffel and Kiwi.com (modern aggregators), and Skyscanner or KAYAK (affiliate/meta-search). They give SLAs and negotiating terms but require commercial agreements. Scraping Google Flights is the self-serve route when you want what travelers actually see without a contract. On Apify, other Google Flights Actors exist too (see Related Actors).

#### Can I monitor flight prices and get price-drop alerts automatically?

Yes. Set `mode` to `monitor`, list your routes and schedule the Actor. Each run re-checks the routes, diffs the cheapest fare against the previous check and emits only `price_drop` / `price_rise` records (`first_seen` on the first check). Set `webhookUrl` and the record is POSTed to your endpoint on every change. Price history for each watched route is kept in the Actor's key-value store and read by the `price_history` MCP tool.

#### Does this work without a browser or an API key?

Yes. The Actor encodes the search into Google Flights' own `tfs` query and fetches the page over HTTP with `undici` — no headless Chrome, no Playwright, no browser binaries. There is no API key, login or quota to manage. On the Apify platform a proxy is applied automatically so the first run works.

#### Can AI agents call this Actor (MCP)?

Yes. The Actor runs in Standby mode and exposes a Model Context Protocol endpoint at `POST /mcp` with three tools: `search_flights` (live fare search), `watch_route` (manage the fare watchlist) and `price_history` (recorded cheapest-fare history). Any MCP client can connect with the Actor's standby URL and an Apify API token.

#### How much does it cost?

Pay-per-event: one `result` event per dataset row in search mode ($1.50 per 1,000 rows), one `route-check` per route re-checked in monitor mode ($4 per 1,000 checks), one `search-flight` event per live MCP `search_flights` call ($8 per 1,000 calls) and one `tool-call` per MCP `watch_route` add/remove ($1 per 1,000 calls), plus an Actor-start event scaled by memory. The `cacheTtlSeconds` cache (default 900 s) keeps repeated monitor runs cheap.

### For AI Agents & LLM Apps

Purpose: return priced Google Flights itineraries for a route and date (search mode), or cheapest-fare change events for watched routes (monitor mode), as JSON rows.

Minimal input (search):

```json
{ "origin": "ZAG", "destination": "LHR", "departureDate": "2026-12-05" }
```

Variant — monitor a route with a webhook:

```json
{
  "mode": "monitor",
  "routes": [{ "origin": "ZAG", "destination": "LHR", "departureDate": "2026-12-05" }],
  "webhookUrl": "https://your-app.com/hooks/flight-price"
}
```

MCP tools (Standby endpoint, `POST /mcp`): `search_flights`, `watch_route`, `price_history`.

Output fields (default dataset): `routeId`, `rank`, `section`, `isCheapest`, `origin`, `destination`, `departureDate`, `returnDate`, `tripType`, `cabinClass`, `price`, `currency`, `type`, `airlines`, `stops`, `durationMinutes`, `layoverMinutes`, `departure`, `arrival`, `segments`, `emissionsGrams`, `typicalEmissionsGrams`, `event`, `previousPrice`, `currentPrice`, `priceDelta`, `priceDeltaPct`, `sourceUrl`, `scrapedAt`, `checkedAt`.

Behaviors an agent should know:

- `routes` takes priority over the single `origin`/`destination`/`departureDate` fields when both are set.
- In `search` mode with no routes at all, a demo ZAG → LHR search runs automatically (~45 days out) so the run always returns data.
- In `monitor` mode with no routes, the routes registered on the MCP watchlist are used; if the watchlist is empty the run fails with "No routes to monitor".
- `cacheTtlSeconds` defaults to `900`; set `0` to force a fresh fetch. Monitor runs reuse Google's last result inside that window.
- `maxResultsPerRoute` defaults to `50` (hard cap `1000`); Google usually returns 50–150 itineraries per route.
- In monitor mode `onlyChanges` defaults to `true`: the first check ever for a route is always emitted (`first_seen`); later `unchanged` checks are skipped unless you set `onlyChanges` to `false`.
- Passenger total (`adults` + `children` + `infantsInSeat` + `infantsOnLap`) must be 1–9; each infant on lap needs an adult.
- Round-trip only — set `returnDate`. Multi-city is not supported by the underlying query.
- On the Apify platform a proxy is applied automatically when `proxyConfiguration` is empty.
- The Actor's standby MCP endpoint is `POST /mcp` on the standby URL; `GET /` returns service info and the tool list.

Billing: pay-per-event. Search runs charge one `result` event per row ($1.50 / 1,000); monitor runs charge one `route-check` per route re-checked ($4 / 1,000) even when nothing changed; live MCP `search_flights` charges `search-flight` ($8 / 1,000 calls) and MCP `watch_route` add/remove charges `tool-call` ($1 / 1,000). An Actor-start event is charged based on memory. Budget monitor runs by the number of routes, not by the number of changes.

### Legal & Compliance Disclaimer

This Actor is an independent tool and is not affiliated with, endorsed by or sponsored by Google. It reads only publicly available pages on `google.com/travel/flights` — no login, no account and no access to private data. It does not book, hold or purchase anything; fares are a snapshot at the moment of the check and can change before booking. You are responsible for how you use the data and for complying with Google's Terms of Service and any applicable law.

### SEO Keywords

google flights scraper, google flights api alternative, scrape google flights, google flights price tracker, flight price monitoring, flight price alerts, track airfare prices, google flights mcp server, flight fares json, flight data api, airfare data extraction, cheapest flight api, google flights api no key, google flights without api, flight price drop alert, flight webhook alerts, round trip flight scraper, one way flight fares, google flights co2 emissions, google qpx express alternative, travel fare api, flight monitoring automation, google flights dataset, airfare price history, flight price api

# Actor input Schema

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

search = one-off fare search for the configured routes. monitor = re-check the same routes, diff the cheapest fare against the previous run and emit only changes (plus an optional webhook). In monitor mode with no routes set, the watchlist registered through the MCP watch_route tool is used.

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

One or more flight searches. Leave empty to use the single origin/destination pair below, or (search mode only) a demo ZAG → LHR search so a first run always returns data.

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

3-letter IATA code. Used when routes is empty.

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

3-letter IATA code. Used when routes is empty.

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

YYYY-MM-DD. Used when routes is empty.

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

YYYY-MM-DD. Set for round-trip fares.

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

Cabin class for all searches in this run.

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

Number of adult passengers (1-9 in total with children and infants).

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

Number of children aged 2-11.

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

Number of infants under 2 occupying their own seat.

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

Number of infants under 2 travelling on a lap (needs one adult each).

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

ISO 4217 code — Google converts fares into this currency (USD, EUR, GBP, BAM, ...).

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

Google UI language, e.g. en, de, hr.

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

Maximum stops per itinerary (0 = non-stop only). Leave empty for any number of stops.

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

Only return itineraries up to this price in the selected currency. Leave empty for no limit.

## `carryOnBags` (type: `integer`):

Include estimated bag fees for this many carry-on bags in the fare.

## `checkedBags` (type: `integer`):

Include estimated bag fees for this many checked bags in the fare.

## `earliestDepartureHour` (type: `integer`):

Local airport time 0-23. Leave empty for no restriction.

## `latestDepartureHour` (type: `integer`):

Local airport time 0-23. Leave empty for no restriction.

## `lessEmissionsOnly` (type: `boolean`):

Only itineraries with lower CO2 emissions than typical for the route.

## `hideSeparateAndSelfTransfer` (type: `boolean`):

Hide tickets split across airlines that require a self-transfer or separate bookings.

## `excludeBasicEconomy` (type: `boolean`):

Exclude basic economy fares (usually no checked bag and no seat selection).

## `maxResultsPerRoute` (type: `integer`):

Cap on dataset rows pushed per route. Google typically returns 50-150 itineraries per route.

## `includeUnpriced` (type: `boolean`):

Google sometimes lists itineraries with no bookable fare. Keep them (price: null) or drop them.

## `cacheTtlSeconds` (type: `integer`):

Reuse an identical search result from the last N seconds instead of hitting Google again. Makes repeated monitor runs cheap. 0 disables the cache.

## `onlyChanges` (type: `boolean`):

monitor mode only — push a record only when the cheapest price changed (or on the first check). Disable to push a snapshot every run.

## `webhookUrl` (type: `string`):

monitor mode only — POST a small JSON payload (route, event, previous price, current price, delta) here on every price drop or rise.

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

Apify Proxy configuration. On the Apify platform a proxy is applied automatically when this is left empty — Google answers bare datacenter IPs with an error. Datacenter proxy is fine for light use; switch the group to RESIDENTIAL for heavy or scheduled monitoring.

## Actor input object example

```json
{
  "mode": "search",
  "origin": "ZAG",
  "destination": "LHR",
  "cabinClass": "economy",
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "currency": "EUR",
  "language": "en",
  "carryOnBags": 0,
  "checkedBags": 0,
  "lessEmissionsOnly": false,
  "hideSeparateAndSelfTransfer": false,
  "excludeBasicEconomy": false,
  "maxResultsPerRoute": 50,
  "includeUnpriced": true,
  "cacheTtlSeconds": 900,
  "onlyChanges": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per flight itinerary (search mode) or per fare-change event (monitor mode). Append ?format=json or ?format=csv to download.

# 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": "ZAG",
    "destination": "LHR",
    "currency": "EUR",
    "language": "en",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmed_jasarevic/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": "ZAG",
    "destination": "LHR",
    "currency": "EUR",
    "language": "en",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("ahmed_jasarevic/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": "ZAG",
  "destination": "LHR",
  "currency": "EUR",
  "language": "en",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call ahmed_jasarevic/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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