cd /news/ai-agents/scrape-google-flights-calendar-how-t… · home › topics › ai-agents › article
[ARTICLE · art-170525] src=serpapi.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Scrape Google Flights Calendar: How to Find the Cheapest Dates to Fly

SerpApi released a Google Flights Calendar API that returns per-date airfare prices as structured JSON or Markdown, with one entry per date in the requested range. On a test route from Paris Charles de Gaulle (CDG) to Austin-Bergstrom (AUS), a 7-day round trip cost $1,201 departing November 29 versus $757 departing December 2, and the API flags a date with low_price: true when its fare is within 5% of the lowest price in the range. The API defaults to round trips of 7 days spanning today through the end of next month, prices in USD, and is aimed at travel apps, fare alerts, and AI travel agents that need a cheapest-date lookup.

by read10 min views1 publishedNov 16, 2026
Scrape Google Flights Calendar: How to Find the Cheapest Dates to Fly
Image: Serpapi (auto-discovered)

When travelers have flexible dates or travel agencies are planning trips for clients, the first question isn’t “which flight?” but “which day is the cheapest?” Google Flights answers that with a calendar of prices showing one fare per date. On our test route, a 7-day round trip from Paris to Austin cost $1,201 leaving on November 29 and $757 leaving on December 2. If you’re building tools for these users such as a travel app, a fare alert, or an AI travel assistant, that per-date price view is often the most useful piece of flight data.

SerpApi's Google Flights Calendar API returns those calendar prices as structured JSON or Markdown. It consists of one entry per date, with the price for that day. You can use it to:

  • Show a flexible-date price grid in your app: Let users pick the cheapest day before they choose a flight.
  • Track a route's cheapest dates over time: Run the same request on a schedule and alert users when a low fare appears.
  • Give an AI travel agent a "when should I fly?" tool: Return the cheapest dates for a route in one request.

In this tutorial, you'll try the API in the playground and make your first request with cURL, Python, and JavaScript. Then you'll change the date range, trip type, and currency, and pass the cheapest date to the Google Flights API to see the actual flights.

What data can you retrieve with the Google Flights Calendar API? #

The response centers on one array, prices, with one entry for each date in the requested range.

  • Departure date:outbound_date , the day the trip starts.
  • Return date:return_date , included for round trips (the default trip type).
  • Price:price , a whole number in the selected currency. It defaults to USD.
  • Low-price flag:low_price appears astrue when a price is within 5% of the lowest price in the requested date range.

By default, the date range runs from today to the end of next month, and round trips last 7 days. See the Google Flights Calendar API documentation for every field and parameter.

How to scrape the Google Flights Calendar #

Try it in the playground

Open the SerpApi Playground with the google_flights_calendar engine. This link searches round trips from Paris Charles de Gaulle (CDG) to Austin-Bergstrom ( AUS). We'll use this route in every example below.

Run the search and look at the prices array. Each entry pairs an outbound_date and return_date with a price. To spot the cheapest days, looks for entries with "low_price": true . If you want different dates, pick your own start and end dates in the playground's date range fields.

departure_id and arrival_id take an uppercase 3-letter airport code, such as CDG or AUS. They also accept a location kgmid, such as /m/0vzm for Austin, TX, if you want to search from a city rather than one airport.

Get your API key

Create a SerpApi account, then copy your private key from the API key page. Set it as an environment variable so your code can read it:

export SERPAPI_API_KEY="YOUR_SERPAPI_API_KEY"

Replace YOUR_SERPAPI_API_KEY with your own key on your machine. Keep it private, and don't commit it to a repository.

Make a GET request

Besides your API key, the Google Flights Calendar API needs three parameters: engine=google_flights_calendar, departure_id, and arrival_id. The response is JSON by default:

https://serpapi.com/search?engine=google_flights_calendar&departure_id=CDG&arrival_id=AUS&api_key=YOUR_SERPAPI_API_KEY

To get Markdown instead, add output=md:

https://serpapi.com/search?engine=google_flights_calendar&departure_id=CDG&arrival_id=AUS&output=md&api_key=YOUR_SERPAPI_API_KEY

