# Google Flights Scraper (`zerobreak/google-flights-scraper`) Actor

Google Flights scraper that collects itineraries, prices, airlines, durations, layovers, and carbon emissions for any route and date, so you can monitor fares, compare options, and build travel price trackers.

- **URL**: https://apify.com/zerobreak/google-flights-scraper.md
- **Developed by:** [ZeroBreak](https://apify.com/zerobreak) (community)
- **Categories:** Travel, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 11 total users, 0 monthly users, 96.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

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

Pulls flight itineraries from Google Flights into a structured dataset. Useful for price monitoring, travel research, route analysis, and building fare comparison tools.

### What it does

Search any route by airport IATA codes and date. Returns best flights and other available flights with full details: price, airlines, departure and arrival times, duration, layovers, cabin class, legroom, carbon emissions, and price insights.

### Example use cases

- Monitor flight prices for a route over time
- Find the cheapest or fastest options for a trip
- Compare nonstop vs. connecting flight prices
- Research carbon emissions by route
- Build a travel price tracker or fare alert tool

### Input

| Field | Description | Default |
|-------|-------------|---------|
| `departureId` | Origin IATA code (e.g., "JFK", "LHR", "IST"). Comma-separate for multi-airport (e.g., "JFK,LGA,EWR") | required |
| `arrivalId` | Destination IATA code. Multi-airport supported | required |
| `outboundDate` | Departure date in YYYY-MM-DD format | required |
| `returnDate` | Return date (YYYY-MM-DD). Required for round trips | — |
| `tripType` | 1=Round trip, 2=One way | `2` |
| `adults` | Adult passengers (1–9) | `1` |
| `children` | Child passengers (0–9) | `0` |
| `travelClass` | 1=Economy, 2=Premium economy, 3=Business, 4=First | `1` |
| `stops` | 0=Any, 1=Nonstop, 2=Max 1 stop, 3=Max 2 stops | `0` |
| `sortBy` | 1=Top, 2=Price, 3=Departure, 4=Arrival, 5=Duration, 6=Emissions | `1` |
| `includeAirlines` | Show only these airlines (comma-separated IATA, e.g., "DL,AA") | — |
| `excludeAirlines` | Hide these airlines (comma-separated IATA, e.g., "F9,NK") | — |
| `currency` | Price currency code (e.g., "USD", "EUR", "GBP", "TRY") | `USD` |
| `language` | Language code (e.g., "en", "de", "tr") | `en` |
| `country` | Country code (e.g., "us", "gb") | `us` |
| `maxItems` | Max itineraries to return | `20` |
| `requestTimeoutSecs` | Per-request timeout | `30` |

#### Example input — one way

```json
{
  "departureId": "JFK",
  "arrivalId": "LAX",
  "outboundDate": "2025-09-15",
  "tripType": 2,
  "adults": 1,
  "travelClass": 1,
  "stops": 1,
  "sortBy": 2,
  "currency": "USD",
  "maxItems": 30
}
```

#### Example input — round trip

```json
{
  "departureId": "LHR",
  "arrivalId": "JFK",
  "outboundDate": "2025-10-01",
  "returnDate": "2025-10-10",
  "tripType": 1,
  "adults": 2,
  "travelClass": 3,
  "currency": "GBP",
  "maxItems": 20
}
```

### Output

Each itinerary is one dataset record:

| Field | Description |
|-------|-------------|
| `rank` | Position in results (1-based) |
| `isBestFlight` | True if Google marked it as a best flight |
| `flightType` | "One way" or "Round trip" |
| `price` | Total price (numeric) |
| `currency` | Currency code |
| `totalDurationMins` | Total journey time in minutes |
| `stopCount` | Number of layovers |
| `airlines` | List of airlines operating the flight |
| `airlineLogo` | Primary airline logo URL |
| `bookingToken` | Google booking token |
| `departureToken` | Token for fetching return leg separately |
| `legs` | Array of flight leg objects (see below) |
| `layovers` | Array of layover objects |
| `carbonEmissionsGrams` | CO2 for this flight (grams) |
| `carbonEmissionsTypicalGrams` | Typical CO2 for this route (grams) |
| `carbonEmissionsDiffPercent` | % difference vs. typical |
| `lowestPrice` | Lowest price seen for this route |
| `priceLevel` | "low", "typical", or "high" |
| `typicalPriceRangeMin` / `typicalPriceRangeMax` | Typical price range |
| `searchRoute` | Route string (e.g., "JFK -> LAX") |
| `outboundDate` | Searched outbound date |
| `returnDate` | Searched return date (null if one way) |
| `scrapedAt` | ISO 8601 timestamp |

#### Leg object fields

| Field | Description |
|-------|-------------|
| `departureAirportCode` | IATA code |
| `departureAirportName` | Full airport name |
| `departureTime` | Datetime string (YYYY-MM-DD HH:MM) |
| `arrivalAirportCode` | IATA code |
| `arrivalAirportName` | Full airport name |
| `arrivalTime` | Datetime string |
| `durationMins` | Leg duration in minutes |
| `airline` | Airline name |
| `airlineLogo` | Airline logo URL |
| `flightNumber` | Flight number (e.g., "DL 123") |
| `airplane` | Aircraft type (e.g., "Boeing 737") |
| `travelClass` | Cabin class string |
| `legroom` | Legroom info (e.g., "31 in") |
| `isOvernight` | True if flight crosses midnight |
| `extensions` | Feature badges (e.g., "Wi-Fi", "In-seat power") |

#### Layover object fields

| Field | Description |
|-------|-------------|
| `airportCode` | IATA code |
| `airportName` | Airport name |
| `durationMins` | Layover duration in minutes |

#### Example output

```json
{
  "rank": 1,
  "isBestFlight": true,
  "flightType": "One way",
  "price": 149,
  "currency": "USD",
  "totalDurationMins": 356,
  "stopCount": 0,
  "airlines": ["Delta"],
  "airlineLogo": "https://www.gstatic.com/flights/airline_logos/...",
  "legs": [
    {
      "departureAirportCode": "JFK",
      "departureAirportName": "John F. Kennedy International Airport",
      "departureTime": "2025-09-15 08:00",
      "arrivalAirportCode": "LAX",
      "arrivalAirportName": "Los Angeles International Airport",
      "arrivalTime": "2025-09-15 11:56",
      "durationMins": 356,
      "airline": "Delta",
      "flightNumber": "DL 487",
      "airplane": "Boeing 757",
      "travelClass": "Economy",
      "legroom": "31 in",
      "isOvernight": false,
      "extensions": ["Wi-Fi for a fee", "In-seat power outlet"]
    }
  ],
  "layovers": [],
  "carbonEmissionsGrams": 126000,
  "carbonEmissionsTypicalGrams": 126000,
  "carbonEmissionsDiffPercent": 0,
  "lowestPrice": 149,
  "priceLevel": "low",
  "typicalPriceRangeMin": 180,
  "typicalPriceRangeMax": 320,
  "searchRoute": "JFK -> LAX",
  "outboundDate": "2025-09-15",
  "returnDate": null,
  "scrapedAt": "2025-06-01T14:32:00+00:00"
}
```

### Notes

- Results include both "best flights" (`isBestFlight: true`) and other available flights
- `stopCount` is derived from the number of layover entries
- `carbonEmissionsDiffPercent` is positive if this flight emits more than typical, negative if less
- Multi-city searches (`type: 3`) are not supported by the upstream API
- Prices fluctuate — run repeatedly to track fare changes over time
- Use comma-separated IATA codes in `departureId`/`arrivalId` for multi-airport searches (e.g., `"JFK,LGA,EWR"`)

# Actor input Schema

## `departureId` (type: `string`):

Origin airport IATA code. Supports multiple airports separated by commas (e.g., 'JFK,LGA,EWR' for New York area).

## `arrivalId` (type: `string`):

Destination airport IATA code. Supports multiple airports separated by commas (e.g., 'LAX,BUR,LGB' for Los Angeles area).

## `outboundDate` (type: `string`):

Departure date in YYYY-MM-DD format (e.g., '2026-09-15').

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

Return date in YYYY-MM-DD format. Required when trip type is Round trip.

## `tripType` (type: `string`):

One way or round trip.

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

Number of adult passengers (1–9).

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

Number of child passengers (0–9).

## `travelClass` (type: `string`):

Preferred cabin class.

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

Maximum number of stops.

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

Result sort order.

## `includeAirlines` (type: `string`):

Show only these airlines. Comma-separated IATA codes (e.g., 'DL,AA,UA'). Cannot be used with Exclude airlines.

## `excludeAirlines` (type: `string`):

Hide these airlines. Comma-separated IATA codes (e.g., 'F9,NK,SP'). Cannot be used with Include airlines.

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

Price currency code (e.g., 'USD', 'EUR', 'GBP', 'TRY').

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

Language code for results (e.g., 'en', 'de', 'tr').

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

Two-letter country code for geo-targeting (e.g., 'us', 'gb', 'de').

## `maxItems` (type: `integer`):

Maximum number of flight itineraries to return.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## Actor input object example

```json
{
  "departureId": "JFK, LHR, IST",
  "arrivalId": "LAX",
  "outboundDate": "2026-12-15",
  "tripType": "2",
  "adults": 1,
  "children": 0,
  "travelClass": "1",
  "stops": "0",
  "sortBy": "1",
  "currency": "USD",
  "language": "en",
  "country": "us",
  "maxItems": 20,
  "requestTimeoutSecs": 30
}
```

# 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 = {
    "departureId": "JFK, LHR, IST",
    "arrivalId": "LAX",
    "outboundDate": "2026-12-15",
    "currency": "USD",
    "language": "en",
    "country": "us"
};

// Run the Actor and wait for it to finish
const run = await client.actor("zerobreak/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 = {
    "departureId": "JFK, LHR, IST",
    "arrivalId": "LAX",
    "outboundDate": "2026-12-15",
    "currency": "USD",
    "language": "en",
    "country": "us",
}

# Run the Actor and wait for it to finish
run = client.actor("zerobreak/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 '{
  "departureId": "JFK, LHR, IST",
  "arrivalId": "LAX",
  "outboundDate": "2026-12-15",
  "currency": "USD",
  "language": "en",
  "country": "us"
}' |
apify call zerobreak/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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