# Google Flights Scraper - Every Flight, Fares & History (`clearpath/google-flights-scraper`) Actor

Scrape Google Flights for every flight on a route and date, one row each: fare, airline, stops, layovers, aircraft, baggage and emissions. One-way, round-trip and multi-city, with recent fare history and the typical price band included. One price per search, no per-result charge.

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

## Pricing

from $3.99 / 1,000 flight searches

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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

[![Flight searches. 0.84 seconds average per search. Fare history. Prices including bags.](https://api.apify.com/v2/key-value-stores/rfpznBPgVbyLYqNaQ/records/google-flights-scraper-readme-hero-96f12a076fc5.png)](https://console.apify.com/actors/zPQF14LB1ADnzBH3L/input)

From **Clearpath**, creators of [Expedia Hotels](https://apify.com/clearpath/expedia-hotels-scraper-pro), [Booking.com Reviews](https://apify.com/clearpath/booking-reviews-scraper) and [Tripadvisor Reviews](https://apify.com/clearpath/tripadvisor-reviews-scraper). Flight prices, hotel rates and traveller feedback from the same team.

### Why choose this actor?

**0.84 seconds per search on average.** A local search benchmark completed 50 searches in 42 seconds across six routes and three dates. Collect fares in bulk, with one exportable row per itinerary. Leave `maxResults` at `0` to keep all available results.

**Fare history from the first search.** Get recent route prices and Google's typical price range alongside the flights, when available. See how the current fare compares without waiting weeks to build your own history.

**Compare prices with your bags included.** Set `carryOnBags` and `checkedBags` to price fares with the baggage you need. Get aircraft, legroom, cabin class and carbon emissions where available, plus flight legs, layovers and local times.

<a href="https://console.apify.com/actors/zPQF14LB1ADnzBH3L/input"><img src="https://api.apify.com/v2/key-value-stores/rfpznBPgVbyLYqNaQ/records/google-flights-scraper-readme-cta-3a6d8ac429df.svg" width="216" height="48" alt="Search your route with the Google Flights actor"/></a>

### Quick input

Start with one route and a future departure date. This example keeps all available flights:

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "maxResults": 0
}
```

[Open the actor](https://console.apify.com/actors/zPQF14LB1ADnzBH3L/input) to choose your airports and date. Export JSON, CSV or Excel; JSON preserves the flight legs and fare history. The output contains a search summary plus one row per itinerary. Fare history and baggage details depend on what Google returns for that search.

For a round trip, add `returnDate`. Enable `includeReturnFlights` only when you also need the matching return options; each outbound expanded incurs an additional charge.

<table><tr><td colspan="4" style="background:#1A73E8;color:#FFFFFF;padding:10px 14px;font-weight:700;font-size:13px">Clearpath · Travel Data</td></tr><tr><td style="background:#D8E4FF;padding:9px 10px;border:1px solid #AEC4E8;vertical-align:top;white-space:nowrap"><span style="white-space:nowrap"><img src="https://api.apify.com/v2/key-value-stores/rfpznBPgVbyLYqNaQ/records/google-flights-scraper-icon-v1.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<strong style="color:#174EA6;font-size:13px">Google Flights</strong></span><br><span style="color:#23416B;font-size:12px;white-space:nowrap">You are here</span></td><td style="background:#EAF0FF;padding:9px 10px;border:1px solid #AEC4E8;vertical-align:top;white-space:nowrap"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-PkDuDXX8v3J6PhiXe-vWzC9sHZ50-expedia-scraper-pro.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/clearpath/expedia-hotels-scraper-pro" style="color:#174EA6;font-size:13px;font-weight:700;text-decoration:none">Expedia</a></span><br><span style="color:#23416B;font-size:12px;white-space:nowrap">Hotel rates & reviews</span></td><td style="background:#EAF0FF;padding:9px 10px;border:1px solid #AEC4E8;vertical-align:top;white-space:nowrap"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-2is3rJRNMT6pfa0Oi-1v3qI3KcRX-booking-reviews-scraper-logo.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/clearpath/booking-reviews-scraper" style="color:#174EA6;font-size:13px;font-weight:700;text-decoration:none">Booking.com</a></span><br><span style="color:#23416B;font-size:12px;white-space:nowrap">Guest reviews</span></td><td style="background:#EAF0FF;padding:9px 10px;border:1px solid #AEC4E8;vertical-align:top;white-space:nowrap"><span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-w0KUpCAUnd23Z9mTB-56fastRocJ-tripadvisor-review-scraper-logo.png" width="20" height="20" alt="" style="display:inline-block;vertical-align:middle;margin:0"/>&nbsp;<a href="https://apify.com/clearpath/tripadvisor-reviews-scraper" style="color:#174EA6;font-size:13px;font-weight:700;text-decoration:none">Tripadvisor</a></span><br><span style="color:#23416B;font-size:12px;white-space:nowrap">Traveller reviews</span></td></tr></table>

#### Copy to your AI assistant

```text
clearpath/google-flights-scraper on Apify returns every flight Google Flights shows for a route and date, one record per itinerary plus one `search` record carrying the price band, recent fare history and route vocabularies. Minimum input: origin, destination, departureDate (IATA codes, YYYY-MM-DD); origin/destination accept several comma-separated airports. maxResults=0 (default) keeps every flight; flightsAvailable on the search record is the true total. returnDate makes it a round trip priced at the round-trip total; the actual return flights only appear if includeReturnFlights=true, which adds one charged request per outbound, so bound it with maxResults. multiCityLegs takes extra legs as "FROM,TO,YYYY-MM-DD"; searches takes a list of routes that inherit the top-level settings; flightUrl accepts a pasted Google Flights address. carryOnBags/checkedBags re-price fares to include baggage rather than filtering; market changes which country's fares you get, not just the currency; maxStops=nonstop returns nothing on routes with no direct service. Unrecognised cabinClass, maxStops or currency are refused before the search runs. sortBy is applied to the delivered rows. Charges: $0.00099 per run start, $0.00499 per search regardless of how many flights come back (discounted to $0.00429 and $0.00399 on paid Apify plans), $0.00399 per outbound expanded for return flights; there is no per-row charge. Full input and output contract: https://api.apify.com/v2/actors/clearpath~google-flights-scraper/builds/default . Current pricing: https://apify.com/clearpath/google-flights-scraper
```

### How to scrape Google Flights

Give the actor a route and a date. Everything else has a sensible default.

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22"
}
```

Search several airports at once by listing them, and Google searches all of
them. Each result names the airport it actually uses.

```json
{
  "origin": "LAX, BUR, LGB",
  "destination": "JFK, EWR, LGA",
  "departureDate": "2026-11-22",
  "maxStops": "nonstop"
}
```

A round trip adds a return date. By default you get outbound options priced at
the round-trip total, which is how Google itself presents them. Switch on
`includeReturnFlights` to also collect the return flights that pair with each
outbound.

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "returnDate": "2026-11-29",
  "includeReturnFlights": true,
  "maxResults": 20
}
```

Multi-city takes the first leg in the usual fields and the rest as
`FROM,TO,YYYY-MM-DD`:

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "multiCityLegs": [
    "JFK,LHR,2026-11-27",
    "LHR,LAX,2026-12-02"
  ]
}
```

Already have the search open in your browser? Paste the address and the route,
dates, cabin, travellers and airline filters come with it:

```json
{
  "flightUrl": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTExLTIyagcIARIDTEFYcgcIARIDSkZLQAFIAXABggELCP___________wGYAQI"
}
```

To cover many routes in one run, put them in `searches`. Each entry inherits
anything you set above it and can override it:

```json
{
  "searches": [
    {
      "origin": "LAX",
      "destination": "JFK",
      "departureDate": "2026-11-22"
    },
    {
      "origin": "SFO",
      "destination": "ORD",
      "departureDate": "2026-11-24"
    },
    {
      "origin": "JFK",
      "destination": "LHR",
      "departureDate": "2026-11-26",
      "cabinClass": "business"
    }
  ],
  "currency": "USD",
  "maxResults": 50
}
```

### Filters

| Parameter | Type | Default | Meaning |
|---|---|---|---|
| `maxStops` | select | any | `nonstop`, `one_stop`, `two_stops` or any. Routes with no direct service return nothing under `nonstop`. |
| `airlines` | list | all | Keep only these airlines, by two-letter code, or a whole alliance: `ONEWORLD`, `SKYTEAM`, `STAR_ALLIANCE`. |
| `excludeAirlines` | list | none | Drop these airlines. Combines with `airlines`. |
| `connectingAirports` | list | any | Only flights connecting through these airports. |
| `maxPrice` | number | none | Hide fares above this, in your chosen currency. |
| `maxDurationMinutes` | number | none | Hide trips longer than this. 600 is ten hours. |
| `departureTimeFrom`, `departureTimeTo` | number | 0, 23 | Whole hours, local time at the departure airport. |
| `arrivalTimeFrom`, `arrivalTimeTo` | number | 0, 23 | Whole hours, local time at the arrival airport. |
| `lessEmissions` | boolean | off | Only flights Google marks as lower-emission for the route. |
| `carryOnBags`, `checkedBags` | number | 0 | Re-prices every fare to include the bags. This changes the prices shown; it does not remove flights. |
| `sortBy` | select | top | `price`, `duration`, `departure_time`, `arrival_time` or `emissions`. |
| `cabinClass` | select | economy | `premium_economy`, `business` and `first` return fewer flights, because not every route sells them. |
| `currency`, `market`, `language` | text | USD, us, en | `market` is the country you are searching from. Fares and availability genuinely differ by country. |
| `maxResults` | number | 0 | Flights per search. `0` keeps every one. |

The actor refuses a cabin, connection limit or currency it does not recognise
instead of running the search, because those would otherwise come back quietly
priced or filtered as something else.

### What data can you extract from Google Flights?

Each search writes one `search` record, then one `flight` record per itinerary.

The **search record** carries the context that applies to the whole search: the
price floor and ceiling, the typical price band, recent fare history, the
airlines, alliances and connection airports available on the route, and each
airline's baggage and accessibility policy pages.

```json
{
  "recordType": "search",
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "returnDate": null,
  "currency": "USD",
  "market": "us",
  "cabinClass": "economy",
  "tripType": "one_way",
  "travellerCount": 1,
  "googleFlightsUrl": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTExLTIyagcIARIDTEFYcgcIARIDSkZLQAFIAXABggELCP___________wGYAQI&hl=en&gl=us&curr=USD",
  "flightsAvailable": 142,
  "priceLow": 324,
  "priceHigh": 2012,
  "durationMinutesLow": 312,
  "durationMinutesHigh": 1328,
  "typicalPriceLow": 85,
  "typicalPriceHigh": 215,
  "priceHistory": [
    {
      "date": "2026-07-24",
      "price": 269
    },
    {
      "date": "2026-07-25",
      "price": 269
    }
  ],
  "airlines": [
    {
      "code": "AS",
      "name": "Alaska"
    },
    {
      "code": "AA",
      "name": "American"
    },
    {
      "code": "AD",
      "name": "Azul"
    }
  ],
  "alliances": [
    {
      "code": "ONEWORLD",
      "name": "Oneworld"
    }
  ],
  "connectionAirports": [
    {
      "code": "ATL",
      "city": "Atlanta"
    },
    {
      "code": "AUS",
      "city": "Austin"
    }
  ],
  "baggagePolicyUrls": [
    {
      "code": "AS",
      "airline": "Alaska",
      "url": "https://www.alaskaair.com/content/travel-info/baggage/overview"
    }
  ],
  "accessibilityUrls": [
    {
      "code": "AS",
      "airline": "Alaska",
      "url": "https://www.alaskaair.com/content/travel-info/accessible-services"
    }
  ],
  "flightsDelivered": 3
}
```

`priceHistory` holds 62 dated points, `airlines`
14 entries, `connectionAirports`
27 and the two policy lists
5 each. They are shortened above; runs return
them in full.

Each **flight record** is one itinerary, with every leg broken out:

```json
{
  "price": 334,
  "checkedBagsIncluded": 0,
  "carryOnBagsIncluded": 1,
  "airlineCode": "B6",
  "airlineName": "JetBlue",
  "departureAirport": "LAX",
  "departureAirportName": "Los Angeles International Airport",
  "departureTime": "2026-11-22T10:00:00-08:00",
  "arrivalAirport": "JFK",
  "arrivalAirportName": "John F. Kennedy International Airport",
  "arrivalTime": "2026-11-22T18:28:00-05:00",
  "durationMinutes": 328,
  "stops": 0,
  "legs": [
    {
      "airlineCode": "B6",
      "airlineName": "JetBlue",
      "flightNumber": "824",
      "operatedBy": null,
      "departureAirport": "LAX",
      "departureAirportName": "Los Angeles International Airport",
      "departureTime": "2026-11-22T10:00:00-08:00",
      "arrivalAirport": "JFK",
      "arrivalAirportName": "John F. Kennedy International Airport",
      "arrivalTime": "2026-11-22T18:28:00-05:00",
      "durationMinutes": 328,
      "aircraft": "Airbus A320",
      "legroom": "33 inches",
      "cabin": "economy",
      "cabinId": 1,
      "seatTypeId": 3,
      "emissionsGrams": 422048,
      "codeshares": [],
      "amenityCodes": {
        "1": true,
        "8": true,
        "11": 2
      }
    }
  ],
  "layovers": [],
  "operatingAirlines": [],
  "emissionsGrams": 422000,
  "emissionsLowestGrams": 338000,
  "emissionsTypicalGrams": 386000,
  "emissionsVsTypicalPercent": 25,
  "isBestFlight": true,
  "bookingToken": "CjRIZ0dTcFZ6ZGZQVXNBRUV3ZlFCRy0tLS0tLS0tLWVmbWEyM0FBQUFBR3F6cXRzTld1b3dBEgVCNjgyNBoLCLyEAhACGgNVU0Q4HHC8hAI=",
  "itineraryId": "Viqdvf",
  "recordType": "flight",
  "pricePerPassenger": 334.0,
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "returnDate": null,
  "currency": "USD",
  "market": "us",
  "cabinClass": "economy",
  "tripType": "one_way",
  "travellerCount": 1,
  "googleFlightsUrl": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTExLTIyagcIARIDTEFYcgcIARIDSkZLQAFIAXABggELCP___________wGYAQI&hl=en&gl=us&curr=USD",
  "flightsAvailable": 142
}
```

A connecting itinerary fills `layovers` and carries one entry in `legs` per
flight:

```json
{
  "stops": 1,
  "layovers": [
    {
      "durationMinutes": 78,
      "airport": "PHX",
      "airportName": "Phoenix Sky Harbor International Airport",
      "city": "Phoenix"
    }
  ]
}
```

Notes on reading the output:

- `departureTime` and `arrivalTime` carry the local UTC offset, so an overnight
  arrival is unambiguous without looking up the airport's timezone.
- `price` covers the whole party; `pricePerPassenger` divides it.
- `checkedBagsIncluded` and `carryOnBagsIncluded` describe the fare. They are
  empty when Google does not state them, which happens on searches for more
  than one traveller. Empty means unknown, not zero.
- `amenityCodes` and `seatTypeId` are Google's own unlabelled codes. They are
  stable, so they are published as codes rather than under invented names.
- `flightsAvailable` is what the search found; `flightsDelivered` is what this
  run wrote after your `maxResults`.
- Nested `legs`, `layovers` and `returnFlights` survive JSON export. CSV
  flattens them, so use JSON when you need the per-leg detail.

### Pricing

| Event | When charged | Price |
|---|---|---|
| Actor start | Once per run | $0.00099 |
| Flight search | Once per search that returns flights, however many come back | $0.00499 |
| Return flights | Once per outbound expanded, only with `includeReturnFlights` | $0.00399 |

There is no per-result charge. A search returning 300 flights costs the same as
one returning 8, so a typical one-route run is well under a cent. Watching ten
routes once a day is roughly $1.80 a month.

Flight search is discounted on paid Apify plans: $0.00429 on Scale and $0.00399
on Business and above. The Pricing tab shows the rate for your own plan.

A run that is refused for an invalid input charges nothing at all, because the
input is checked before any search starts.

`includeReturnFlights` is the one option that multiplies cost: it makes one
extra request per outbound option. Pair it with `maxResults` to bound it.

### Frequently asked questions

**Does Google Flights have a public API?** No. This actor collects the data for
you and returns it as structured records.

**How many flights come back per search?** As many as the search has. Typical
city pairs return roughly 100 to 300; `flightsAvailable` on the search record
always tells you the true number.

**Can I use it for one-way, round-trip and multi-city?** Yes, all three, plus
several airports per field.

**Can I watch a fare over time?** Yes. Schedule the actor and compare runs; the
search record also carries Google's own recent fare history and typical price
band, so the first run already tells you whether today's price is unusual.

**Which airport codes work?** Three-letter IATA codes, such as `LAX` or `LHR`.

**Why did a search return nothing?** Usually a filter no route satisfies, most
often `nonstop` on a route with no direct service. Loosen it and try again.

**Do prices differ by country?** Yes, genuinely. `market` sets the country the
search is made from, and both fares and availability follow it.

**Is there a free tier?** Free-plan usage is not limited at the moment.

### Support

Found a problem or need a field that is missing? Open an issue on the **Issues**
tab, or write to `max@mapa.slmail.me`. Include the run ID and your input.

# Actor input Schema

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

Airport to fly from, as its three-letter code. Several codes separated by commas search all of them, for example LAX, BUR, LGB.

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

Airport to fly to, as its three-letter code. Several codes separated by commas search all of them, for example JFK, EWR, LGA.

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

Date of the outbound flight, as YYYY-MM-DD. Must not be in the past.

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

Date of the return flight, as YYYY-MM-DD. Leave empty for a one-way search.

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

Stop after this many flights per search. Leave at 0 for every flight found, which is usually 100 to 300.

## `flightUrl` (type: `string`):

Paste a Google Flights address to reuse the search it holds, including route, dates, cabin and travellers. Open the search you want and copy the address once results are showing. Fields below still apply on top.

## `multiCityLegs` (type: `array`):

Extra legs for a multi-city trip, each written as FROM,TO,YYYY-MM-DD. Leave empty for a one-way or return trip.

## `searches` (type: `array`):

One entry per route, each with its own origin, destination and dates. Any setting left out of an entry is taken from the fields above. Leave empty to search a single route.

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

Which cabin to price. Higher cabins return fewer flights, because not every route sells them.

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

Travellers aged 18 and over. At least one is required, and all travellers together cannot exceed nine.

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

Travellers aged 2 to 17.

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

Travellers under 2 who occupy their own seat.

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

Travellers under 2 seated on an adult's lap. Cannot exceed the number of adults.

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

Largest number of connections to allow. Routes with no direct service return nothing when set to non-stop.

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

Only show these airlines, by two-letter code, or a whole alliance: ONEWORLD, SKYTEAM, STAR\_ALLIANCE.

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

Hide these airlines, by two-letter code, or a whole alliance: ONEWORLD, SKYTEAM, STAR\_ALLIANCE. Can be combined with the airlines filter above.

## `connectingAirports` (type: `array`):

Only show flights that connect through these airports, by three-letter code.

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

Hide flights above this price, in the currency selected below.

## `maxDurationMinutes` (type: `integer`):

Hide flights longer than this, counted in minutes. 600 is ten hours.

## `departureTimeFrom` (type: `integer`):

Whole hour in local time at the departure airport, 0 to 23.

## `departureTimeTo` (type: `integer`):

Whole hour in local time at the departure airport, 0 to 23.

## `arrivalTimeFrom` (type: `integer`):

Whole hour in local time at the arrival airport, 0 to 23.

## `arrivalTimeTo` (type: `integer`):

Whole hour in local time at the arrival airport, 0 to 23.

## `lessEmissions` (type: `boolean`):

Only show flights Google marks as having lower carbon emissions than typical for the route.

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

Price every fare with this many carry-on bags included. This changes the prices shown, it does not remove flights.

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

Price every fare with this many checked bags included. This changes the prices shown, it does not remove flights.

## `sortBy` (type: `string`):

Order of the results.

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

Currency the fares are quoted in.

## `market` (type: `string`):

Country to search from. Fares and availability differ by country, so this changes the results as well as the default currency.

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

Language for airline and airport names.

## `includeReturnFlights` (type: `boolean`):

On a round-trip search, also collect the return flights that pair with each outbound option. Considerably slower, and only applies when a return date is set.

## Actor input object example

```json
{
  "origin": "LAX",
  "destination": "JFK",
  "departureDate": "2026-11-22",
  "returnDate": "2026-11-29",
  "searches": [],
  "cabinClass": "economy",
  "adults": 1,
  "maxStops": "any",
  "sortBy": "top",
  "currency": "USD",
  "market": "us",
  "language": "en"
}
```

# Actor output Schema

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

No description

## `console` (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": "2026-11-22",
    "returnDate": "2026-11-29",
    "maxResults": 0,
    "searches": [],
    "cabinClass": "economy",
    "adults": 1,
    "maxStops": "any",
    "sortBy": "top",
    "currency": "USD",
    "market": "us",
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearpath/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": "2026-11-22",
    "returnDate": "2026-11-29",
    "maxResults": 0,
    "searches": [],
    "cabinClass": "economy",
    "adults": 1,
    "maxStops": "any",
    "sortBy": "top",
    "currency": "USD",
    "market": "us",
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("clearpath/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": "2026-11-22",
  "returnDate": "2026-11-29",
  "maxResults": 0,
  "searches": [],
  "cabinClass": "economy",
  "adults": 1,
  "maxStops": "any",
  "sortBy": "top",
  "currency": "USD",
  "market": "us",
  "language": "en"
}' |
apify call clearpath/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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