Price alert Hurry up! Google SERP API from $0.03/1K API calls — prices likely to rise 10× from December 2026.Hurry up! Google SERP from $0.03/1K API calls — likely 10× from Dec 2026Google SERP $0.03/1K · likely 10× from Dec$0.03/1K · likely 10× in Dec Deposit Now

How to Scrape Google Flights with Python and Node

By Anurag Pathak · · 13 min read

To get Google Flights prices into Python or Node, send three API calls: a search, then the departure_token of the outbound flight you picked, then the booking_token of the return flight you picked. Each call returns JSON rows, and the last one lists the sellers, prices and links where the trip can be booked.

This guide gives the code in both languages with the real answers for New York JFK to Los Angeles LAX on 12 January 2027. It also covers what your code should expect: empty tokens, rows without a price, codeshares, separate tickets and the error messages.

Short answer: For prices on one date, make one call with an airport pair and a date; for a round trip with booking links, make three calls and repeat the full search on each one, as the code below does. If you want price insights too (lowest price, whether it is low, typical or high, and the usual range), add price_insights=true to the first call only. If you want one route tracked every day, read the fare tracking guide. Whatever you build, use airport codes such as JFK, never city codes such as NYC.

This post is for the developer who needs flight prices and booking links as data, for a price tracker, a trip planner or a travel tool. For the price of a search against other services, see the cheapest Google Flights API comparison. The Google Flights API page lets you try a search before you write any code, and the documentation lists every parameter and field.

Does Google Flights have an official API?

Not one that you can sign up for today, as far as I found. Google's own fare-search API, QPX Express, was shut down on 10 April 2018. The Register reported the end-of-service date on 1 November 2017 and noted that Google had also stopped taking new users. It added that the five-year period the US Department of Justice had required Google to keep supporting QPX, after its purchase of ITA Software, was long over.

I found no replacement in that coverage, so there are two practical routes: build and maintain the extraction yourself, or call an API that returns the flights as JSON, which is what the code below does.

Use the data responsibly, whichever route you pick. Read Google's terms of service before you build a product on flight data, and read each seller's terms before you send customers to their booking links. Serpent is not affiliated with Google or with any airline. None of this is legal advice.

What do you need before the first call?

You need four things: an API key, a way to send a GET request, airport codes and dates in the right form. The key goes in an X-API-Key header, and the examples read it from an environment variable so it never lands in your code. Every account starts with 10 free API calls, and Google Flights calls can use them.

# macOS or Linux; on Windows PowerShell use: $env:SERPENT_API_KEY = "your-key"
export SERPENT_API_KEY="your-key"
pip install requests    # Python only; Node 18 or later has fetch built in

Airport codes only. The search takes the three-letter code of one airport on each side. A city code such as NYC covers several airports at once, in New York's case JFK, LaGuardia (LGA) and Newark (EWR), and the API refuses city codes with a clear message instead of guessing which airport you meant. There is no airport lookup endpoint, so keep your own list of the codes you need.

Dates as YYYY-MM-DD. A date must be between today and about 11 months ahead. The examples use 12 January 2027 out and 19 January back, the dates of the saved answers shown below. After 12 January 2027 those dates are in the past and the API will answer with a 400, so change them to dates ahead of you.

Which parameters does the search take?

Only three are needed for a one-way search: departure_id, arrival_id and outbound_date. Add return_date and it becomes a round trip. For a multi-trip itinerary, multi_city takes the place of those four. Everything else narrows the search or changes how the answer is priced and written.

