<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Truffle Pig Data</title>
    <description>The latest articles on DEV Community by Truffle Pig Data (@trufflepig).</description>
    <link>https://dev.to/trufflepig</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4032427%2Fd0090288-9c11-47e3-b5bc-5670ada11de5.png</url>
      <title>DEV Community: Truffle Pig Data</title>
      <link>https://dev.to/trufflepig</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/trufflepig"/>
    <language>en</language>
    <item>
      <title>How to Use the Google Flights API in 2026 (Python, MCP, and a No-Code Shortcut)</title>
      <dc:creator>Truffle Pig Data</dc:creator>
      <pubDate>Fri, 17 Jul 2026 02:50:22 +0000</pubDate>
      <link>https://dev.to/trufflepig/how-to-use-the-google-flights-api-in-2026-python-mcp-and-a-no-code-shortcut-1ej6</link>
      <guid>https://dev.to/trufflepig/how-to-use-the-google-flights-api-in-2026-python-mcp-and-a-no-code-shortcut-1ej6</guid>
      <description>&lt;p&gt;Getting live flight prices out of &lt;a href="https://www.google.com/travel/flights" rel="noopener noreferrer"&gt;Google Flights&lt;/a&gt; by hand is a grind. There is no public API to call, the search URL hides the whole query behind an opaque &lt;code&gt;tfs&lt;/code&gt; blob, and the page renders its results with JavaScript that fights simple scripts. I'll show the manual way and where it breaks, then a faster path, and a repo you can clone. The faster path uses the &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Flights API&lt;/a&gt; on Apify, which turns a route and a date into structured JSON.&lt;/p&gt;

&lt;p&gt;Disclosure: the Apify links in this post are affiliate links. If you run the Actor, I may earn a referral commission at no extra cost to you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Google Flights have an API?
&lt;/h2&gt;

&lt;p&gt;No. Google retired QPX Express in 2018 and has never shipped a public Google Flights API. There is no key to request and no endpoint to call, which is why a search for "google flights api" mostly turns up scraping libraries and hosted scrapers. So in practice a Google Flights API means a scraper you consume like an API: send a route and a date, get flights and prices back as JSON.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Google Flights API returns
&lt;/h2&gt;

&lt;p&gt;The Google Flights API returns every itinerary for a route as structured JSON: price, airlines, stops, duration, departure and arrival times, plus a price insight for the route and optional direct booking links.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;price&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;299&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Per the search currency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;airlines&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;AA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Operating carriers on the itinerary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;stops_label&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Nonstop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;With &lt;code&gt;stops&lt;/code&gt; as an integer too&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;5h 30m&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Total travel time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;price_insights&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{ "price_level": "typical", "typical_price_range": [299, 450] }&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Today's fare against a normal band&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;booking_url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.jetblue.com/booking/...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Direct link, one-way only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each dataset item is one page of results holding many flights, and the flat &lt;code&gt;all_flights&lt;/code&gt; array gives you one row per itinerary for easy loading into a table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who this is for
&lt;/h2&gt;

&lt;p&gt;Travel aggregators building fare comparison, indie developers tracking a route for a trip, analysts collecting pricing trends, and anyone wiring live fares into an AI agent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The manual way, and where it breaks
&lt;/h2&gt;

&lt;p&gt;The DIY route is to build the Google Flights URL yourself, render the page in a headless browser, and parse the result cards. It works in a quick local test, then falls over. The &lt;code&gt;tfs&lt;/code&gt; parameter is a Base64 blob you have to reverse-engineer for every filter. The results load through JavaScript, so a plain HTTP request comes back nearly empty. And the layout shifts often enough that your selectors rot within a few weeks. Add proxies and retries on top, and you're maintaining infrastructure instead of shipping your feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  The faster way: run the Google Flights scraper
&lt;/h2&gt;

&lt;p&gt;You send a documented JSON input and get a documented JSON output, with nothing to keep alive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apify Console&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Flights API&lt;/a&gt; and click Try for free.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;departure_id&lt;/code&gt;, &lt;code&gt;arrival_id&lt;/code&gt;, and &lt;code&gt;outbound_date&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run it and download the dataset as JSON, CSV, or Excel.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;REST&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/johnvc~Google-Flights-Data-Scraper-Flight-and-Price-Search/runs?token=YOUR_APIFY_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{ "departure_id": "JFK", "arrival_id": "LHR", "outbound_date": "2026-11-25", "max_pages": 1 }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Run endpoint reference: the &lt;a href="https://docs.apify.com/api/v2" rel="noopener noreferrer"&gt;Apify API docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Get Google Flights prices in Python
&lt;/h2&gt;