Markdown works well when you pass results to an LLM or AI agent, because it's compact and easy to read. Use JSON when your code needs exact values, such as a price for a specific date. Read more in the Markdown output documentation.

cURL implementation

Here's the same request with cURL. It reads your key from the environment variable you set earlier:

curl --get https://serpapi.com/search \
 -d engine="google_flights_calendar" \
 -d departure_id="CDG" \
 -d arrival_id="AUS" \
 -d api_key="$SERPAPI_API_KEY"
  • engine=google_flights_calendar selects the Google Flights Calendar API.
  • departure_id andarrival_id set the route.
  • api_key authenticates the request.

Python implementation

Install the official SerpApi Python library:

pip install serpapi

Create a file named main.py:

import os
import sys

import serpapi

client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"])

results = client.search({
    "engine": "google_flights_calendar",
    "departure_id": "CDG",
    "arrival_id": "AUS",
})

if "error" in results:
    sys.exit(f"Google Flights Calendar API: {results['error']}")

prices = results.get("prices", [])
if not prices:
    sys.exit("No prices were returned for this route and date range.")

for day in prices:
    marker = "  <- low price" if day.get("low_price") else ""
    print(f"{day['outbound_date']} to {day.get('return_date')} | ${day['price']}{marker}")

cheapest = min(prices, key=lambda day: day["price"])
print(f"\nCheapest: {cheapest['outbound_date']} to {cheapest.get('return_date')} for ${cheapest['price']}")

Run it:

python main.py

The script prints each outbound and return date with its price, marks the low-price days, and ends with the cheapest pair of dates. Prices are in USD because that's the default currency.

If the request fails, the response includes an error message, and the script prints it and stops. An empty prices array gets its own message, so "no prices for this route" never looks like a failed request.

In the example above, the cheapest calendar price ($757) matched the top best_flights price for those dates.

Export results to CSV

Each date is one row, so the calendar fits neatly into a spreadsheet. Add import csv at the top of main.py, then add this to the end. It reuses the prices variable from the request above:

with open("flight_calendar_prices.csv", "w", newline="", encoding="utf-8") as file:
    writer = csv.writer(file)
    writer.writerow(["outbound_date", "return_date", "price", "low_price"])

    for day in prices:
        writer.writerow([
            day.get("outbound_date"),
            day.get("return_date"),
            day.get("price"),
            day.get("low_price", False),
        ])

return_date is empty for one-way trips, and low_price is written as False when the flag isn't present.

Look up flights for the cheapest date

The calendar tells you when to fly. To see which flights are available on that date, pass the cheapest dates to the Google Flights API as outbound_date and return_date. Add this to the end of main.py. It reuses client and cheapest from above:

flights = client.search({
    "engine": "google_flights",
    "departure_id": "CDG",
    "arrival_id": "AUS",
    "outbound_date": cheapest["outbound_date"],
    "return_date": cheapest["return_date"],
})

for option in flights.get("best_flights") or flights.get("other_flights", []):
    print(option.get("price"), "-", option.get("total_duration"), "min")

This is a second search. Our Google Flights tutorial covers that response in detail.

JavaScript implementation

Install the official SerpApi JavaScript library:

npm install serpapi

Create a file named main.js:

async function main() {
  const { getJson } = await import("serpapi");

  const apiKey = process.env.SERPAPI_API_KEY;
  if (!apiKey) {
    throw new Error("Set the SERPAPI_API_KEY environment variable first.");
  }

  const results = await getJson({
    engine: "google_flights_calendar",
    departure_id: "CDG",
    arrival_id: "AUS",
    api_key: apiKey,
  });

  if (results.error) {
    throw new Error(`Google Flights Calendar API: ${results.error}`);
  }

  const prices = results.prices ?? [];
  if (prices.length === 0) {
    console.log("No prices were returned for this route and date range.");
    return;
  }

  for (const day of prices) {
    const marker = day.low_price ? "  <- low price" : "";
    console.log(`${day.outbound_date} to ${day.return_date} | $${day.price}${marker}`);
  }

  const cheapest = prices.reduce((low, day) => (day.price < low.price ? day : low));
  console.log(`\nCheapest: ${cheapest.outbound_date} to ${cheapest.return_date} for $${cheapest.price}`);
}