Parameters of GET /api/google/flights, from the parameter reference of 29 November 2026.
ParameterAcceptsDefaultWhat it does
departure_id3-letter airport coderequired unless multi_cityDeparture airport, for example JFK.
arrival_id3-letter airport coderequired unless multi_cityArrival airport, for example LAX.
outbound_dateYYYY-MM-DDrequired unless multi_cityDeparture date.
return_dateYYYY-MM-DDnonePresent means round trip; left out means one way.
multi_cityFROM:TO:YYYY-MM-DD, 2 to 5 legs, comma separatednoneMulti-city trip, for example JFK:LAX:2027-01-10,LAX:SFO:2027-01-15. Use it instead of the four parameters above.
adults1 to 91Number of adults.
children0 to 80Number of children.
infants_in_seat0 to 40Infants with their own seat.
infants_on_lap0 to 40Infants on an adult's lap; no more than the number of adults.
travel_classeconomy, premium_economy, business, firsteconomyCabin class.
stopsany, nonstop, one_stop, two_stopsanyMaximum stops.
airlinestwo-character airline codes, comma separatednoneOnly these airlines, for example LA,G3.
max_pricewhole number, 1 or morenoneHighest total price, in the requested currency.
outbound_timesfrom,to in 24-hour local timenoneDeparture hour window, for example 6,11.
currency3-letter currency codeUSDCurrency of every price in the answer.
country2-letter country codeusCountry of the search.
languagesuch as en or pt-BRenInterface language.
departure_tokentoken from a flight rownoneRound trips and multi-city: get the flights for the next leg. Send it with the same search parameters.
booking_tokentoken from a flight rownoneGet the booking options of that flight.
price_insightstrue or falsefalseAlso return the price insights. Billed at the price insights rate whenever it is true, even if no insights come back. First search only, one adult, no max_price or outbound_times.

How do you make the first search in Python?

Send a GET request to https://apiserpent.com/api/google/flights with the three required parameters. This example code asks for one-way flights from JFK to LAX on 12 January 2027 with price_insights=true, and prints the number of flights, the first two rows and the price insights. Save it as first_search.py:

import os

import requests

API = 'https://apiserpent.com/api/google/flights'
HEADERS = {'X-API-Key': os.environ['SERPENT_API_KEY']}

resp = requests.get(
    API,
    headers=HEADERS,
    params={
        'departure_id': 'JFK',
        'arrival_id': 'LAX',
        'outbound_date': '2027-01-12',
        'price_insights': 'true',
    },
    timeout=60,
)
if resp.status_code == 400:
    err = resp.json()
    raise SystemExit(f"Refused ({err['code']}): {err['message']}")
resp.raise_for_status()
data = resp.json()

print(len(data['flights']), 'flights', data['departure_id'], '->', data['arrival_id'], data['outbound_date'])
for f in data['flights'][:2]:
    seg = f['segments'][0]
    print(' ', f['airlines'][0], seg['flight_number'], seg['departure_time'][11:], '->', seg['arrival_time'][11:],
          f['price'], data['currency'])
if data['lowest_price'] is not None:
    print(f"Lowest {data['lowest_price']} {data['currency']}, level {data['price_level']}, "
          f"usual range {data['typical_price_low']}-{data['typical_price_high']} {data['currency']}")
else:
    print('No price insights in this answer')

The answer of 29 November 2026 gave this output. Prices and flights change from day to day, so yours will differ:

87 flights JFK -> LAX 2027-01-12
  JetBlue B6 723 13:59 -> 17:21 179 USD
  Delta DL 738 15:20 -> 18:35 179 USD
Lowest 179 USD, level typical, usual range 70-215 USD

The two rows are the first two in the answer, in the order they arrived: JetBlue B6 723 and Delta DL 738, both nonstop at 179 USD. The price insights say the lowest price for the search was 179 USD, that this is typical, and that the usual range for the route runs from 70 to 215 USD.

price_level is derived: it is low, typical or high depending on where the lowest price sits against the usual range, so it is empty when no range is shown. The answer also carries price_history, a list of dates and prices. In the five entries kept in the saved answer, 25 to 29 November 2026, the price was 179 every day.

{
  "lowest_price": 179,
  "price_level": "typical",
  "typical_price_low": 70,
  "typical_price_high": 215,
  "price_history": [
    { "date": "2026-11-25", "price": 179 },
    { "date": "2026-11-26", "price": 179 },
    { "date": "2026-11-27", "price": 179 },
    { "date": "2026-11-28", "price": 179 },
    { "date": "2026-11-29", "price": 179 }
    // the saved answer was cut to these entries for display
  ]
}