&lt;p&gt;Call the Actor with &lt;code&gt;apify-client&lt;/code&gt;. The flat &lt;code&gt;all_flights&lt;/code&gt; array is one row per itinerary:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;apify_client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ApifyClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ApifyClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_APIFY_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;run_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;departure_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;JFK&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arrival_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LHR&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;outbound_date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2026-11-25&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;max_stops&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;currency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;USD&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;max_pages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;defaultDatasetId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;iterate_items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;insights&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price_insights&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;insights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;lowest_price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;insights&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price_level&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;flight&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;all_flights&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[]):&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;flight&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;route&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;flight&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;flight&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;airlines&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;flight&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;stops_label&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;flight&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;duration&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;There is a ready-to-run version in the published task &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/examples/get-google-flights-prices-in-python?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Get Google Flights Prices in Python by API&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Track one route over time
&lt;/h2&gt;

&lt;p&gt;A single search answers one question. The value comes from running the same search on a schedule and watching the fare move. Save the run as a task, attach an Apify schedule with a cron expression like &lt;code&gt;0 7 * * *&lt;/code&gt;, and each run appends a fresh page with its own &lt;code&gt;search_timestamp&lt;/code&gt; and &lt;code&gt;price_insights&lt;/code&gt;, which gives you a fare history you can export. The worked example is the task &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/examples/track-nyc-to-london-flight-prices-by-api?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Track NYC to London flight prices by API&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Search several airports and multi-city trips
&lt;/h2&gt;

&lt;p&gt;Both &lt;code&gt;departure_id&lt;/code&gt; and &lt;code&gt;arrival_id&lt;/code&gt; accept comma-separated codes, so &lt;code&gt;CDG,ORY&lt;/code&gt; searches every Paris airport in one run. For multi-leg trips, pass &lt;code&gt;multi_city_json&lt;/code&gt; with a list of legs and the Actor prices the whole itinerary the way Google Flights does, including open-jaw routings. See the task &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/examples/find-cheap-flights-from-nyc-to-europe-by-api?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Find cheap flights from NYC to Europe by API&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Use it from Claude and other MCP clients
&lt;/h2&gt;