main().catch((error) => {
  console.error(error.message);
  process.exitCode = 1;
});

Run it:

node main.js

You'll see the same dates, prices, and cheapest pair as in the Python example.

Other languages and no-code options

SerpApi also has official libraries for other programming languages. Browse them on the integrations page.

If you'd rather not write code, you can call the Google Flights Calendar API from automation tools:

  • Make.com: Google APIs are called through the Universal "Make an API Call" module inSerpApi's Make.com app . Set the URL to/search.json and addengine=google_flights_calendar ,departure_id , andarrival_id as query parameters.
  • n8n:SerpApi's verified n8n node includes the Google Flights API, but its listed APIs don't include the calendar engine. Use n8n's HTTP Request node with your SerpApi credentials and setengine=google_flights_calendar .

Customize or filter the results #

Three groups of parameters shape the calendar:

  • date_range_start and date_range_end: Set the dates to price, in YYYY-MM-DD format.date_range_start defaults to today, anddate_range_end defaults to the end of next month.
  • type, round_trip_days, and fixed_outbound_date: type is1 for round trip (default) or2 for one way. For round trips,round_trip_days sets the trip length (default7 ). Alternatively, setfixed_outbound_date=true to depart ondate_range_start and get a price for eachreturn date instead. You can't combineround_trip_days andfixed_outbound_date , and both apply only to round trips.
  • currency: Returns prices in another currency. It defaults to USD.

This example prices 10-day round trips with departure dates from 30 to 90 days from today. It computes the dates at runtime, so they never go stale:

import os
from datetime import date, timedelta

import serpapi

client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"])

start = date.today() + timedelta(days=30)
end = start + timedelta(days=60)

results = client.search({
    "engine": "google_flights_calendar",
    "departure_id": "CDG",
    "arrival_id": "AUS",
    "date_range_start": start.isoformat(),
    "date_range_end": end.isoformat(),
    "round_trip_days": 10,
})

for day in results.get("prices", []):
    print(day["outbound_date"], day.get("return_date"), day["price"])

For a one-way trip priced in another currency, set type and currency. This request prices one-way flights from Karachi ( KHI) to Islamabad ( ISB) in Pakistani rupees:

https://serpapi.com/search?engine=google_flights_calendar&departure_id=KHI&arrival_id=ISB&type=2&currency=PKR&api_key=YOUR_SERPAPI_API_KEY

One-way entries have no return_date. You can also set travel_class (1 Economy to 4 First) and passenger counts (adults, children, infants_in_seat, infants_on_lap). See the documentation for the full list.

Conclusion #

You can now get prices for every date on a route with the Google Flights Calendar API, spot low-price days, and export the calendar to CSV. You can also change the date range, trip type, and currency, and pass the cheapest date to the Google Flights API to see the actual flights. The same request works in cURL, Python, and JavaScript, and it returns Markdown when you're feeding results to an LLM.

Next, open the Google Flights Calendar API playground and try a route you care about.

For more ways to work with flight data, see these tutorials:

Frequently asked questions #

What's the difference between the Google Flights API and the Google Flights Calendar API?

The Google Flights API returns the flights for specific dates, including airlines, times, layovers, and prices. The Google Flights Calendar API returns one price per date across a range, so you can find the cheapest dates first. Use the calendar to choose dates, then the Google Flights API to choose a flight.

Which dates does the API cover by default?

From today to the end of next month. Set date_range_start and date_range_end in YYYY-MM-DD format to price a different range.

What does low_price mean?

low_price is true when a date's price is within 5% of the lowest price in the requested date range. It's a quick way to highlight the cheapest days without comparing every price yourself.

Can I search from a city instead of a specific airport?

Yes. departure_id and arrival_id accept a location kgmid, a string that starts with /m/. For example, /m/0vzm is Austin, TX.

Can I get the results in Markdown for an LLM?

Yes. Add output=md to your request to get a compact Markdown version of the results. JSON remains the default and works better when your code needs exact values.

── more in #ai-agents 4 stories · sorted by recency
── more on @serpapi 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/scrape-google-flight…] indexed:0 read:10min 2026-11-16 · —