price_insights=true is an optional add-on. It is billed at the price insights rate whenever it is true, also when no insights come back for a search, and the cost section below gives both rates. It works only on the first search of a one-way or round-trip trip with one adult and no max_price or outbound_times; any other call with it set gets a 400, as the errors section shows. The code prints "No price insights in this answer" when lowest_price is null, so an answer without them does not crash it.

How do you go from a round-trip search to booking links?

Add return_date and the first search returns outbound flights, and each carries a departure_token. Send that token back with the same search parameters and the answer is the return flights, and each of those carries a booking_token. Send that token, again with the same search, and the answer lists where to book. The figure shows the three steps with the counts from the saved answers.

This example code does all three and prints a line for each step. Save it as trip.py:

import os

import requests

API = 'https://apiserpent.com/api/google/flights'
HEADERS = {'X-API-Key': os.environ['SERPENT_API_KEY']}

# The search. Every follow-up call repeats these four parameters exactly.
SEARCH = {
    'departure_id': 'JFK',
    'arrival_id': 'LAX',
    'outbound_date': '2027-01-12',
    'return_date': '2027-01-19',
}


def call(extra=None):
    resp = requests.get(API, headers=HEADERS, params={**SEARCH, **(extra or {})}, timeout=60)
    if resp.status_code == 400:  # a bad parameter: the message says which one
        err = resp.json()
        raise SystemExit(f"Refused ({err['code']}): {err['message']}")
    resp.raise_for_status()  # 401, 402, 429, 502, 504 and so on
    return resp.json()


def pick(flights, token):
    """First row, in the order the answer lists them, that has a price and the token we need."""
    for f in flights:
        if f['price'] is not None and f[token]:
            return f
    raise SystemExit(f'No priced flight with a {token} in this answer')


def describe(f, currency):
    segs = f['segments']
    first, last = (segs[0], segs[-1]) if segs else ({}, {})
    numbers = ' + '.join(s['flight_number'] for s in segs)
    depart = (first.get('departure_time') or '')[11:]
    arrive = (last.get('arrival_time') or '')[11:]
    hours, minutes = divmod(f['total_duration'] or 0, 60)
    stops = 'nonstop' if f['stops'] == 0 else f"{f['stops']} stop(s)"
    also = [c for s in segs for c in s['codeshares']]
    note = f"  also sold as {', '.join(also)}" if also else ''
    return f"{numbers}  {depart} -> {arrive} ({hours}h{minutes:02d}m)  {stops}  {f['price']} {currency}{note}"


# Step 1: search. Round-trip rows are outbound flights; each carries a departure_token.
out = call()
print(f"Step 1: {len(out['flights'])} outbound options {out['departure_id']}-{out['arrival_id']} "
      f"{out['outbound_date']}, returning {out['return_date']}")
outbound = pick(out['flights'], 'departure_token')
print('  picked', describe(outbound, out['currency']))

# Step 2: send the chosen outbound's departure_token to get the return flights.
back = call({'departure_token': outbound['departure_token']})
print(f"Step 2: {len(back['flights'])} return options")
ret = pick(back['flights'], 'booking_token')
print('  picked', describe(ret, back['currency']))

# Step 3: send the chosen return flight's booking_token to get where to book the whole trip.
book = call({'booking_token': ret['booking_token']})
options = sorted(book['booking_options'], key=lambda o: (o['price'] is None, o['price'] or 0))
print(f"Step 3: {len(options)} booking options for the same flights")
for o in options:
    price = f"{o['price']} {book['currency']}" if o['price'] is not None else 'no price'
    where = o['link'].split('?')[0] + '?...' if o['link'] else f"phone {o['phone']}"
    print(f"  {o['seller']}  {price}  {' + '.join(o['flight_numbers'])}  {where}")
    for t in o['tickets']:  # filled only when the trip is sold as separate tickets
        print(f"      ticket: {t['seller']}  {t['price']}  {' + '.join(t['flight_numbers'])}")

The answers of 29 November 2026 gave this output, with each booking link cut short:

Step 1: 50 outbound options JFK-LAX 2027-01-12, returning 2027-01-19
  picked DL 773  09:00 -> 12:26 (6h26m)  nonstop  357 USD
Step 2: 8 return options
  picked DL 934  06:00 -> 14:24 (5h24m)  nonstop  357 USD