&lt;p&gt;Apify exposes the Actor through the Model Context Protocol, so Claude, Claude Code, and Cursor can run a live search mid-conversation and answer "what is the cheapest nonstop from JFK to LHR next month" with real data. The task &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/examples/use-google-flights-in-claude-via-mcp?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Use Google Flights in Claude via MCP&lt;/a&gt; has the config, and you can read more about Claude Code at &lt;a href="https://claude.ai/referral/uIlpa7nPLg" rel="noopener noreferrer"&gt;claude.ai&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The example repo
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/johnisanerd" rel="noopener noreferrer"&gt;
        johnisanerd
      &lt;/a&gt; / &lt;a href="https://github.com/johnisanerd/Apify-Google-Flights-API" rel="noopener noreferrer"&gt;
        Apify-Google-Flights-API
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Google Flights API on Apify - Python (uv) + MCP example. Flight and price search results as clean, structured JSON.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;
✈️ Google Flights API: Flight and Price Search in Clean JSON&lt;/h1&gt;
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;The most efficient, reliable, and developer-friendly way to use the Google Flights API.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Actor page:&lt;/strong&gt; &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search?fpr=9n7kx3" rel="nofollow noopener noreferrer"&gt;apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search&lt;/a&gt;
&lt;strong&gt;Input schema:&lt;/strong&gt; &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/input-schema?fpr=9n7kx3" rel="nofollow noopener noreferrer"&gt;apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search/input-schema&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The Google Flights API searches flights and returns clean, structured JSON. Each page of results comes back with the top recommended flights and alternatives, full flight legs and timings, prices, price insights (level and historical range), airport details, and search metadata. It supports one-way, round-trip, and multi-city itineraries, single or multiple airports, filters for price, stops, airlines, and passenger counts, and can optionally resolve direct airline and OTA booking links. Localized across 29+ languages and 39+ countries.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Video Walkthrough&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=jREWahDGhJM" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/8cf47ba7ea4f430827c72e9fb72707d7c32c2390c7e9f7018b411c2375009a34/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f6a52455761684447684a4d2f6d617872657364656661756c742e6a7067" alt="Watch the walkthrough"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Quick Start&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Prerequisites&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Python 3.11 or higher&lt;/li&gt;
&lt;li&gt;An Apify account and API key (&lt;a href="https://apify.com?fpr=9n7kx3" rel="nofollow noopener noreferrer"&gt;get a free key here&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clone the repository&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/johnisanerd/Apify-Google-Flights-API.git
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; Apify-Google-Flights-API&lt;/pre&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install dependencies with UV&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; Install UV if you do not have it:&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/johnisanerd/Apify-Google-Flights-API" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The repo has a Python quick start, the booking-options variant, and the MCP setup, so you can go from clone to first result in a few minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ about scraping Google Flights
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is the Google Flights scraper free, and how much does it cost?
&lt;/h3&gt;

&lt;p&gt;There is no free official API to compare against, so the honest answer is per-page billing. A typical search fits on one page and costs one page event, and &lt;code&gt;max_pages&lt;/code&gt; caps the spend before a run starts. New Apify accounts come with free platform credit, so early searches usually cost nothing out of pocket. The one setting that changes the math is &lt;code&gt;fetch_booking_options&lt;/code&gt;, since each resolved booking URL bills separately and a one-way search commonly returns 80 to 120 of them.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I scrape Google Flights with Python?
&lt;/h3&gt;

&lt;p&gt;Call the Actor with &lt;code&gt;apify-client&lt;/code&gt; as shown above, then read the flat &lt;code&gt;all_flights&lt;/code&gt; array for one row per flight. The published Python task carries a runnable version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use the Google Flights scraper from Claude or an MCP client?
&lt;/h3&gt;

&lt;p&gt;Yes. Connect the Apify MCP server to Claude, Claude Code, or Cursor and the Actor appears as a callable tool that runs a live search from your prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I schedule this scraper to run automatically?
&lt;/h3&gt;

&lt;p&gt;Yes, and it is the most popular way to run it. Save a task per route, attach an Apify schedule with a cron expression, and each run appends a new page of fares. Scheduling is how the price-tracking use case works, and you can start from the &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Flights API&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can this scraper predict price changes?
&lt;/h3&gt;

&lt;p&gt;No, and treat anything that claims otherwise with suspicion. You get &lt;code&gt;price_insights&lt;/code&gt;: a &lt;code&gt;price_level&lt;/code&gt; for the current fare and a &lt;code&gt;typical_price_range&lt;/code&gt; for the route. That is a read on today's fare against a normal band, not a forecast. If you want something forward-looking, schedule the scraper and model the trend from the record you own.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I build my own Google Flights scraper instead?
&lt;/h3&gt;

&lt;p&gt;You can, and for a one-off you might. The tradeoff is the &lt;code&gt;tfs&lt;/code&gt; blob, JavaScript rendering, proxies, and layout changes you then own forever. A hosted scraper trades a per-page fee for never touching that maintenance.&lt;/p&gt;

&lt;h2&gt;
  
  
  More from Truffle Pig Data
&lt;/h2&gt;

&lt;p&gt;Same Actor, other angles: &lt;a href="https://peerlist.io/johnvc/articles/give-your-ai-agent-real-flight-prices" rel="noopener noreferrer"&gt;Give your AI agent real flight prices (Peerlist)&lt;/a&gt;, &lt;a href="https://medium.com/@finosint/google-flights-api-for-ai-agents-search-live-fares-via-mcp-6b3b4c6634bc" rel="noopener noreferrer"&gt;Google Flights API for AI Agents on Medium&lt;/a&gt;, and the &lt;a href="https://www.linkedin.com/pulse/google-flights-scraper-api-flight-prices-booking-links-zz85e/" rel="noopener noreferrer"&gt;Google Flights API write-up on LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A flight is one leg of a trip. These related Actors return the same kind of structured JSON: &lt;a href="https://apify.com/johnvc/google-travel-explore-api?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Travel Explore API&lt;/a&gt; for when you know the origin but not the destination, &lt;a href="https://apify.com/johnvc/google-hotels-search-scraper?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Hotels Search Scraper&lt;/a&gt; for the nights, and &lt;a href="https://apify.com/johnvc/google-maps-directions-api?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Maps Directions API&lt;/a&gt; for the airport-to-hotel leg.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;There's no official Google Flights API, but you can still get the same data as clean JSON without babysitting a scraper. Try the &lt;a href="https://apify.com/johnvc/Google-Flights-Data-Scraper-Flight-and-Price-Search?fpr=9n7kx3&amp;amp;fp_sid=devto" rel="noopener noreferrer"&gt;Google Flights API&lt;/a&gt;, or clone the &lt;a href="https://github.com/johnisanerd/Apify-Google-Flights-API" rel="noopener noreferrer"&gt;example repo&lt;/a&gt; and point it at your own routes.&lt;/p&gt;

</description>
      <category>python</category>
      <category>webscraping</category>
      <category>api</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
