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

Extract Google Flights prices, airlines, schedules, routes and fare data. Fast, reliable scraper with JSON output for travel apps and analytics.

- **URL**: https://apify.com/crawlio/google-flights-scraper.md
- **Developed by:** [Crawlio](https://apify.com/crawlio) (community)
- **Categories:** Travel, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 37 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.75 / 1,000 search 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

### Overview

Google Flights Scraper searches Google Flights and stores one dataset item per returned itinerary. It supports one-way and round-trip searches.

### Supported searches

- **One-way**: one origin, one destination, one departure date.
- **Round-trip**: one outbound leg and one return leg.

### Quick start

1. Open the Actor on Apify.
2. Select `oneWay` or `roundTrip`.
3. Enter airport IATA codes and dates in the selected search section.
4. Adjust passengers, cabin, filters, sorting, currency, and language in Global Settings.
5. Run the Actor and download results from the Dataset tab.

### Configuration

| Field | Description | Default |
| --- | --- | --- |
| `operation` | Search mode: `oneWay` or `roundTrip`. | `oneWay` |
| `origin`, `dest` | Three-letter IATA airport codes, for example `JFK` and `LHR`. | `JFK`, `LHR` |
| `date`, `returnDate` | Travel dates in `YYYY-MM-DD` format. Leave empty to use valid future dates automatically. | Empty |
| Global Settings | Shared passengers, cabin, filters, sorting, currency, and language used by all search modes. | Economy, USD, en-US |
| `seatClass` | `economy`, `premium-economy`, `business`, or `first`. | `economy` |
| `stops` | `0` any stops, `1` nonstop, `2` max one stop. | `0` |
| `sort` | `best`, `price`, or `duration`. | `best` |
| `currency`, `language` | Google Flights currency and locale, for example `USD` and `en-US`. | `USD`, `en-US` |

Proxy is handled automatically. The Actor starts without a proxy and retries with an internal Apify proxy session if Google blocks or limits the direct request.

### Usage examples

#### One-way input

```json
{
  "operation": "oneWay",
  "oneWay": {
    "origin": "JFK",
    "dest": "LHR",
    "date": ""
  },
  "adults": 1,
  "seatClass": "economy",
  "stops": 0,
  "sort": "best",
  "currency": "USD",
  "language": "en-US"
}
```

#### Round-trip input

```json
{
  "operation": "roundTrip",
  "roundTrip": {
    "origin": "JFK",
    "dest": "LHR",
    "date": "",
    "returnDate": ""
  },
  "adults": 1,
  "seatClass": "economy",
  "currency": "USD",
  "language": "en-US"
}
```

### Output Examples

Results are written to the default dataset. The key-value store record `OUTPUT` contains a compact run summary.

#### One-way output

```json
{
  "price": 77236,
  "airlines": ["Qatar Airways"],
  "departure": "2026-06-01T19:05",
  "arrival": "2026-06-02T14:05",
  "stops": 1,
  "duration_min": 850,
  "segments": [
    {
      "from": "DAC",
      "from_name": "Hazrat Shahjalal International Airport",
      "to": "DOH",
      "to_name": "Hamad International Airport",
      "departure": "2026-06-01T19:05",
      "arrival": "2026-06-01T21:55",
      "duration_min": 350,
      "plane": "Boeing 777"
    },
    {
      "from": "DOH",
      "from_name": "Hamad International Airport",
      "to": "LHR",
      "to_name": "Heathrow Airport",
      "departure": "2026-06-02T07:45",
      "arrival": "2026-06-02T14:05",
      "duration_min": 500,
      "plane": "Airbus A350"
    }
  ]
}
```

#### Round-trip output

```json
{
  "price": 862,
  "airlines": ["American"],
  "departure": "2026-06-01T19:20",
  "arrival": "2026-06-02T07:20",
  "stops": 0,
  "duration_min": 420,
  "segments": [
    {
      "from": "JFK",
      "from_name": "John F. Kennedy International Airport",
      "to": "LHR",
      "to_name": "Heathrow Airport",
      "departure": "2026-06-01T19:20",
      "arrival": "2026-06-02T07:20",
      "duration_min": 420,
      "plane": "Boeing 787"
    }
  ]
}
```

### Reliability notes

- Google Flights can return consent, verification, or incomplete pages from shared IPs.
- When that happens, the Actor retries automatically with a fresh Apify proxy session.

### Legal note

This Actor collects publicly available flight-search results. Make sure your use case complies with applicable laws, regulations, and website terms.

# Actor input Schema

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

Choose which search flow to run.

## `oneWay` (type: `object`):

Search one-way flights for a single leg.

## `roundTrip` (type: `object`):

Search round-trip flights with a departure date and a return date.

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

Number of adult passengers.

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

Number of child passengers.

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

Number of infants with their own seat.

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

Number of infants on lap (must be <= adults).

## `seatClass` (type: `string`):

Cabin class.

## `stops` (type: `integer`):

0 = any, 1 = nonstop, 2 = max 1 stop

## `preferred_airlines` (type: `string`):

Comma-separated airline codes or alliance names, for example BA,AA or STAR_ALLIANCE.

## `sort` (type: `string`):

Sorting preference.

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

Currency code used by Google Flights, for example USD, EUR, or BDT.

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

Language/locale code, for example en-US or en-GB.

## Actor input object example

```json
{
  "operation": "oneWay",
  "oneWay": {
    "origin": "JFK",
    "dest": "LHR",
    "date": ""
  },
  "roundTrip": {
    "origin": "JFK",
    "dest": "LHR",
    "date": "",
    "returnDate": ""
  },
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "seatClass": "economy",
  "stops": 0,
  "preferred_airlines": "",
  "sort": "best",
  "currency": "USD",
  "language": "en-US"
}
```

# Actor output Schema

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

One dataset item per returned itinerary.

## `runSummary` (type: `string`):

Short summary stored in the OUTPUT record of the default key-value store.

# 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 = {
    "oneWay": {
        "origin": "JFK",
        "dest": "LHR",
        "date": ""
    },
    "roundTrip": {
        "origin": "JFK",
        "dest": "LHR",
        "date": "",
        "returnDate": ""
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlio/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 = {
    "oneWay": {
        "origin": "JFK",
        "dest": "LHR",
        "date": "",
    },
    "roundTrip": {
        "origin": "JFK",
        "dest": "LHR",
        "date": "",
        "returnDate": "",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("crawlio/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 '{
  "oneWay": {
    "origin": "JFK",
    "dest": "LHR",
    "date": ""
  },
  "roundTrip": {
    "origin": "JFK",
    "dest": "LHR",
    "date": "",
    "returnDate": ""
  }
}' |
apify call crawlio/google-flights-scraper --silent --output-dataset

```

## MCP server setup

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