Step 3: 4 booking options for the same flights
  Delta  357 USD  DL 773 + DL 934  https://www.google.com/travel/clk/f?...
  Delta  467 USD  DL 773 + DL 934  https://www.google.com/travel/clk/f?...
  Delta  507 USD  DL 773 + DL 934  https://www.google.com/travel/clk/f?...
  Delta  707 USD  DL 773 + DL 934  https://www.google.com/travel/clk/f?...

A few choices in the code are worth knowing about:

For a one-way trip, skip the second step. In the saved one-way answer every row had a booking_token and an empty departure_token, so you can send a row's booking_token straight away. Multi-city trips with multi_city follow the same two tokens for each leg, according to the parameter reference; I did not run one for this post.

And in Node?

Node 18 or later has fetch built in, so there is nothing to install. Save this example code as trip.mjs and run it with node trip.mjs. It does the same as the Python version, step for step.

const API = 'https://apiserpent.com/api/google/flights';
const KEY = process.env.SERPENT_API_KEY;
if (!KEY) throw new Error('Set SERPENT_API_KEY first');

// The search. Every follow-up call repeats these four parameters exactly.
const SEARCH = {
  departure_id: 'JFK',
  arrival_id: 'LAX',
  outbound_date: '2027-01-12',
  return_date: '2027-01-19',
};

async function call(extra = {}) {
  const res = await fetch(`${API}?${new URLSearchParams({ ...SEARCH, ...extra })}`, {
    headers: { 'X-API-Key': KEY },
    signal: AbortSignal.timeout(60000),
  });
  if (res.status === 400) { // a bad parameter: the message says which one
    const err = await res.json();
    throw new Error(`Refused (${err.code}): ${err.message}`);
  }
  if (!res.ok) throw new Error(`HTTP ${res.status}`); // 401, 402, 429, 502, 504 and so on
  return res.json();
}

// First row, in the order the answer lists them, that has a price and the token we need.
function pick(flights, token) {
  const hit = flights.find((f) => f.price !== null && f[token]);
  if (!hit) throw new Error(`No priced flight with a ${token} in this answer`);
  return hit;
}

function describe(f, currency) {
  const segs = f.segments;
  const numbers = segs.map((s) => s.flight_number).join(' + ');
  const depart = ((segs[0] && segs[0].departure_time) || '').slice(11);
  const arrive = ((segs.at(-1) && segs.at(-1).arrival_time) || '').slice(11);
  const total = f.total_duration || 0;
  const mins = String(total % 60).padStart(2, '0');
  const stops = f.stops === 0 ? 'nonstop' : `${f.stops} stop(s)`;
  const also = segs.flatMap((s) => s.codeshares);
  const note = also.length ? `  also sold as ${also.join(', ')}` : '';
  return `${numbers}  ${depart} -> ${arrive} (${Math.floor(total / 60)}h${mins}m)  ${stops}  ${f.price} ${currency}${note}`;
}

async function main() {
  // Step 1: search. Round-trip rows are outbound flights; each carries a departure_token.
  const out = await call();
  console.log(`Step 1: ${out.flights.length} outbound options ${out.departure_id}-${out.arrival_id} ` +
    `${out.outbound_date}, returning ${out.return_date}`);
  const outbound = pick(out.flights, 'departure_token');
  console.log('  picked', describe(outbound, out.currency));

  // Step 2: send the chosen outbound's departure_token to get the return flights.
  const back = await call({ departure_token: outbound.departure_token });
  console.log(`Step 2: ${back.flights.length} return options`);
  const ret = pick(back.flights, 'booking_token');
  console.log('  picked', describe(ret, back.currency));

  // Step 3: send the chosen return flight's booking_token to get where to book the whole trip.
  const book = await call({ booking_token: ret.booking_token });
  const options = [...book.booking_options].sort(
    (a, b) => (a.price === null) - (b.price === null) || a.price - b.price);
  console.log(`Step 3: ${options.length} booking options for the same flights`);
  for (const o of options) {
    const price = o.price !== null ? `${o.price} ${book.currency}` : 'no price';
    const where = o.link ? `${o.link.split('?')[0]}?...` : `phone ${o.phone}`;
    console.log(`  ${o.seller}  ${price}  ${o.flight_numbers.join(' + ')}  ${where}`);
    for (const t of o.tickets) { // filled only when the trip is sold as separate tickets
      console.log(`      ticket: ${t.seller}  ${t.price}  ${t.flight_numbers.join(' + ')}`);
    }
  }
}

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

