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

Find flight fares and schedules by airport name or IATA code, compare destinations and dates, and retrieve airport details.

- **URL**: https://apify.com/canadesk/google-flights.md
- **Developed by:** [Canadesk Support](https://apify.com/canadesk) (community)
- **Categories:** Travel, SEO tools
- **Features:** Full permissions
- **Stats:** 505 total users, 16 monthly users, 98.6% runs succeeded, 16 bookmarks
- **User rating**: 4.04 out of 5 stars

## Pricing

from $0.20 / 1,000 flight or airport results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

Collect fares and itineraries from **Google Flights**. Compare destinations and travel dates in one run, or look up airports by name or IATA code.

### Features

| **Process** | **What you get** |
| :--- | :--- |
| Get Flights by Airport IATA | Available one-way and return itineraries for airport codes |
| Get Flights by Airport name | Itineraries for matching airports or cities |
| Search Airports | Airport names, cities, codes and identifiers |
| Flight filters | Cabin, passengers, stops, airlines, alliances and maximum fare |

Fares and availability depend on the search date and source response. Name searches select the first matching airport; IATA codes give a more precise route.

### Quick start

```json
{
  "operation": "gfi",
  "departureIATA": "LAX",
  "arrivalIATA": ["LAS", "MUC"],
  "maximum": 3,
  "currency": "USD"
}
```

Omit `departureDate` to search 30 days from today. Set an explicit `YYYY-MM-DD` date for a specific trip. Add `arrivalDate` for a round trip. Use `departureDateRng` and `arrivalDateRng` to compare dates through the specified end dates. Dates must be within the next 330 days; return dates before departure are skipped.

Choose `gfi` for IATA codes, `gfn` for airport or city names, or `sa` for airport details. When a city has several airports, name search selects its first matching airport; use a specific IATA code for precise routing.

`maximum` limits flights per destination/date combination. `maxResults` limits real results across the run, and `maxSearches` limits destination/date combinations. Google's best flights are returned first; enable `includeOtherFlights` to include more options. Google may expose fewer flights than your chosen limit.

### Output

Each flight row includes the departure and arrival airports, dates, currency, fare, airlines, passenger counts, flight legs, outbound duration and a Google Flights search link. Legs include airport codes, local departure/arrival timestamps with time-zone offsets, carrier codes, flight numbers and aircraft codes when supplied.

For round trips, the actor selects the first available return option for each outbound option and reports that pair's quoted fare. `details.duration` describes the outbound journey. Fares are Google's quote for the requested passenger group and can change before booking; the search link is not a booking confirmation.

Airport mode returns `departure` and `arrival` objects for each requested pair.

### Search tips

Use IATA codes for the quickest searches. Broad date ranges and round trips require more searches. Airline codes override the alliance filter. Stops are `0` for any, `1` for nonstop, `2` for one stop or fewer, and `3` for two stops or fewer.

Direct connections are used by default. If Google blocks a run, select another proxy and try again. For support, share the run URL and the affected search.

#### Unsuccessful lookups

Where listed in the Pricing tab, a handled lookup problem that prevents a run from returning any real results produces one clear error record and a single $0.02 unsuccessful-lookup fee, in addition to any listed start fee.

### Pricing

Each valid pay-per-event run with at least one input includes a minimum charge of 100 result units, shared across all inputs in that run. Any placeholder rows are clearly marked and contain no scraped data; filter them out when exporting. Each separate run has its own minimum, including scheduled or API runs. Platform usage is included.

# Actor input Schema

## `operation` (type: `string`):

No description

## `departureIATA` (type: `string`):

No description

## `arrivalIATA` (type: `array`):

No description

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

Departure date (YYYY-MM-DD). Leave empty to search 30 days from today.

## `arrivalDate` (type: `string`):

Leave empty for One-way trips. Format: YYYY-MM-DD.

## `departureDateRng` (type: `string`):

Format: YYYY-MM-DD.

## `arrivalDateRng` (type: `string`):

Leave empty for One-way trips, or fixed return dates. Format: YYYY-MM-DD.

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

No description

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

Aged 2-11

## `seatclass` (type: `string`):

No description

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

Maximum real flight or airport results across all destinations and dates.

## `maximum` (type: `integer`):

Maximum flight options per destination and date pair.

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

No description

## `alliances` (type: `string`):

Filters out airlines that are not part of the alliance.

## `airlines` (type: `string`):

Only returns results for that specific airline, and overrides alliances. Format: ALL or 2-letters IATA code.

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

Maximum source fare in the selected currency for the requested passengers. Zero means no price limit.

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

No description

## `locale` (type: `string`):

May influence results.

## `includeOtherFlights` (type: `boolean`):

Include additional flight options after Google's best flights.

## `retries` (type: `integer`):

No description

## `delay` (type: `integer`):

Seconds between source requests.

## `maxSearches` (type: `integer`):

Maximum destination and date combinations to search.

## `proxy` (type: `object`):

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "operation": "gfi",
  "departureIATA": "LAX",
  "arrivalIATA": [
    "LAS",
    "MUC"
  ],
  "adults": 1,
  "children": 0,
  "seatclass": "1",
  "maxResults": 10000,
  "maximum": 3,
  "stops": "0",
  "alliances": "ALL",
  "airlines": "ALL",
  "maxPrice": 0,
  "currency": "USD",
  "locale": "en-US",
  "includeOtherFlights": false,
  "retries": 1,
  "delay": 3,
  "maxSearches": 1000,
  "proxy": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "departureIATA": "LAX",
    "arrivalIATA": [
        "LAS",
        "MUC"
    ],
    "airlines": "ALL",
    "currency": "USD",
    "proxy": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("canadesk/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 = {
    "departureIATA": "LAX",
    "arrivalIATA": [
        "LAS",
        "MUC",
    ],
    "airlines": "ALL",
    "currency": "USD",
    "proxy": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("canadesk/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 '{
  "departureIATA": "LAX",
  "arrivalIATA": [
    "LAS",
    "MUC"
  ],
  "airlines": "ALL",
  "currency": "USD",
  "proxy": {
    "useApifyProxy": false
  }
}' |
apify call canadesk/google-flights --silent --output-dataset

```

## MCP server setup

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