# Google Flights Scraper: Flight Prices & Price Calendar (`famed_bonobo/google-flights-scraper`) Actor

Flight prices from Google Flights for any route and date: every flight with legs, layovers and CO2, return flights, multi-city trips, every airline and agency's booking option, a 330-day price calendar and Explore by region.

- **URL**: https://apify.com/famed_bonobo/google-flights-scraper.md
- **Developed by:** [Axel Zúñiga](https://apify.com/famed_bonobo) (community)
- **Categories:** Travel, AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 flights

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

## Google Flights Scraper

Get every flight [Google Flights](https://www.google.com/travel/flights) shows for any route and date, as clean rows you can sort and filter: total price, airlines, flight numbers, stops, layovers, departure and arrival times, aircraft, legroom and CO2 emissions. Each flight also carries Google's **price insights** for the route: the lowest price, the typical price range, whether prices are low, typical or high right now, and, for one-way trips, the price history of the last weeks.

For round trips you get **complete trips**: every outbound flight with the return flights Google offers with it and the total price of each pair. Turn on **booking options** to see every seller Google compares (the airline and the travel agencies) with today's price, fare name, bag fees, change and refund rules, and a booking link. Switch to the **price calendar** to get Google's cheapest price for every departure date up to about 330 days ahead, and on round trips for every trip length you choose: a full date matrix (for example 310 dates × 3 lengths = 930 prices in about 20 seconds) to find the cheapest days to fly. Or switch to **Explore** to get the cheapest flight from your airport to every destination of a region (anywhere, Europe, Asia, the Caribbean...) for your dates, as on Google's Explore map. For **multi-city trips** (up to 10 flights in one trip) you get whole trips priced as one, with a flight for every leg and booking options for the trip, as on Google's multi-city search. All of Google's own filters are available: airlines and alliances, departure and arrival times, duration, connecting airports, layover length, bags in the price, basic economy and sort order.

### What you can use it for

- **Fare tracking**: schedule a daily run and get the lowest price and price level for your routes.
- **Travel apps and agents**: feed live flight options into your product or AI travel assistant.
- **Market and route research**: compare airlines, stops and prices between airports, cabins and dates.
- **Deal finding**: catch the days when Google says prices are low for a route.
- **Flexible dates**: price every departure date and trip length at once and pick the cheapest combination.
- **Flexible destinations**: list where you can fly from your airport for the least money, by region.

### What data you get

| Field | Example |
|---|---|
| Route and dates | SJO → MIA, 2026-12-10, round trip |
| Return flights of a round trip | for each outbound flight, the returns Google offers with it, each with the price of the pair |
| Multi-city trips | JFK → LHR → CDG → JFK as one trip: a flight for each leg and the price of the whole trip |
| Booking options (optional) | Delta 409 "Main Basic", Expedia 412: fare name, first and second checked bag fee, carry-on fee, changes, refund and seat selection rules, booking link |
| Live price | today's cheapest seller quote in your cabin, and who sells it |
| Price | 761 USD, for all passengers and the whole trip |
| Bags included in that price | 0 checked, 1 carry-on |
| In-flight amenities per leg | power and USB outlets, on-demand video, free or paid Wi-Fi, seat legroom type |
| Connection details | changing airports between legs, self-transfer itineraries, arrival "+1 day" |
| Emissions vs typical | -32 %, "lower", plus CO2 per leg |
| Google's price insights | typical price, typical range, low/typical/high, and the cheapest time to book when Google shows it |
| Airlines and flight numbers | Avianca, AV 693 + AV 126 |
| Stops and layovers | 1 stop, 2 hr 35 min in Bogotá (BOG) |
| Times | departs 2026-12-10T01:50, arrives 2026-12-10T11:40 (local times) |
| Each leg | airports, times, duration, aircraft (Airbus A320), legroom (28 in), operating carrier |
| Emissions | 640 kg CO2, typical for the route 276 kg |
| Price insights | lowest 761, typical range 490 to 980, level "typical", price history (one-way) |

### How to use it

1. Enter one or more departure airports and arrival airports as 3-letter codes, for example `JFK` and `LHR`. Every origin is searched against every destination.
2. Pick the departure date. Add a return date for a round trip, or leave it empty for one way.
3. Choose passengers, cabin class and the maximum number of stops if you need them.
4. For the cheapest dates instead of flights, set "What to get" to **Price calendar**, the number of departure dates and, for round trips, the shortest and longest trip. For the cheapest destinations, set it to **Explore** and pick a region; no arrival airports are needed. For a trip with several flights, set it to **Multi-city** and list the flights of the trip, each with its airports and date.
5. Run it and download the results as JSON, CSV, Excel or HTML, or read them through the Apify API.

#### Input example

```json
{
  "origins": ["SJO", "JFK"],
  "destinations": ["MIA", "MAD"],
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17",
  "adults": 2,
  "cabinClass": "economy",
  "maxStops": "1",
  "maxReturnFlightsPerDeparture": 3,
  "includeBookingOptions": true,
  "airlines": ["STAR_ALLIANCE"],
  "earliestDepartureHour": 6,
  "currency": "USD"
}
```

#### Output example

```json
{
  "origin": "SJO",
  "destination": "MIA",
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17",
  "tripType": "round_trip",
  "adults": 2,
  "position": 1,
  "isBestFlight": true,
  "price": 801,
  "currency": "USD",
  "airlines": [
    "Avianca"
  ],
  "stops": 1,
  "totalDurationMinutes": 530,
  "departureDateTime": "2026-12-10T01:50",
  "arrivalDateTime": "2026-12-10T11:40",
  "layovers": [
    {
      "airport": "BOG",
      "airportName": "El Dorado International Airport",
      "city": "Bogotá",
      "durationMinutes": 155,
      "changesAirport": false,
      "departureAirport": "BOG"
    }
  ],
  "checkedBagsIncluded": 0,
  "carryOnBagsIncluded": 2,
  "co2EmissionsKg": 640.0,
  "typicalRouteCo2EmissionsKg": 276.0,
  "segments": [
    {
      "flightNumber": "AV 693",
      "airline": "Avianca",
      "operatedBy": "Avianca Costa Rica S.a.",
      "departureAirport": "SJO",
      "arrivalAirport": "BOG",
      "departureDateTime": "2026-12-10T01:50",
      "arrivalDateTime": "2026-12-10T05:05",
      "durationMinutes": 135,
      "aircraft": "Airbus A320",
      "legroom": "28 in",
      "wifi": null
    },
    {
      "flightNumber": "AV 126",
      "airline": "Avianca",
      "operatedBy": null,
      "departureAirport": "BOG",
      "arrivalAirport": "MIA",
      "departureDateTime": "2026-12-10T07:40",
      "arrivalDateTime": "2026-12-10T11:40",
      "durationMinutes": 240,
      "aircraft": "Airbus A320",
      "legroom": "28 in",
      "wifi": null
    }
  ],
  "priceInsights": null,
  "returnFlights": [
    {
      "position": 1,
      "price": 801,
      "airlines": [
        "Avianca"
      ],
      "stops": 0,
      "departureDateTime": "2026-12-17T12:20",
      "arrivalDateTime": "2026-12-17T14:15",
      "livePrice": 804,
      "livePriceSeller": "Avianca",
      "segments": [
        {
          "flightNumber": "AV 605",
          "airline": "Avianca",
          "operatedBy": "Avianca Costa Rica S.a.",
          "departureAirport": "MIA",
          "arrivalAirport": "SJO",
          "departureDateTime": "2026-12-17T12:20",
          "arrivalDateTime": "2026-12-17T14:15",
          "durationMinutes": 175,
          "aircraft": "Airbus A320",
          "legroom": "28 in",
          "wifi": null
        }
      ],
      "bookingOptions": [
        {
          "seller": "Avianca",
          "isAirline": true,
          "price": 804,
          "fareName": null,
          "checkedBagsIncluded": 0,
          "carryOnBagsIncluded": 2,
          "firstCheckedBagFee": 170,
          "changes": null,
          "refund": null,
          "bookingUrl": "https://www.google.com/travel/clk/f?u=ADowPOKhK9..."
        }
      ]
    }
  ]
}
```

**About prices:** `price` is the total for all passengers. For round trips it is the price of the whole trip: next to an outbound flight it is the cheapest trip that starts with it, as Google shows it, and next to a return flight it is the price of that exact pair. `livePrice` is what the sellers quote right now. `priceInsights` is `null` when Google shows no insights for a search. The price level follows Google's rule: below the typical range is "low", above it is "high".

#### Price calendar example

Input: every departure date from November 1 for 329 days, trips of 3 to 5 nights.

```json
{
  "origins": ["JFK"],
  "destinations": ["LAX"],
  "departureDate": "2026-11-01",
  "returnDate": "2026-11-08",
  "searchMode": "priceCalendar",
  "calendarDays": 329,
  "minTripNights": 3,
  "maxTripNights": 5
}
```

Output: one row per departure date and trip length (930 rows for this input), each with a link to that search on Google Flights.

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "2026-11-14",
  "returnDate": "2026-11-17",
  "tripType": "round_trip",
  "tripNights": 3,
  "price": 348,
  "currency": "USD",
  "isCheapestDate": true,
  "cabinClass": "economy",
  "adults": 1,
  "googleFlightsUrl": "https://www.google.com/travel/flights?tfs=..."
}
```

The calendar uses the same filters as the flight search (stops, airlines, times and so on), and its prices match Google's: in the run above, the cheapest date (348 USD) is exactly the lowest price of the flight search for those dates.

#### Explore example

Input: from New York JFK and Miami to anywhere in Europe, December 10 to 17.

```json
{
  "searchMode": "explore",
  "origins": ["JFK", "MIA"],
  "exploreRegion": "europe",
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17"
}
```

Output: one row per destination, cheapest first (54 destinations from JFK and 49 from Miami in this run).

```json
{
  "origin": "JFK",
  "exploreRegion": "europe",
  "position": 1,
  "destinationName": "Reykjavík",
  "destinationCountry": "Iceland",
  "destination": "KEF",
  "price": 534,
  "currency": "USD",
  "airlines": ["Icelandair"],
  "stops": 0,
  "durationMinutes": 345,
  "latitude": 64.1469868,
  "longitude": -21.9407552,
  "departureDate": "2026-12-10",
  "returnDate": "2026-12-17",
  "googleFlightsUrl": "https://www.google.com/travel/flights?tfs=..."
}
```

Each price is the cheapest flight Google has for those dates: Reykjavík 534 and Dublin 580 above are exactly the lowest prices of full searches to KEF and DUB for the same dates. The link opens that search, with every flight and its booking options.

#### Multi-city example

Input: New York to London, four days later London to Paris, and Paris back to New York, with booking options for each trip.

```json
{
  "searchMode": "multiCity",
  "legs": [
    { "origin": "JFK", "destination": "LHR", "date": "2026-12-10" },
    { "origin": "LHR", "destination": "CDG", "date": "2026-12-14" },
    { "origin": "CDG", "destination": "JFK", "date": "2026-12-18" }
  ],
  "maxFlightsPerLeg": 2,
  "includeBookingOptions": true
}
```

Output: one row per trip. Each first-leg flight is combined with the flights Google offers for the next leg (`maxFlightsPerLeg` of them, best first), and so on to the last leg, so with 2 per leg every first-leg flight gives 4 whole trips. The price is for the whole trip and all passengers, as Google shows it once every leg is chosen.

```json
{
  "origin": "JFK",
  "destination": "JFK",
  "tripType": "multi_city",
  "legs": [
    { "origin": "JFK", "destination": "LHR", "date": "2026-12-10" },
    { "origin": "LHR", "destination": "CDG", "date": "2026-12-14" },
    { "origin": "CDG", "destination": "JFK", "date": "2026-12-18" }
  ],
  "position": 1,
  "isComplete": true,
  "price": 1257,
  "currency": "USD",
  "airlines": ["American", "British Airways"],
  "stops": 0,
  "totalDurationMinutes": 1005,
  "departureDateTime": "2026-12-10T18:25",
  "arrivalDateTime": "2026-12-18T13:50",
  "flights": [
    { "leg": 1, "position": 1, "price": 1257, "airlines": ["American"], "segments": [{ "flightNumber": "AA 100", "departureAirport": "JFK", "arrivalAirport": "LHR" }] },
    { "leg": 2, "position": 1, "price": 1257, "airlines": ["British Airways"], "segments": [{ "flightNumber": "BA 302", "departureAirport": "LHR", "arrivalAirport": "CDG" }] },
    { "leg": 3, "position": 1, "price": 1257, "airlines": ["American"], "segments": [{ "flightNumber": "AA 43", "departureAirport": "CDG", "arrivalAirport": "JFK" }] }
  ],
  "livePrice": 1257,
  "livePriceSeller": "American",
  "bookingOptions": [{ "seller": "American", "price": 1257, "bookingUrl": "https://www.google.com/travel/clk/..." }],
  "googleFlightsUrl": "https://www.google.com/travel/flights?tfs=..."
}
```

Each flight in `flights` carries the same details as a one-way flight (segments, layovers, times, aircraft, legroom, amenities, CO2) and the price of the trip up to that leg, as Google lists it while you pick the flights one leg at a time. The link opens the trip's own multi-city search on Google Flights.

### Pricing

**$0.05 per 1,000 flights** stored (each return flight of a round trip, and each flight of a multi-city trip, counts as one flight), plus **$0.40 per 1,000 flights** with booking options when that option is on. The price calendar costs **$0.05 per 1,000 dates**, and Explore **$0.10 per 1,000 destinations**. Platform usage is included. You can cap the cost of any run with Apify's maximum charge setting; the scraper stops cleanly when the cap is reached.

### Reliability

- No browser: the scraper reads the same data Google sends to its own page, so runs are fast and cheap.
- Requests are spread over every IP of your proxy, each at a pace Google accepts; an IP that Google slows down rests while the others continue, so long runs do not get blocked.
- Google's random refusals are retried at once, so every flight gets its data.
- If one route fails, the others still finish, and the run status names the route that failed.
- Flights are saved as soon as they are ready, so a stopped run keeps everything it already collected.

### FAQ

**Why did a route return no flights?**
Google shows no flights when nothing matches the dates, stops or cabin you chose. Try allowing more stops or another date.

**Can I get the return flights of a round trip?**
Yes. Set "Return flights per outbound flight" (`maxReturnFlightsPerDeparture`): 1 gives the best return for each outbound flight, so every row is a complete trip; up to 100 lists all of them. Set it to 0 to get only the outbound list, like Google's first results page.

**Can I search a multi-city trip?**
Yes. Set "What to get" to Multi-city and list the trip's flights (2 to 10) with their airports and dates. Each row is a whole trip with a flight for every leg and the total price; "Flights per later leg" (`maxFlightsPerLeg`) controls how many of Google's options for each next leg are combined with each flight, and the trip's booking options are available like on a one-way search.

**Which filters can I use?**
The same as on Google Flights: airlines or alliances to include or exclude, earliest and latest departure and arrival hours, maximum duration, connecting airports, minimum and maximum layover, lower emissions only, checked and carry-on bags in the price, exclude basic economy, and sort by best, cheapest, departure, arrival or duration. Google applies them, so the results match its page.

**How far ahead can the price calendar go?**
Google prices departures up to about 330 days ahead; dates after that are left out. Dates Google has no price for (no flights that day) are skipped and not charged.

**Why is the price history empty?**
Google publishes the price history only for one-way searches.

**Is this legal?**
The scraper collects public flight listings and prices; it does not collect personal data. You are responsible for how you use the data and for complying with the laws and terms that apply to you.

### Also from this developer

- [Google Hotels Scraper](https://apify.com/famed_bonobo/google-hotels-scraper): hotel prices, ratings and the offer from every booking site for any city and dates.
- [Google Jobs Scraper](https://apify.com/famed_bonobo/google-jobs-scraper): job listings for any search and country, with salary, full description and direct apply links.

### Feedback

Found a problem or need a field that is missing? Open an issue on the Issues tab and it will be answered quickly.

# Actor input Schema

## `searchMode` (type: `string`):

Flights lists every flight Google shows for the dates. Price calendar gives Google's cheapest price for every departure date from the departure date on, as in its price graph; on round trips, for each trip length you choose, which makes a full date matrix. The calendar is much cheaper and is made for finding the best dates. Explore gives the cheapest flight from each origin to every destination of a region (anywhere, Europe, Asia...) for your dates, as on Google's Explore map; it needs no destination airports. Multi-city takes the flights of a trip in "Trip flights" (2 to 10, each with its airports and date) and lists whole trips priced as one, as Google's multi-city search does.

## `legs` (type: `array`):

Multi-city only. The flights of the trip in travel order, 2 to 10, each as {"origin": "JFK", "destination": "LHR", "date": "2027-03-10"}. Origins, destinations and the dates above are not used.

## `maxFlightsPerLeg` (type: `integer`):

Multi-city only. For each flight chosen on a leg, how many of the flights Google offers for the next leg to combine it with (best first). 1 gives one whole trip per first-leg flight; 3 on a 3-flight trip gives 9 trips per first-leg flight. Each flight of a trip is charged as one flight.

## `origins` (type: `array`):

Departure airports as 3-letter IATA codes, such as JFK or SJO. Every origin is searched against every destination. Not needed for Multi-city.

## `destinations` (type: `array`):

Arrival airports as 3-letter IATA codes, such as LHR or MIA. Not needed for Explore or Multi-city.

## `exploreRegion` (type: `string`):

Explore only. Where to look for destinations.

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

Day of the outbound flight. Leave empty to search 30 days from today.

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

Fill it for a round trip; leave empty for one way. Round-trip prices are for the whole trip, as Google shows them on the outbound list.

## `maxReturnFlightsPerDeparture` (type: `integer`):

Round trips only. For each outbound flight, the return flights Google offers with it (best first), each with the total price of the pair, as on Google Flights after you pick a departure. 1 makes every row a complete trip; 0 lists only outbound flights priced as round trips. Each return flight is charged as one flight.

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

Number of adult passengers.

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

Number of children (2 to 11 years).

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

Infants under 2 with their own seat.

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

Infants under 2 traveling on an adult's lap; at most one per adult.

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

Cabin to search.

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

Limit the number of stops per direction.

## `maxFlightsPerSearch` (type: `integer`):

Stop each route after this many flights. Google usually lists 20 to 150 flights per route.

## `includePriceHistory` (type: `boolean`):

Add Google's history of the route's lowest price over the last weeks to the price insights. Google publishes this history only for one-way searches.

## `includeBookingOptions` (type: `boolean`):

For each flight, every seller Google compares (the airline and travel agencies) with today's price, fare name, bag fees, change and refund rules, and booking link, plus the live cheapest price in your cabin. One extra request per flight, charged as a separate event. On a round trip the options are quoted for each outbound and return pair.

## `calendarDays` (type: `integer`):

Price calendar only. How many departure dates, starting on the departure date. Google prices dates up to about 330 days ahead; later dates are left out.

## `minTripNights` (type: `integer`):

Price calendar on round trips. Leave empty to use the nights between your departure and return dates.

## `maxTripNights` (type: `integer`):

Price calendar on round trips. Every length from the shortest to the longest is priced for every departure date.

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

Order of the flights, as Google sorts them.

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

2-character airline codes such as DL or BA, or ONEWORLD, SKYTEAM, STAR_ALLIANCE.

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

2-character airline codes or alliances to leave out.

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

In the chosen currency, for all passengers.

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

Outbound flight leaves at or after this hour (0-23).

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

Outbound flight leaves at or before this hour (0-23).

## `earliestArrivalHour` (type: `integer`):

Outbound flight lands at or after this hour (0-23).

## `latestArrivalHour` (type: `integer`):

Outbound flight lands at or before this hour (0-23).

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

Total travel time, layovers included.

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

3-letter airport codes where connections may happen.

## `minLayoverMinutes` (type: `integer`):

Connections shorter than this are left out.

## `maxLayoverMinutes` (type: `integer`):

Connections longer than this are left out.

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

Google's lower-emissions filter.

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

Show prices that include this many checked bags, as Google does when you set bags.

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

Show prices that include a carry-on bag.

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

Leave out basic economy fares, as Google does (mostly US airlines).

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

Three-letter currency code for all prices, such as USD, EUR or GBP.

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

Language of airport and airline names, as a Google language code such as en, es or de.

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

Two-letter country code Google uses to localize prices, such as us, gb or de.

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

Proxies used to reach Google. The default works for most runs.

## Actor input object example

```json
{
  "searchMode": "flights",
  "legs": [
    {
      "origin": "JFK",
      "destination": "LHR",
      "date": "2027-03-10"
    },
    {
      "origin": "LHR",
      "destination": "CDG",
      "date": "2027-03-14"
    },
    {
      "origin": "CDG",
      "destination": "JFK",
      "date": "2027-03-18"
    }
  ],
  "maxFlightsPerLeg": 1,
  "origins": [
    "JFK"
  ],
  "destinations": [
    "LHR"
  ],
  "exploreRegion": "anywhere",
  "maxReturnFlightsPerDeparture": 1,
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "economy",
  "maxStops": "any",
  "maxFlightsPerSearch": 100,
  "includePriceHistory": false,
  "includeBookingOptions": false,
  "calendarDays": 60,
  "sortBy": "best",
  "airlines": [],
  "excludeAirlines": [],
  "connectingAirports": [],
  "lessEmissionsOnly": false,
  "checkedBags": 0,
  "carryOnBags": 0,
  "excludeBasicEconomy": false,
  "currency": "USD",
  "language": "en",
  "country": "us",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "legs": [
        {
            "origin": "JFK",
            "destination": "LHR",
            "date": "2027-03-10"
        },
        {
            "origin": "LHR",
            "destination": "CDG",
            "date": "2027-03-14"
        },
        {
            "origin": "CDG",
            "destination": "JFK",
            "date": "2027-03-18"
        }
    ],
    "origins": [
        "JFK"
    ],
    "destinations": [
        "LHR"
    ],
    "departureDate": "",
    "returnDate": "",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("famed_bonobo/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 = {
    "legs": [
        {
            "origin": "JFK",
            "destination": "LHR",
            "date": "2027-03-10",
        },
        {
            "origin": "LHR",
            "destination": "CDG",
            "date": "2027-03-14",
        },
        {
            "origin": "CDG",
            "destination": "JFK",
            "date": "2027-03-18",
        },
    ],
    "origins": ["JFK"],
    "destinations": ["LHR"],
    "departureDate": "",
    "returnDate": "",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("famed_bonobo/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 '{
  "legs": [
    {
      "origin": "JFK",
      "destination": "LHR",
      "date": "2027-03-10"
    },
    {
      "origin": "LHR",
      "destination": "CDG",
      "date": "2027-03-14"
    },
    {
      "origin": "CDG",
      "destination": "JFK",
      "date": "2027-03-18"
    }
  ],
  "origins": [
    "JFK"
  ],
  "destinations": [
    "LHR"
  ],
  "departureDate": "",
  "returnDate": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call famed_bonobo/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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