Its output is the same as the Python output above, line for line. URLSearchParams turns the parameter object into a query string, and AbortSignal.timeout(60000) gives each call the same 60-second limit. Errors are thrown with a message and caught once at the bottom, which prints it and sets a failing exit code instead of a stack trace.

The one-way first call with price insights is shorter. Save it as first-search.mjs, so that the top-level await works:

const API = 'https://apiserpent.com/api/google/flights';
const KEY = process.env.SERPENT_API_KEY;
if (!KEY) throw new Error('Set SERPENT_API_KEY first');

const params = new URLSearchParams({
  departure_id: 'JFK',
  arrival_id: 'LAX',
  outbound_date: '2027-01-12',
  price_insights: 'true',
});
const res = await fetch(`${API}?${params}`, {
  headers: { 'X-API-Key': KEY },
  signal: AbortSignal.timeout(60000),
});
if (res.status === 400) {
  const err = await res.json();
  throw new Error(`Refused (${err.code}): ${err.message}`);
}
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();

console.log(data.flights.length, 'flights', data.departure_id, '->', data.arrival_id, data.outbound_date);
for (const f of data.flights.slice(0, 2)) {
  const seg = f.segments[0];
  console.log(' ', f.airlines[0], seg.flight_number, seg.departure_time.slice(11), '->', seg.arrival_time.slice(11),
    f.price, data.currency);
}
if (data.lowest_price !== null) {
  console.log(`Lowest ${data.lowest_price} ${data.currency}, level ${data.price_level}, ` +
    `usual range ${data.typical_price_low}-${data.typical_price_high} ${data.currency}`);
} else {
  console.log('No price insights in this answer');
}

It prints the same four lines as first_search.py.

What does a flight row look like?

An answer is one object with the keys shown below. A key that does not apply carries its empty value: an empty string, null or an empty list. Here is the first search of the round trip in the saved answer, cut to its first row, with the long tokens shortened:

{
  "success": true,
  "departure_id": "JFK",
  "arrival_id": "LAX",
  "outbound_date": "2027-01-12",
  "return_date": "2027-01-19",
  "currency": "USD",
  "flights": [
    {
      "airlines": ["Delta"],
      "price": 357,
      "total_duration": 386,
      "stops": 0,
      "segments": [
        {
          "airline": "Delta",
          "flight_number": "DL 773",
          "departure_airport": {
            "id": "JFK",
            "name": "John F. Kennedy International Airport"
          },
          "arrival_airport": {
            "id": "LAX",
            "name": "Los Angeles International Airport"
          },
          "departure_time": "2027-01-12T09:00",
          "arrival_time": "2027-01-12T12:26",
          "duration": 386,
          "airplane": "Boeing 767",
          "codeshares": []
        }
      ],
      "layovers": [],
      "best": true,
      "departure_token": "eyJkIjpbW1siSkZLIiwi…",
      "booking_token": ""
    }
    // ...49 more rows
  ],
  "lowest_price": null,
  "price_level": "",
  "typical_price_low": null,
  "typical_price_high": null,
  "price_history": [],
  "booking_options": []
}

Read it from the top. price is the total price in the answer's currency, and total_duration and each segment's duration are minutes: 386 minutes is 6 hours 26 minutes.

Times are local to each airport, without a time zone, which is why the 12:26 arrival in Los Angeles follows a 09:00 departure from New York. segments lists each leg with its airline, flight number, airports, times, aircraft and codeshares; layovers is empty for a nonstop flight. best was true on the rows in the saved answers, and the examples in this post do not use it.

The tokens are the part to look at. The outbound row has a departure_token and an empty booking_token. The return rows have it the other way round, and the price insights fields are empty because this search did not ask for insights. Treat the tokens as opaque strings: pass them back exactly as you got them.

