# Google Flights (`datasaurus/google-flights`) Actor

Search Google Flights routes and return structured, deduplicated flight options.

- **URL**: https://apify.com/datasaurus/google-flights.md
- **Developed by:** [datasaurus](https://apify.com/datasaurus) (community)
- **Features:** Limited permissions
- **Stats:** 4 total users, 1 monthly users, 83.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 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

## Google Flights Scraper

Collect Google Flights fares, flight schedules, detailed segments, booking providers, nearby-date prices and Explore destinations as structured data. Supports one-way, round-trip and multi-city journeys, multiple searches, airport groups, city/country names, passengers, cabins and advanced filters.

### Start with Google Flights URLs

**Google Flights URLs is the first input and accepts multiple URLs. When populated, the other search inputs are ignored.** Routes, dates, passengers, cabin, filters, currency, language and country come from each URL; there is no need to clear the rest of the form. Result limits, booking/calendar lookups and raw storage still apply.

```json
{
  "startUrls": [
    {"url": "https://www.google.com/travel/flights?q=Flights+from+LHR+to+JFK+on+2026-11-10&curr=GBP&hl=en&gl=gb"},
    {"url": "https://www.google.com/travel/flights?q=Flights+from+CDG+to+JFK+on+2026-11-12&curr=EUR"}
  ],
  "maxResults": 20,
  "includeBookingDetails": true,
  "maxBookingDetails": 5
}
```

Paste actual copied Google Flights `tfs` search links to preserve complex filters. URL strings and `{ "url": "…" }` objects are accepted. Empty `startUrls` uses the form instead. HTTPS `google.com` and `www.google.com` flight/Explore links are supported; arbitrary websites and URLs with every flight already selected are rejected. A URL with an outbound selected can retrieve return alternatives. Optional lookups require decodable route/date information; opaque text searches may provide only the original page results.

### Search from the form

Enter From, To and Departure date. Add Return date for a round trip. Use future dates in `YYYY-MM-DD` format; replace the example dates with your travel dates.

```json
{
  "origin": "London",
  "destination": "JFK,EWR",
  "departureDate": "2026-11-10",
  "returnDate": "2026-11-17",
  "adults": 2,
  "cabinClass": "economy",
  "stops": "nonstop",
  "currency": "GBP",
  "includeBookingDetails": true,
  "maxResults": 10
}
```

Airports accept IATA codes, comma-separated groups, or complete city/country names. Separate several names with semicolons. City names can be disambiguated with a country, for example `Paris, France`. London, Paris, New York, Tokyo, Chicago and Washington include their metropolitan airport groups; other cities use matching airports. Country groups can produce large searches.

#### Batch and flexible-date searches

`queries` contains independent searches inheriting shared top-level defaults. Each entry overrides the fields it supplies. `flexDays` searches 0–7 days on either side of departure and moves a return date by the same amount, keeping trip length. Past expanded dates are skipped. There are at most 100 expanded searches; up to two independent search requests can run concurrently. Requests within one Google session remain serialized to limit rate limiting.

```json
{
  "origin": "LHR",
  "departureDate": "2026-11-10",
  "currency": "GBP",
  "queries": [
    {"destination": "JFK", "returnDate": "2026-11-17"},
    {"destination": "DXB", "cabinClass": "business"},
    {"destination": "CDG", "flexDays": 1}
  ],
  "maxResults": 20
}
```

`maxResults` limits how many unique primary flight rows are saved **from each search**; it is not a cap for the whole run. Each input URL is one search, and each date generated by `flexDays` is another. For example, `flexDays: 1` creates up to three date searches (the requested date plus one day before and after). With `maxResults: 5`, those searches can save up to 15 primary flight rows. The actual number may be lower if fewer flights are found or a flight was already saved by another search. This setting controls saved rows, not charges: each date search incurs a `flight-search` event charge whether it saves 0, 5 or fewer than 5 rows. Calendar prices, return alternatives and booking lookups have separate limits and charges; see [Simple event pricing](#simple-event-pricing).

#### Multi-city journeys

Supply 2–6 ordered legs, one per line in the multi-city input. This overrides the single-route fields. Prices describe the selected complete journey, rather than a sum of independent one-way quotations.

```json
{
  "multiCityLegs": [
    "LHR-CDG-2026-11-10",
    "CDG-AMS-2026-11-13",
    "AMS-LHR-2026-11-16"
  ],
  "includeBookingDetails": true,
  "maxResults": 5
}
```

### Search inputs

Search fields can be shared at the top level or overridden inside `queries`. URL mode overrides these fields.

| Input | Default | Behavior |
|---|---|---|
| `startUrls` | `[]` | One or more Google Flights URLs; when populated, URLs supply the route, dates, passengers, cabin, filters and locale and override the other search fields. |
| `origin`, `destination` | Required for route searches | Airport, group, city or country. |
| `departureDate`, `returnDate` | Departure required; return omitted | Future ISO dates; omit return for one-way. |
| `multiCityLegs` | Omitted | 2–6 ordered `ORIGIN-DESTINATION-YYYY-MM-DD` strings. |
| `queries`, `flexDays` | Single search; `0` | Batch routes and nearby dates. |
| `adults`, `children`, `infantsInSeat`, `infantsOnLap` | `1`, `0`, `0`, `0` | Maximum 9 passengers total; infants cannot outnumber adults. |
| `cabinClass` | `economy` | `economy`, `premium economy`, `business`, `first`. |
| `stops` | `any` | `nonstop`, `one`, `two`, or `any`; one/two mean maximum stops. |
| `airlines` | `[]` | Exact airline names or IATA codes; any matching carrier qualifies. |
| `alliances` | `[]` | `ONEWORLD`, `SKYTEAM`, `STAR_ALLIANCE`; Google applies these filters. |
| `excludeAirlines` | `[]` | Excluded carrier codes/names or alliances. |
| `maxPrice` | Omitted | Maximum quoted fare; excludes unpriced options. |
| `outboundDepartureTime`, `outboundArrivalTime` | Omitted | Airport-local window, e.g. `06:30-18:00`; overnight windows supported. |
| `returnDepartureTime`, `returnArrivalTime` | Omitted | Equivalent return-direction windows. |
| `maxDurationHours` | Omitted | Duration per direction including connections. |
| `connectOnlyVia`, `neverConnectVia` | `[]` | Connection airport allow/exclude lists; nonstop flights still qualify. |
| `minLayoverHours`, `maxLayoverHours` | Omitted | Connection duration bounds; fractional hours accepted. |
| `checkedBags`, `carryOnBags` | `0` | Ask Google to include known bag fees, capped at one per seated passenger. |
| `excludeBasicEconomy`, `lessEmissionsOnly` | `false` | Exclude basic fares; require reported lower-than-typical emissions. |
| `sortBy` | `top` | `top`, `price`, `departure`, `arrival`, `duration`, `emissions`. |
| `currency`, `language`, `country` | `USD`, `en`, `us` | Requested currency and search locale. Output currency follows the actual fare. |
| `searchMode` | `structured` | Structured Google URL; `natural` uses text search. |
| `maxResults` | `100` | Save up to 1–1000 unique primary flight rows from each search. Every URL and each `flexDays` date is a separate search, so this is not a run-wide cap. Does not change event charges. |
| `showAllResults` | `false` | Request Google's expanded result set before filtering and limiting. |
| `includeBookingDetails`, `maxBookingDetails` | `false`, `10` | Optionally retrieve booking offers. Each issued itinerary lookup is a charged event; set the limit to `0` to disable. See [Booking providers and return flights](#booking-providers-and-return-flights). |
| `returnFlightsTop`, `returnFlightsPerOutbound` | `0`, `5` | Optionally search return alternatives for leading outbound results. See [Booking providers and return flights](#booking-providers-and-return-flights). |
| `includeCalendarPrices`, `calendarMode`, `calendarDays` | `false`, `graph`, `7` | Optionally retrieve date prices using `graph`, `grid` or `picker`. Graph/picker allow 1–90 days; grid uses an odd window up to 15 days per direction. |
| `priceGraphDays` | `0` | Optional forward price graph of up to 330 days when `includeCalendarPrices` is off. |
| `exploreDestinations`, `exploreRegion`, `exploreMonth`, `exploreTripLength` | `false`, `anywhere`, `next_6_months`, `1_week` | Discover and price destinations from an origin. See [Explore destinations](#explore-destinations). |
| `maxExploreDestinations` | `10` | Price 1–30 discovered destinations per query. |
| `includeLccFares` | `false` | Add the optional, separately labelled Ryanair fare supplement when the route and passenger settings are supported. |

Bag allowances, basic-fare labels and alliance memberships depend on Google's response. Time and duration filters are also checked against returned segments where available. Missing details are not invented.

### Booking providers and return flights

`includeBookingDetails: true` selects complete round-trip itineraries before looking up airline/OTA offers. One-way and multi-city bookings are supported too. Rows can include provider names, prices, fare names, available baggage fees, direct booking links and booking-form handoff data. `bookingStatus` distinguishes successful, unavailable and failed lookups; a lookup failure retains the flight.

Set `maxBookingDetails` to bound lookups per search (default 10, maximum 20; zero disables them); the run-wide cap is also 20 itineraries. Booking lookups use a conservative concurrency of 3; requests sharing a connection session are serialized. Provider links may expire or require the supplied form fields. This Actor retrieves offers and does not purchase tickets.

Without booking lookup, a round-trip primary result describes an outbound option with Google's quoted round-trip price. Set `returnFlightsTop` to retrieve return alternatives for the leading N outbound options, with `returnFlightsPerOutbound` alternatives each (default 5). Additional `return-flight` records contain both directions and their combined quotation, plus the selected outbound identity, index and embedded `outboundFlight` (the identity need not refer to a separately saved row). Multi-city/complete-trip selection is bounded to leading choices; it does not enumerate every possible combination.

### Calendar, price graph and date grid

```json
{
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "2026-11-10",
  "returnDate": "2026-11-17",
  "includeCalendarPrices": true,
  "calendarMode": "grid",
  "calendarDays": 3,
  "maxResults": 5
}
```

- `graph` (default) varies departure dates and keeps trip length fixed.
- `grid` varies departure and return independently around the requested dates. Use an odd window of at most 15 days; a round-trip grid can require window-squared searches.
- `picker` emits departure/return date pairs with the same trip length.

`calendarDays` defaults to 7 and accepts up to 90 for graph/picker. Alternatively, `priceGraphDays` requests a forward graph of up to 330 dates when `includeCalendarPrices` is off. Multi-city calendars cover the first route. Empty dates have null prices; a failed calendar lookup retains primary flight results and adds a warning.

Calendar work is optional and billed by priced date or date pair. Graph and picker modes can return prices in batches; billing counts each priced point returned, while grid mode checks each valid outbound/return pair separately. Optional work shares a run-wide cap of 500 additional fare checks, so very wide calendars may stop early. The summary records the cap warning and saved rows.

### Explore destinations

Discover and price destinations from an origin without choosing a destination:

```json
{
  "origin": "LHR",
  "exploreDestinations": true,
  "exploreRegion": "europe",
  "exploreMonth": "november",
  "exploreTripLength": "1_week",
  "currency": "GBP",
  "maxResults": 10
}
```

`exploreRegion` accepts `anywhere`, `europe`, `asia`, `middle_east`, `africa`, `north_america`, `central_america_caribbean`, `south_america`, `oceania`. `exploreTripLength` accepts `weekend` (3 days), `1_week`, `2_weeks`, `one_way`.

Explicit departure/return dates take precedence. Without departure dates, `exploreMonth` is a month name or `next_6_months` (default). A named month compares available calendar dates in its next occurrence. The six-month setting uses Google's suggested destination dates; it is not an exhaustive scan of every date. Destination discovery and pricing are source-dependent; results are `explore-destination` rows.

`maxExploreDestinations` defaults to 10 and accepts 1–30 candidates to price per Explore query. Discovery may return more candidates, but pricing is deliberately bounded. Each candidate price lookup, and each priced calendar date used for a named month, uses the same 500-check run cap.

### Output and controls

| Input | Default | Behavior |
|---|---|---|
| `includeRawData` | `true` | Preserve HTML, decoded bootstrap blocks and optional RPC responses in `SEARCH_*` key-value records. |
| `output_file` | Omitted | Optional JSON key/filename, e.g. `flights.json`; also writes `EXPORT`. |

The dataset mixes records only when you enable additional features. Filter on `recordType`: `flight`, `return-flight`, `calendar`, `price-graph`, or `explore-destination`. Flight rows contain stable `id`, `price`, `currency`, airports, dates/times, duration, stops, airlines, flight numbers, aircraft, legroom, amenities, layovers and emissions where supplied. `segments` include airport-local ISO datetimes, time zones and UTC offsets when the airport is known. Complete journeys also have ordered `legs` and `completeItinerary`. `scrapedAt`, `source`, search metadata and `rawDataKey` identify provenance where available.

Use JSON exports for nested legs, segments and provider offers; Apify also supports CSV, Excel and HTML. Its API tab supplies programmatic examples, and scheduled runs can feed fare-monitoring or AI workflows. Prices are snapshots, can be null, and can change before booking.

### Summaries, retries and billing

`RUN_SUMMARY` reports completed, failed and skipped searches, actual saved record counts, price insights and optional-feature warnings. Empty flight results are retried as a potentially incomplete response; `emptyResultSearchesRetried` counts affected searches. After Crawlee's per-request retries, the Actor automatically makes one additional pass over searches that still failed, using a fresh proxy session. `automaticRetryPasses` and `automaticallyRetriedSearches` report that work. If the fresh pass is still empty, the search is recorded as completed with zero results. Inspect the summary before assuming every search succeeded. `FAILED_INPUT` contains only searches still failing after automatic retries, preserving URL precedence or resolved routes and operational settings. Successful rows stay in the dataset; manually rerunning `FAILED_INPUT` creates a new dataset, so merge results by `id`.

#### Simple event pricing

| Charge event | Price | What is counted |
|---|---:|---|
| `flight-search` | **$0.005** | One successfully processed input URL or route/date query. Each distinct batch item and each flexible-date expansion is a separate search. Result count does not change the price. |
| `additional-fare-check` | **$0.002** | One extra priced unit beyond the base query: a calendar date/date pair from a flexdays query, a return search for one outbound, one itinerary continuation, one priced Explore destination, or one direct Ryanair route/date request. |
| `booking-lookup` | **$0.01** | One complete itinerary sent for booking offers. The charge is per itinerary lookup, not per airline or OTA returned. |

#### Worked cost examples

All estimates below assume the requested work returns the full number of priced items shown. They exclude Apify compute usage and stop earlier if your Apify run charge limit is lower.

| Use case and relevant inputs | Calculation | Estimated Actor charge |
|---|---|---:|
| Basic route/date search, no add-ons | 1 × $0.005 | **$0.005** |
| Five booking lookups (`includeBookingDetails: true`, `maxBookingDetails: 5`) | $0.005 + (5 × $0.01) | **$0.055** |
| Seven-date graph (`includeCalendarPrices: true`, `calendarMode: "graph"`, `calendarDays: 7`) | $0.005 + (7 × $0.002) | **$0.019** |
| Return searches for five outbounds (`returnFlightsTop: 5`) | $0.005 + (5 × $0.002) | **$0.015** |
| Ten Explore destinations (`exploreMonth: "next_6_months"`, `maxExploreDestinations: 10`) | $0.005 + (10 × $0.002) | **$0.025** |
| Three flexible dates on either side (`flexDays: 3`), no add-ons | 7 searches × $0.005 | **$0.035** |
| 15 × 15 grid (`calendarMode: "grid"`, `calendarDays: 15`) | $0.005 + (225 × $0.002) | **up to $0.455** |

The 15 × 15 grid has at most 225 date pairs, so one base search plus all 225 checks can cost up to **$0.455**. The run-wide cap of **500 additional fare checks per run** allows this full grid to finish and applies across every optional fare-check feature in the run. Set `calendarDays` lower to reduce cost and runtime. A round-trip grid can have fewer than 225 valid pairs because pairs where the return date is before departure are skipped.

#### Inputs to demonstrate each charge event

Run these as **three separate runs** so each event type is easy to identify. Check `RUN_SUMMARY` for `chargedSearches`, `additionalFareChecksCharged` and `bookingLookupsCharged`; the run's billing details show the actual charges.

**1. Base search only — one `flight-search` event ($0.005):**

```json
{
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "2026-11-10",
  "currency": "GBP",
  "maxResults": 5
}
```

**2. Booking lookup — one base event plus up to one `booking-lookup` event ($0.015 total):**

```json
{
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "2026-11-10",
  "currency": "GBP",
  "includeBookingDetails": true,
  "maxBookingDetails": 1,
  "maxResults": 5
}
```

The booking event is charged only if the search returns an eligible flight with a booking token. If `bookingLookupsCharged` is zero, try another date or raise `maxBookingDetails` to 5.

**3. Additional fare checks — one base event plus nine grid checks (up to $0.023 total):**

```json
{
  "origin": "LHR",
  "destination": "JFK",
  "departureDate": "2026-11-10",
  "returnDate": "2026-11-24",
  "currency": "GBP",
  "includeCalendarPrices": true,
  "calendarMode": "grid",
  "calendarDays": 3,
  "maxResults": 5
}
```

This requests a 3 × 3 window of outbound and return dates. With these dates, all nine pairs are valid; each pair is an `additional-fare-check` event. The run summary should show `additionalFareChecksCharged: 9` if all checks fit within your Apify spending limit.

#### How the caps relate to input options

- **Calendar:** `calendarDays` defaults to 7. Graph and picker accept up to 90 dates; grid accepts at most 15 days per direction. Each priced date or valid date pair uses the shared 500-check cap. `priceGraphDays` can request up to 330 dates, but its output is still bounded by the same cap.
- **Booking:** `maxBookingDetails` defaults to 10 and accepts up to 20 per search. A separate run-wide cap also stops all searches after 20 booking lookups. A fixed concurrency of 3 affects how quickly they run, not how many are billed.
- **Return alternatives:** `returnFlightsTop` selects outbounds to check and `returnFlightsPerOutbound` limits alternatives returned for each. One check is billed per outbound search, regardless of the number of alternatives it returns; the 500-check run cap applies.
- **Explore:** `maxExploreDestinations` defaults to 10 and accepts 1–30 candidates per query. A named month can also generate calendar date checks; those share the 500-check cap with destination lookups and all other fare checks in the run.
- **Batch and flexible dates:** Each successfully processed distinct route/date query is a $0.005 base search. `flexDays` expands one query into nearby dates; each processed date is billed separately. Any add-ons use their own events and caps.
- **Result counts:** `maxResults` limits primary flight rows. It does not limit calendar points, booking lookups or other add-on work; use the options above and Apify's maximum run charge to control those costs.

Base responses that fail validation or exhaust retries before a valid result is extracted are not charged. A booking lookup is charged when it is issued; transient retries for that lookup are included. If a cap or Apify's run charge limit is reached, remaining work is skipped and `RUN_SUMMARY.billingWarnings` explains why. Results already collected remain available. The published Pricing tab is authoritative for current rates; platform compute usage is separate from event charges.

#### Built for repeatable business workflows

This Actor is aimed at teams that want one configurable feed for recurring analysis and downstream systems:

- Start with copied Google Flights URLs to preserve Google-side filters, or build searches from structured fields; submit multiple routes and flexible-date expansions in one run.
- Apply business-oriented constraints such as cabin, carriers/alliances, bag requirements, basic-economy exclusion, connection airports, per-direction time windows and itinerary duration.
- Request complete multi-city journeys, booking offers and baggage fees, return alternatives, date-price records, or Explore destinations as explicit add-ons with understandable event charges and hard ceilings.
- Store normalized itinerary rows with stable IDs, complete segments and provenance, alongside run summaries and retry input. This supports scheduled price monitoring, route and policy analysis, travel-product APIs, and data warehouse ingestion without treating a whole page of flights as one opaque result.

#### Considerations

Google's undocumented interfaces and availability can change. Market and network location can affect results. Booking details, fare attributes and optional lookups are returned when supplied; missing data and failed enrichment are reported rather than fabricated. Confirm final prices and conditions with the provider. This Actor is not affiliated with Google.

### AI agents and integrations

Connect chat clients such as Claude and ChatGPT to this Apify scrapper through the Apify MCP server.

# Actor input Schema

## `startUrls` (type: `array`):

Paste one or more Google Flights search URLs. When this field is populated, the other search inputs are ignored: routes, dates, queries, passengers, cabin, filters, currency, language and country come from each URL. You do not need to clear the form. Result limits, optional output lookups and raw-response storage still apply. Accepts copied tfs links or q search links; HTTPS google.com/www.google.com only.

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

One IATA code, a comma-separated airport group, or a complete city/country name. Separate several names with semicolons. Ignored when Google Flights URLs are populated.

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

One IATA code, a comma-separated airport group, or a complete city/country name. Separate several names with semicolons. Ignored when Google Flights URLs are populated.

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

Outbound date in YYYY-MM-DD format. Ignored when Google Flights URLs are populated.

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

Return date in YYYY-MM-DD; omit for one-way. Ignored when Google Flights URLs are populated.

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

Ordered journey, 2–6 legs, one ORIGIN-DESTINATION-YYYY-MM-DD per line. Overrides From/To/dates; the runtime also accepts leg objects in JSON. Ignored when Google Flights URLs are populated.

## `queries` (type: `array`):

Independent searches inheriting shared route and filter defaults. Each entry overrides only its own fields. Up to 100 searches after flexible-date expansion. Ignored when Google Flights URLs are populated.

## `flexDays` (type: `integer`):

Search this many days either side of departureDate; shift returnDate by the same amount to preserve trip length. Makes additional searches. Ignored when Google Flights URLs are populated.

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

Adults. Ignored when Google Flights URLs are populated.

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

Children. Ignored when Google Flights URLs are populated.

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

Infants in seat. Ignored when Google Flights URLs are populated.

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

Infants on lap. Ignored when Google Flights URLs are populated.

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

Requested travel class. Ignored when Google Flights URLs are populated.

## `stops` (type: `string`):

Maximum number of stops. Ignored when Google Flights URLs are populated.

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

Keep itineraries containing at least one listed airline name or IATA airline code. Applied after fetching. Ignored when Google Flights URLs are populated.

## `alliances` (type: `array`):

ONEWORLD, SKYTEAM or STAR_ALLIANCE. Combines with Airlines using either-match logic. Ignored when Google Flights URLs are populated.

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

Airline IATA codes, exact carrier names, or alliance names to exclude. Ignored when Google Flights URLs are populated.

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

Keep only fares at or below this total in the requested currency. Applied after fetching. Ignored when Google Flights URLs are populated.

## `outboundDepartureTime` (type: `string`):

Airport-local hours or HH:MM, for example 6-12, 18:30-23:00 or 22-6 across midnight. Ignored when Google Flights URLs are populated.

## `outboundArrivalTime` (type: `string`):

Airport-local window, such as 8-20 or 08:30-20:00. Ignored when Google Flights URLs are populated.

## `returnDepartureTime` (type: `string`):

Airport-local departure window for the return direction. Ignored when Google Flights URLs are populated.

## `returnArrivalTime` (type: `string`):

Airport-local arrival window for the return direction. Ignored when Google Flights URLs are populated.

## `maxDurationHours` (type: `number`):

Maximum duration per direction including layovers. Ignored when Google Flights URLs are populated.

## `connectOnlyVia` (type: `array`):

Only use these IATA airports for connections. Nonstop options still qualify. Ignored when Google Flights URLs are populated.

## `neverConnectVia` (type: `array`):

Exclude connections at these IATA airports. Ignored when Google Flights URLs are populated.

## `minLayoverHours` (type: `number`):

Minimum connection time; fractional hours such as 1.5 are accepted. Ignored when Google Flights URLs are populated.

## `maxLayoverHours` (type: `number`):

Maximum connection time; fractional hours are accepted. Ignored when Google Flights URLs are populated.

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

Ask Google to include known checked-bag fees. Capped at one per seated passenger. Ignored when Google Flights URLs are populated.

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

Ask Google to include known carry-on fees. Capped at one per seated passenger. Ignored when Google Flights URLs are populated.

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

Ask Google to exclude basic-economy fares. Ignored when Google Flights URLs are populated.

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

Keep only flights with lower-than-typical reported emissions. Ignored when Google Flights URLs are populated.

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

Sort before the per-search result limit. Top preserves Google ordering. Ignored when Google Flights URLs are populated.

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

Three-letter output currency. Ignored when Google Flights URLs are populated.

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

Two-letter search context country. Ignored when Google Flights URLs are populated.

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

Language or locale tag, such as en, en-GB, de or fr. Ignored when Google Flights URLs are populated.

## `exploreDestinations` (type: `boolean`):

Discover destinations from From, price their suggested or requested dates, and return explore-destination records. To is ignored. Ignored when Google Flights URLs are populated.

## `maxExploreDestinations` (type: `integer`):

Maximum number of discovered destinations to price per Explore search. The run also has a shared cap of 500 additional fare checks.

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

Limit discovered destinations to this region. Ignored when Google Flights URLs are populated.

## `exploreMonth` (type: `string`):

Without departureDate: use Google suggested dates in the next six months, or compare prices in the selected calendar month. Ignored when Google Flights URLs are populated.

## `exploreTripLength` (type: `string`):

Without returnDate: one-way, weekend (3 days), one week or two weeks. Ignored when Google Flights URLs are populated.

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

Maximum unique primary flight rows saved from one search. Each input URL and each route/date created by flexDays is a separate search, so this is not a limit for the whole run. Example: flexDays=1 (search one day either side) creates up to 3 date searches; with maxResults=5, up to 15 primary flight rows can be saved. The row count does not set the charge: each date search is charged as a flight-search event. Calendar prices, return-flight searches and booking lookups have separate limits and charges.

## `showAllResults` (type: `boolean`):

Request the full result set Google supplies before filtering and limiting. Adds an HTTP lookup; availability is still source-dependent.

## `includeBookingDetails` (type: `boolean`):

Fetch airline/OTA fares, fare names, booking links, booking forms and available baggage fees for selected results. Round-trip lookups first select complete return itineraries. Failed lookups retain the flight with bookingStatus. Chargable Event: each lookup is an additional HTTP request. A run-wide hard cap allows at most 500 lookups total.

## `maxBookingDetails` (type: `integer`):

Only the first N eligible returned itineraries per search receive booking lookups. Default 10, maximum 20; zero disables them. A run-wide hard cap also allows at most 20 lookups total.

## `returnFlightsTop` (type: `integer`):

Round trips: price return alternatives for these leading outbound flights. One additional fare check is charged per outbound searched, regardless of alternatives returned; shared run cap is 500 checks.

## `returnFlightsPerOutbound` (type: `integer`):

Maximum alternatives saved per selected outbound.

## `includeCalendarPrices` (type: `boolean`):

Fetch cheapest available fares for nearby dates or departure/return pairs. Each priced date/pair is an additional fare check; a shared cap allows up to 500 per run. Calendar failures retain flight results and appear in the run summary.

## `calendarMode` (type: `string`):

Graph varies departure dates and keeps trip length; grid independently varies both dates; picker emits fixed-length date pairs. Multi-city calendars cover the first route.

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

Graph/picker: number of dates (maximum 90). Grid: odd centered window per direction (maximum 15), up to 225 date pairs. All optional fare checks share a 500-per-run cap. Smaller windows reduce work and cost.

## `priceGraphDays` (type: `integer`):

Alternative graph window up to 330 dates, split into chunks. Priced dates share the 500 additional fare-check cap per run. Used when Include calendar prices is off. Zero disables it.

## `includeLccFares` (type: `boolean`):

Append separately labelled Ryanair fares for a single adult in economy on one airport pair, without bag-price filters. Other passenger/cabin configurations receive a summary warning. Does not fabricate group fares.

## `includeRawData` (type: `boolean`):

Save full Google responses separately in the key-value store. Dataset rows include a rawDataKey reference, never the raw flight array.

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

Structured encodes airports, dates, cabin, stops and passengers into the Google Flights tfs URL. Natural uses the legacy text query. Ignored when Google Flights URLs are populated.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.google.com/travel/flights?q=Flights+from+LHR+to+JFK&curr=GBP&hl=en&gl=gb"
    },
    {
      "url": "https://www.google.com/travel/flights?q=Flights+from+CDG+to+JFK&curr=EUR"
    }
  ],
  "flexDays": 0,
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "economy",
  "stops": "any",
  "airlines": [],
  "alliances": [],
  "excludeAirlines": [],
  "connectOnlyVia": [],
  "neverConnectVia": [],
  "checkedBags": 0,
  "carryOnBags": 0,
  "excludeBasicEconomy": false,
  "lessEmissionsOnly": false,
  "sortBy": "top",
  "currency": "USD",
  "country": "us",
  "language": "en",
  "exploreDestinations": false,
  "maxExploreDestinations": 10,
  "exploreRegion": "anywhere",
  "exploreMonth": "next_6_months",
  "exploreTripLength": "1_week",
  "maxResults": 100,
  "showAllResults": false,
  "includeBookingDetails": false,
  "maxBookingDetails": 10,
  "returnFlightsTop": 0,
  "returnFlightsPerOutbound": 5,
  "includeCalendarPrices": false,
  "calendarMode": "graph",
  "calendarDays": 7,
  "priceGraphDays": 0,
  "includeLccFares": false,
  "includeRawData": false,
  "searchMode": "structured"
}
```

# Actor output Schema

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

No description

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

No description

## `failedInput` (type: `string`):

Available when searches still fail after automatic retries. Download and use as input for a new run. Successful searches are excluded.

## `export` (type: `string`):

Present when output_file is supplied.

# 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 = {
    "startUrls": [
        {
            "url": "https://www.google.com/travel/flights?q=Flights+from+LHR+to+JFK&curr=GBP&hl=en&gl=gb"
        },
        {
            "url": "https://www.google.com/travel/flights?q=Flights+from+CDG+to+JFK&curr=EUR"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datasaurus/google-flights").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 = { "startUrls": [
        { "url": "https://www.google.com/travel/flights?q=Flights+from+LHR+to+JFK&curr=GBP&hl=en&gl=gb" },
        { "url": "https://www.google.com/travel/flights?q=Flights+from+CDG+to+JFK&curr=EUR" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("datasaurus/google-flights").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 '{
  "startUrls": [
    {
      "url": "https://www.google.com/travel/flights?q=Flights+from+LHR+to+JFK&curr=GBP&hl=en&gl=gb"
    },
    {
      "url": "https://www.google.com/travel/flights?q=Flights+from+CDG+to+JFK&curr=EUR"
    }
  ]
}' |
apify call datasaurus/google-flights --silent --output-dataset

```

## MCP server setup

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

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/cgo4MUolJ2b47aErZ/builds/wY6kup4bZmQ0FKU7f/openapi.json
