> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Scrape Google Flights Deals with a simple API
- URL: https://serpapi.com/blog/how-to-scrape-google-flights-deals/
- Published: 2026-07-11T05:36:29.000Z
- Updated: 2026-07-11T05:36:29.000Z
- Description: Learn how to get flights deals from Google Flights Deals website with a simple API using Python, JavaScript, or any other programming languages.
- Author: Hilman Ramadhan
- Tags: Flight Deals

Google Flights Deals helps travelers discover discounted flights without a specific destination. Instead of searching one route at a time, you can start with a departure airport or city and explore discounted destinations.

This data can be useful for building flight-deal trackers, [travel discovery tools](https://serpapi.com/use-cases/travel-information), [price-comparison](https://serpapi.com/use-cases/price-monitoring) dashboards, or destination-recommendation apps. In this tutorial, we'll use SerpApi's Google Flights Deals API to retrieve flight deals as structured JSON with cURL, Python, and JavaScript.

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/07/CleanShot-2026-07-11-at-12.46.20.png)

Scrape Google Flights Deals website

## How to use the Google Flights Deals API

A basic request uses these parameters:

| Parameter     | Requirement | Description                           |
| ------------- | ----------- | ------------------------------------- |
| engine        | Required    | Set to google\_flights\_deals         |
| api\_key      | Required    | Your private SerpApi API key          |
| departure\_id | Optional    | Departure airport code or location ID |
| currency      | Optional    | Currency used for returned prices     |

An airport ID is normally an uppercase three-letter IATA code such as:

- `CDG` for Paris Charles de Gaulle Airport
- `AUS` for Austin-Bergstrom International Airport
- `MAD` for Adolfo Suárez Madrid-Barajas Airport

You can also provide a Google location ID beginning with `/m/` or `/g/`. Multiple departure locations can be separated with commas.

### Get your API key

Create a SerpApi account and retrieve your private key from the [API key page](https://serpapi.com/manage-api-key).

Replace the following placeholder in each example:

```text
YOUR_SERPAPI_API_KEY

```

Never expose your API key in public source code or commit it to a public repository.

The complete parameter reference is available in the official [Google Flights Deals API documentation](https://serpapi.com/google-flights-deals-api).

### cURL implementation

Let's retrieve flight deals departing from Paris Charles de Gaulle Airport:

```bash
curl --get https://serpapi.com/search \
 -d engine="google_flights_deals" \
 -d departure_id="CDG" \
 -d currency="USD" \
 -d api_key="YOUR_SERPAPI_API_KEY"
```

The parameters in this request are:

- `engine=google_flights_deals` selects the Google Flights Deals engine.
- `departure_id=CDG` searches for deals departing from Paris Charles de Gaulle Airport.
- `currency=USD` returns prices in US dollars.

The API returns JSON by default.

### Python implementation

Create a new Python file:

```text
main.py

```

Install the `requests` package:

```bash
pip install requests

```

Add the following code:

```python
import requests

SERPAPI_API_KEY = "YOUR_SERPAPI_API_KEY"

params = {
    "engine": "google_flights_deals",
    "departure_id": "CDG",
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

response = requests.get(
    "https://serpapi.com/search",
    params=params,
    timeout=30,
)
response.raise_for_status()

data = response.json()

if "error" in data:
    raise RuntimeError(data["error"])

departure = data.get("departure_informations", {})

departure_name = (
    departure.get("airport_name")
    or departure.get("city")
    or "Unknown departure"
)

print(f"Flight deals from: {departure_name}")
print()

for deal in data.get("deals", []):
    duration = deal.get("flight_duration")

    if duration is not None:
        hours, minutes = divmod(duration, 60)
        formatted_duration = f"{hours}h {minutes}m"
    else:
        formatted_duration = "Not available"

    print("Destination:", deal.get("name", "Unknown"))
    print("Country:", deal.get("country", "Unknown"))
    print("Price:", deal.get("price", "Not available"))
    print(
        "Average price:",
        deal.get("average_price", "Not available"),
    )
    print(
        "Discount:",
        deal.get("discount_percentage", "Not available"),
    )
    print("Outbound date:", deal.get("outbound_date", "Not available"))
    print("Return date:", deal.get("return_date", "One-way flight"))
    print(
        "Route:",
        f"{deal.get('departure_airport_code', '?')} → "
        f"{deal.get('arrival_airport_code', '?')}",
    )
    print("Duration:", formatted_duration)
    print("Stops:", deal.get("stops", "Not available"))
    print("Airline:", deal.get("airline", "Not available"))
    print("Google Flights:", deal.get("flight_link", "Not available"))
    print("-" * 80)

```

The code prints selected fields from every item in the `deals` array. It also converts the documented `flight_duration` value from minutes into hours and minutes.

Here is the result

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/07/CleanShot-2026-07-11-at-13.17.39.png)

Flights Deals API scraper

Fields are accessed with `.get()` because some values are not guaranteed to appear in every deal.

### Export the flight deals to CSV

You can also save the results to a CSV file for further analysis:

```python
import csv

rows = []

for deal in data.get("deals", []):
    rows.append({
        "destination": deal.get("name", ""),
        "country": deal.get("country", ""),
        "destination_id": deal.get("destination_id", ""),
        "price": deal.get("price", ""),
        "average_price": deal.get("average_price", ""),
        "discount_percentage": deal.get(
            "discount_percentage",
            "",
        ),
        "outbound_date": deal.get("outbound_date", ""),
        "return_date": deal.get("return_date", ""),
        "departure_airport": deal.get(
            "departure_airport_code",
            "",
        ),
        "arrival_airport": deal.get(
            "arrival_airport_code",
            "",
        ),
        "flight_duration_minutes": deal.get(
            "flight_duration",
            "",
        ),
        "stops": deal.get("stops", ""),
        "airline": deal.get("airline", ""),
        "airline_code": deal.get("airline_code", ""),
        "google_flights_link": deal.get("flight_link", ""),
        "serpapi_flight_link": deal.get(
            "serpapi_flight_link",
            "",
        ),
    })

fieldnames = [
    "destination",
    "country",
    "destination_id",
    "price",
    "average_price",
    "discount_percentage",
    "outbound_date",
    "return_date",
    "departure_airport",
    "arrival_airport",
    "flight_duration_minutes",
    "stops",
    "airline",
    "airline_code",
    "google_flights_link",
    "serpapi_flight_link",
]

with open(
    "google_flights_deals.csv",
    "w",
    newline="",
    encoding="utf-8",
) as csv_file:
    writer = csv.DictWriter(
        csv_file,
        fieldnames=fieldnames,
    )
    writer.writeheader()
    writer.writerows(rows)

print(
    f"Saved {len(rows)} deals to "
    "google_flights_deals.csv"
)

```

This creates a file named `google_flights_deals.csv` with one row for each deal.

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/07/CleanShot-2026-07-11-at-13.20.31.png)