A typical answer has about 80 flights, from a fixed set of 50 searches measured on 27 November 2026, and some searches return up to 250. The saved answers had 87 flights one way, 50 outbound options on the round trip and 8 return options, which is why your code should loop over the list and never assume its length.

What do the booking options mean?

The last call returns booking_options and nothing in flights. Each option is a seller, a price, a link and the flight numbers the price covers. Here is the first of the four options in the saved answer, with the link shortened:

{
  "flights": [],
  "booking_options": [
    {
      "seller": "Delta",
      "price": 357,
      "link": "https://www.google.com/travel/clk/f?u=…",
      "phone": "",
      "flight_numbers": ["DL 773", "DL 934"],
      "tickets": []
    }
    // ...3 more options: 467, 707 and 507 USD
  ]
}

The price of an option covers the flights in its flight_numbers: here DL 773 out and DL 934 back for 357 USD. The link goes to the seller's booking page.

All four options in the saved answer were Delta, for the same two flights, at 357, 467, 707 and 507 USD. The answer gives no fare names, so the example sorts them by price and prints the link next to each. The figure shows the order they arrived in.

Two other shapes exist that the saved answer does not contain, and the code already handles both:

What should your code expect in the data?

The field list is fixed, but the values are not always there. These are the cases to write for:

What happens when a call fails?

A request the API cannot accept gets a 400 with a body in the standard error format. Branch on code, and show message to the developer. Both examples do that for 400 and raise for the other statuses. This is what sending NYC as departure_id returns:

{
  "success": false,
  "error": "Invalid parameter",
  "code": "invalid_parameter",
  "message": "departure_id is a city code; use the code of one of its airports"
}

The messages below are the ones you are most likely to meet in this flow. A 400 is not charged.

400 messages in the search, return-flight and booking calls, as worded in the release build read on 29 November 2026.
MessageWhat went wrongWhat to do
departure_id is a city code; use the code of one of its airportsYou sent a city code such as NYC. The same message names arrival_id when that one is the city code.Use the airport, for example JFK, LGA or EWR for New York.
departure_id must be a three-letter airport codeThe value is not three letters.Send the IATA airport code.
outbound_date must be between today and about 11 months aheadThe date is in the past or too far ahead.Move the dates into the window.
price_insights is available on the first search of a one way or round trip with 1 adult, without max_price or outbound_timesYou set price_insights=true on a follow-up call or on a search with more than one passenger, max_price or outbound_times.Ask for insights on the first search only, with those parameters left out.
departure_token does not belong to this searchA parameter changed between the search and the call that carries the token. booking_token has the same message.Repeat the original search parameters exactly.
send departure_token or booking_token, not bothBoth tokens were in one call.Send the one you need now.

Other statuses are the same on every Serpent endpoint. A 401 means the X-API-Key header is missing or not a live key, and a 402 means the balance cannot cover the call. A 429 means automated overuse or server load, and every 429 is the same response; pause before calling again.

A 502 or 504 means the request could not be completed, and the credits are refunded automatically. A search that completes and genuinely finds nothing is different: it is a real answer and is charged.

What does a full lookup cost?

Google Flights calls cost from $0.35 per 1K API calls at the highest tier and $0.60 per 1K API calls on pay as you go, with no subscription; the pricing page lists every tier. Each of the three steps is one API call, so a full lookup is three calls: 1,000 full lookups are 3,000 API calls, which is $1.80 on pay as you go and $1.05 at the highest tier.

Price insights are an optional add-on. A call with price_insights=true is billed at $0.75 per 1K API calls on pay as you go and $0.44 per 1K API calls at the highest tier, also when no insights come back for that search. With price insights on the first call only, 1,000 full lookups cost $1.95 on pay as you go and $1.14 at the highest tier. A call refused with a 400 costs nothing.

Which route fits you?

Pick by what the trip data is for:

How we checked this

Sources. Seven public pages, opened on 29 November 2026: The Register's report on the end of QPX Express, Wikipedia's pages on IATA airport codes and codeshare agreements, the Requests quickstart, MDN's page on URLSearchParams and its page on AbortSignal.timeout, and the Node.js globals page. Google's terms of service are linked but were not opened for this post.

Answers. Every flight, price, count and booking option shown comes from four answers saved on 29 November 2026 for JFK to LAX on 12 January 2027: a one-way search with price insights, the first round-trip search, the return flights and the booking options. The lists in them were cut for display, so the counts (87, 50 and 8 flights, 4 booking options) are the totals recorded with each answer.

The times of 4.5, 2.5, 5.0 and 8.0 seconds are those four single calls, not an average. The "about 80 flights" figure and the 250 ceiling come from a fixed set of 50 searches measured on 27 November 2026.

Code. I ran each of the four programs on 29 November 2026 with Python 3.15.2 and Node 26.5.0, against a stand-in that returned the four saved answers instead of calling the live service. The output shown is what they printed.

I also ran the Python and Node round-trip programs against altered copies of the answers, with a row without a price, a codeshare, a phone-only option and separate tickets, to check those branches, and with NYC as the departure to check the 400 path.

Later the same day the programs were also run against the live service for JFK to LAX on 12 January 2027. All four finished without errors and without edits, and cost less than half a cent in total. The live lists were not the saved ones: the one-way search returned 83 flights (the cheapest a JetBlue at $179, price level typical, usual range $70 to $215) and the round trip had 44 outbound flights, 8 return flights and 6 booking options from $357. The output printed above is from the saved answers, so your own counts will differ from the ones shown.

What I could not verify:

  • That the programs keep working as the service changes. They were run against the live service once, on 29 November 2026, and the lists you get back will not match the saved answers shown here.
  • The wording of the 400 messages in the table. They come from the validation text of the release build, not from captured calls.
  • Whether the price shown for an outbound row in a round trip is the price of that outbound alone or of the cheapest pairing. The saved answer shows 357 on the outbound row, the return row and the first booking option.
  • Multi-city trips with tokens, and answers with separate tickets or phone-only sellers. The saved answers contain none, so the code for them is written to the field descriptions.
  • Whether Google offers a private fare feed today. The 2017 coverage says only that QPX Express would end.

Get flights and booking links as JSON

One call returns Google Flights prices and itineraries between two airports, and two more calls take a round trip to the sellers' booking links. Try a search on the Google Flights API page, then copy the code above.

Get Your API Key

Explore: Google Flights API · Docs · Pricing · About

FAQ

Does Google Flights have an official API?

Not one you can sign up for today, as far as I found. Google's own fare-search API, QPX Express, was shut down on 10 April 2018, and I found no replacement in the coverage of that shutdown. To get flights as data in code, you either build and maintain the extraction yourself or call an API that returns flights as JSON, such as Serpent's Google Flights API.

How do I get booking links for a round trip?

Make three calls and repeat the same search parameters on each. The first search returns outbound flights, each with a departure_token, and that token gets you the return flights, each with a booking_token. Send that token to get booking_options, which list the seller, price, link and flight numbers. A one-way search skips the middle step because its rows already carry a booking_token.

Can I search a city such as NYC or LON?

No. Use the three-letter code of one airport on each side. City codes such as NYC and LON cover several airports, so the API refuses them with a 400 that says to use one of the city's airports, which for New York means JFK, LGA or EWR. There is no airport lookup endpoint, so keep a list of the codes you need.

Why is the price null on some flights?

Some rows have no price, and it happens more often in some markets, such as India. The price field is null for those rows. Check for null before you sort or add prices, and skip or flag the row. The example in this post skips rows without a price when it picks a flight, and prints no price for a booking option that has none.

What does price_insights add, and what does it cost?

price_insights=true adds the lowest price, a price level of low, typical or high, the usual price range and a price history to the first search of a one-way or round-trip trip with one adult. It is an optional add-on billed at the insights rate whenever it is true, even when no insights come back: $0.75 per 1K API calls on pay as you go, against $0.60 per 1K API calls for a plain call.

What does a Google Flights API call cost?

From $0.35 per 1K API calls at the highest tier and $0.60 per 1K API calls on pay as you go, with no subscription. A full round-trip lookup with booking options is three API calls. A call refused with a 400 costs nothing, a search that completes and genuinely finds nothing is a real answer and is charged, and a request we could not complete is refunded automatically.