Exported result in CSV file

### JavaScript implementation

SerpApi provides an official [JavaScript package](https://github.com/serpapi/serpapi-javascript/).

Install it with npm:

```bash
npm install serpapi

```

Create an `index.js` file:

```javascript
const { getJson } = require("serpapi");

const SERPAPI_API_KEY = "YOUR_API_KEY";

getJson(
  {
    engine: "google_flights_deals",
    departure_id: "CGK",
    currency: "USD",
    api_key: SERPAPI_API_KEY,
  },
  (json) => {
    if (json.error) {
      console.error(json.error);
      return;
    }

    const departure = json.departure_informations || {};
    const deals = json.deals || [];

    console.log(
      `Flight deals from: ${
        departure.airport_name ||
        departure.city ||
        "Unknown departure"
      }\n`
    );

    deals.forEach((deal) => {
      console.log({
        destination: deal.name || "Unknown",
        country: deal.country || "Unknown",
        price: deal.price ?? "Not available",
        averagePrice:
          deal.average_price ?? "Not available",
        discountPercentage:
          deal.discount_percentage ?? "Not available",
        outboundDate:
          deal.outbound_date || "Not available",
        returnDate:
          deal.return_date || "One-way flight",
        route:
          `${deal.departure_airport_code || "?"} → ` +
          `${deal.arrival_airport_code || "?"}`,
        duration: deal.flight_duration ?? "Not available",
        stops: deal.stops ?? "Not available",
        airline: deal.airline || "Not available",
        flightLink: deal.flight_link || "Not available",
      });
    });
  }
);

```

Run the script:

```bash
node index.js

```

The official SerpApi JavaScript package exposes the `getJson` function and supports both callbacks and promises.

## Customize Google Flights Deals results

The API provides several ways to customize the returned deals. Here are three useful examples.

### Search using exact or flexible dates

For an exact round trip, provide one `outbound_date` and one `return_date` in `YYYY-MM-DD` format:

```python
params = {
    "engine": "google_flights_deals",
    "departure_id": "FCO",
    "outbound_date": "2026-08-10",
    "return_date": "2026-08-17",
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

```

For flexible dates, use two comma-separated dates as the departure window:

```python
params = {
    "engine": "google_flights_deals",
    "departure_id": "BCN",
    "outbound_date": "2026-09-01,2026-09-30",
    "travel_duration": 3,
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

```

Possible `travel_duration` values are:

| Value | Duration  |
| ----- | --------- |
| 1     | One week  |
| 2     | Weekend   |
| 3     | Two weeks |

You can alternatively use `trip_length` for a custom duration:

```python
params["trip_length"] = "5,10"

```

This requests trips lasting between 5 and 10 days.

`travel_duration`, `trip_length`, and `return_date` cannot be used together. For a round trip with one exact outbound date, one exact return date is required.

### Filter by stops and maximum price

Use `stops` to control how many connections are allowed:

| Value | Meaning             |
| ----- | ------------------- |
| 0     | Any number of stops |
| 1     | Nonstop only        |
| 2     | One stop or fewer   |
| 3     | Two stops or fewer  |

You can combine it with `max_price`:

```python
params = {
    "engine": "google_flights_deals",
    "departure_id": "CDG",
    "stops": 1,
    "max_price": 500,
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

```

This searches for nonstop deals costing no more than 500 in the selected currency.

### Include or exclude airlines

Use `include_airlines` to return deals from selected airlines:

```python
params = {
    "engine": "google_flights_deals",
    "departure_id": "/m/0947l",
    "include_airlines": "W4,FR",
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

```

The example includes:

- `W4` — Wizz Air
- `FR` — Ryanair

Multiple airline codes are separated with commas.

You can use `exclude_airlines` instead when you want to remove specific airlines from the results:

```python
params["exclude_airlines"] = "UA"

```

The `include_airlines` and `exclude_airlines` parameters cannot be used together.

The API also accepts the following alliance values:

- `STAR_ALLIANCE`
- `SKYTEAM`
- `ONEWORLD`

## Searching for one-way flight deals

Round trip is the default flight type. Set `type` to `2` to search for one-way deals:

```python
params = {
    "engine": "google_flights_deals",
    "departure_id": "MAD",
    "type": 2,
    "currency": "USD",
    "api_key": SERPAPI_API_KEY,
}

```

The supported values are:

| Value | Flight type |
| ----- | ----------- |
| 1     | Round trip  |
| 2     | One way     |

For a one-way search with a specific date, provide only `outbound_date`:

```python
params["outbound_date"] = "2026-09-15"

```

Do not use `return_date`, `travel_duration`, or `trip_length` with one-way flights. One-way deal results do not contain an `return_date`.

## What data can be retrieved from the Google Flights Deals API?

The API returns information about the departure location and a list of available flight deals.

The `departure_informations` object can include:

- Departure airport name and IATA code
- Departure city and city ID
- Departure country
- Airport latitude and longitude

The `deals` array can include:

- Destination name and country
- Destination Google Knowledge Graph ID
- Deal price
- Average price for the route
- Discount percentage
- Outbound and return dates
- Departure and arrival airport codes
- Flight duration in minutes
- Number of stops
- Airline name and code
- Destination description and highlights
- Destination thumbnail
- Direct Google Flights link
- SerpApi link for retrieving detailed flight information

Some fields, including `average_price`, `discount_percentage`, `airline`, and `description`, are not always present. The `return_date` field is also omitted for one-way flights.

Here is a simplified example of a deal:

```json
{
  "destination_id": "/m/0k02q",
  "name": "São Vicente",
  "country": "Cape Verde",
  "price": 468,
  "average_price": 2023,
  "discount_percentage": 77,
  "outbound_date": "2026-09-21",
  "return_date": "2026-09-27",
  "departure_airport_code": "CDG",
  "arrival_airport_code": "VXE",
  "flight_duration": 350,
  "stops": 0,
  "airline": "Cabo Verde Airlines",
  "airline_code": "VR",
  "flight_link": "https://www.google.com/travel/flights?..."
}

```

The main results are available inside the `deals` array.

## Scraping Google Flights

If you're interested in scraping the regular Google Flights website, we also have an API for that: [Google Flights API](https://serpapi.com/google-flights-api)  
  
Here is the blog tutorial on [how to scrape Google Flights](https://serpapi.com/blog/how-to-scrape-google-flights/).

Here is a video tutorial if you prefer to watch

## Conclusion

The SerpApi Google Flights Deals API makes it possible to retrieve Google Flights deal discovery results as structured JSON.

With one request, you can collect destinations, deal prices, average prices, discount percentages, travel dates, airport codes, airlines, flight durations, stops, and links to Google Flights.

You can also customize the search using exact dates, flexible date ranges, trip durations, maximum prices, stop limits, travel classes, and airline filters.

For the complete and current parameter list, review the official Google Flights Deals API documentation.