logo

Google Flights API

Scrape Google Flights for fares, durations, layovers, airlines, and carbon emissions as structured JSON

Google Flights API

The Google Flights API is a specialized plugin that searches Google's flight feed and returns the same fare list, durations, layovers, airlines, and emissions that Google shows in the Flights UI, as clean JSON. No JavaScript rendering, no headless browsers, no booking-flow scraping. One HTTP call returns up to 30 itineraries plus aggregate price insights and full airport metadata.

Credit Usage: Each successful request costs 10 credits. For bulk processing, use the Async API with plugins.

Key Features

  • Structured JSON Output: Each itinerary returns flights[] (per-segment), layovers[], total_duration, price, carbon_emissions, airline_logo, and a booking_token.
  • Round Trip, One Way, Multi-Origin: Round trips with return_date, one-way searches by default, and multi-airport origin/destination via comma-separated IATA codes (departure_id=JFK,LGA,EWR).
  • Price Insights: Every response includes price_insights with lowest_price, price_level (low / typical / high), typical_price_range, and a sparse price_history time series.
  • Carbon Emissions: Per-itinerary carbon_emissions block with this_flight, typical_for_this_route, and difference_percent so you can prioritize lower-emission options.
  • Sort Modes: sort_by controls top, price, departure, arrival, duration, or emissions ordering. Six modes in total.
  • Cabin & Stop Filters: travel_class (economy / premium / business / first), stops (any / nonstop / ≤1 / ≤2), include_airlines / exclude_airlines by IATA code.
  • Localization: hl, gl, and currency for full regional pricing (EUR, GBP, JPY, TRY, etc).
  • No Blocks or CAPTCHAs: All anti-bot measures are handled automatically by Scrape.do.

Endpoint

GET https://api.scrape.do/plugin/google/flights

Request Parameters

Required

ParameterTypeDescription
tokenstringYour Scrape.do API authentication token
departure_idstringOrigin IATA code (e.g. JFK). Comma-separated allowed for multi-airport origin (e.g. JFK,LGA,EWR)
arrival_idstringDestination IATA code. Same multi-airport rules as departure_id
outbound_datestringDeparture date in YYYY-MM-DD format

Trip Type

ParameterTypeDefaultDescription
typeintegerauto1 = round trip (requires return_date), 2 = one way, 3 = multi-city. Auto-inferred from return_date
return_datestringReturn date in YYYY-MM-DD format. Required when type=1

Multi-city (type=3) is not yet supported. The endpoint returns 400 if requested. Contact support if you need it.

Passengers

ParameterTypeDefaultDescription
adultsinteger11–9
childreninteger00–9
infants_in_seatinteger00–4
infants_on_lapinteger00–4

Cabin & Filters

ParameterTypeDefaultDescription
travel_classinteger11 = economy, 2 = premium economy, 3 = business, 4 = first
stopsinteger00 = any, 1 = nonstop, 2 = ≤1 stop, 3 = ≤2 stops
sort_byinteger11 = top, 2 = price, 3 = departure, 4 = arrival, 5 = duration, 6 = emissions
include_airlinesstringComma-separated IATA airline codes (DL,B6,AA). Mutually exclusive with exclude_airlines
exclude_airlinesstringComma-separated IATA airline codes

Not yet supported: max_price, max_duration, bags. Sending them returns 400 so callers notice rather than silently filtering nothing.

Localization

ParameterTypeDefaultDescription
hlstringenLanguage code
glstringusCountry code
currencystringUSDCurrency code (e.g. EUR, GBP, JPY, TRY)

Example Usage

Simple One-Way

curl --location --request GET 'https://api.scrape.do/plugin/google/flights?token=<SDO-token>&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15'
import requests
import json

token = "<SDO-token>"

url = f"https://api.scrape.do/plugin/google/flights?token={token}&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15"

response = requests.request("GET", url)

print(json.dumps(response.json(), indent=2))
const axios = require('axios');

const token = "<SDO-token>";

const url = `https://api.scrape.do/plugin/google/flights?token=${token}&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15`;

axios.get(url)
  .then(response => {
    console.log(JSON.stringify(response.data, null, 2));
  })
  .catch(error => {
    console.error(error);
  });
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	token := "<SDO-token>"

	url := fmt.Sprintf(
		"https://api.scrape.do/plugin/google/flights?token=%s&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15",
		token,
	)

	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require 'net/http'
require 'json'

token = "<SDO-token>"

url = URI("https://api.scrape.do/plugin/google/flights?token=#{token}&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15")

response = Net::HTTP.get(url)

puts JSON.pretty_generate(JSON.parse(response))
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class GoogleFlights {
    public static void main(String[] args) throws Exception {
        String token = "<SDO-token>";

        String url = String.format(
            "https://api.scrape.do/plugin/google/flights?token=%s&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15",
            token
        );

        HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
        conn.setRequestMethod("GET");

        BufferedReader reader = new BufferedReader(
            new InputStreamReader(conn.getInputStream())
        );
        String line;
        StringBuilder response = new StringBuilder();
        while ((line = reader.readLine()) != null) {
            response.append(line);
        }
        reader.close();

        System.out.println(response.toString());
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        string token = "<SDO-token>";

        string url = $"https://api.scrape.do/plugin/google/flights?token={token}&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15";

        using HttpClient client = new HttpClient();
        string response = await client.GetStringAsync(url);

        Console.WriteLine(response);
    }
}
<?php
$token = "<SDO-token>";

$url = "https://api.scrape.do/plugin/google/flights?token={$token}&departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
?>
curl "https://api.scrape.do/plugin/google/flights?departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15&token=$TOKEN"

Round Trip, Two Adults, Business Class, EUR

curl "https://api.scrape.do/plugin/google/flights?departure_id=IST&arrival_id=LHR&outbound_date=2026-07-01&return_date=2026-07-15&adults=2&travel_class=3&currency=EUR&gl=gb&token=$TOKEN"

Nonstop, Cheapest First

curl "https://api.scrape.do/plugin/google/flights?departure_id=SFO&arrival_id=NRT&outbound_date=2026-08-10&stops=1&sort_by=2&token=$TOKEN"

Multi-Airport Origin (NYC)

curl "https://api.scrape.do/plugin/google/flights?departure_id=JFK,LGA,EWR&arrival_id=LAX&outbound_date=2026-06-15&token=$TOKEN"

Filter by Airlines

curl "https://api.scrape.do/plugin/google/flights?departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15&include_airlines=DL,B6&token=$TOKEN"

Lowest Carbon Emissions First

curl "https://api.scrape.do/plugin/google/flights?departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15&sort_by=6&token=$TOKEN"

Response

Top-Level Structure

{
  "search_parameters": { ... },
  "best_flights": [ ... ],
  "other_flights": [ ... ],
  "price_insights": { ... },
  "airports": [ ... ]
}

search_parameters

Echo of the request parameters, with engine: "google_flights", type, departure_id, arrival_id, outbound_date, adults, currency, gl, hl always present. Optional fields appear when set.

best_flights[] and other_flights[]

Each entry is an Itinerary object:

{
  "flights": [
    {
      "departure_airport": { "name": "John F. Kennedy International Airport", "id": "JFK", "time": "2026-06-15 08:29" },
      "arrival_airport":   { "name": "Los Angeles International Airport",     "id": "LAX", "time": "2026-06-15 11:25" },
      "duration": 356,
      "airplane": "Airbus A320",
      "airline": "JetBlue",
      "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/B6.png",
      "travel_class": "Economy",
      "flight_number": "B6 323",
      "legroom": "32 inches",
      "extensions": ["Wi-Fi for a fee", "In-seat power"],
      "overnight": false
    }
  ],
  "layovers": [
    { "duration": 65, "name": "Denver International Airport", "id": "DEN" }
  ],
  "total_duration": 421,
  "carbon_emissions": {
    "this_flight": 405000,
    "typical_for_this_route": 316000,
    "difference_percent": 28
  },
  "price": 149,
  "type": "One way",
  "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/B6.png",
  "booking_token": "CjRIVVBMZHNBZEpBRDhBQmN1QndCRy0..."
}

Itinerary Fields

FieldTypeDescription
flights[]arrayPer-segment details, one entry per leg
flights[].departure_airportobject{ name, id, time }. time format YYYY-MM-DD HH:MM
flights[].arrival_airportobjectSame shape as departure
flights[].durationintegerSegment duration in minutes
flights[].airplanestringAircraft type when available
flights[].airlinestringOperating airline name
flights[].airline_logostringhttps://www.gstatic.com/flights/airline_logos/70px/<CODE>.png
flights[].travel_classstring"Economy" / "Premium economy" / "Business" / "First"
flights[].flight_numberstringIATA code + flight number (e.g. B6 323)
flights[].legroomstringHuman-readable legroom
flights[].extensionsstring[]Amenity strings ("Wi-Fi for a fee", "In-seat power", …)
flights[].overnightbooltrue when the segment crosses midnight
layovers[]arrayStops between segments
layovers[].durationintegerLayover duration in minutes
layovers[].name / .idstringLayover airport
total_durationintegerEnd-to-end duration in minutes, including layovers
carbon_emissionsobject{ this_flight, typical_for_this_route, difference_percent } in grams
priceintegerTotal price in the requested currency
typestring"One way" or "Round trip"
airline_logostringRepresentative logo for the itinerary
booking_tokenstringOpaque token identifying the upstream booking page
departure_tokenstringPer-flight short token, when Google emits one

carbon_emissions.difference_percent may be negative when a flight emits less than the route average. this_flight and typical_for_this_route are in grams.

price_insights

{
  "lowest_price": 149,
  "price_level": "typical",
  "typical_price_range": [90, 205],
  "price_history": [
    [1771218000000, 169],
    [1771304400000, 169]
  ]
}
FieldTypeDescription
lowest_priceintegerCheapest fare in the response
price_levelstring"low", "typical", or "high" per Google's classification
typical_price_rangeint[2][low, high] for this route
price_historyarray[unix_ms, price] pairs. Empty when Google doesn't ship a history

airports

Top-level airport reference list. One entry per search (usually a single object containing departure[] and arrival[]).

[
  {
    "departure": [
      {
        "airport": { "id": "JFK", "name": "John F. Kennedy International Airport" },
        "city": "New York",
        "country": "United States",
        "country_code": "US",
        "image": "https://encrypted-tbn1.gstatic.com/images?...",
        "thumbnail": "https://encrypted-tbn1.gstatic.com/images?...",
        "latitude": 40.6397,
        "longitude": -73.7789
      }
    ],
    "arrival": [ { "airport": { "id": "LAX", "name": "Los Angeles International Airport" }, "city": "Los Angeles", "country": "United States", "country_code": "US", "latitude": 33.9425, "longitude": -118.4081 } ]
  }
]

Schema note: within each departure[] / arrival[] entry, the IATA code and airport name live under a nested airport: { id, name } object. City / country / coordinates / images sit at the entry level alongside it.


Sort Modes (sort_by)

ValueMeaning
1 (default)Top. Google's default ranking
2Price ascending
3Departure time ascending
4Arrival time ascending
5Total duration ascending
6Carbon emissions ascending
# Lowest emissions first
curl "https://api.scrape.do/plugin/google/flights?departure_id=JFK&arrival_id=LAX&outbound_date=2026-06-15&sort_by=6&token=$TOKEN"

Stop Filters (stops)

ValueMeaning
0 (default)Any
1Nonstop only
2At most 1 stop
3At most 2 stops

Notes

  • Listing data only. booking_token to fare detail / baggage / seat map expansion is not yet exposed.
  • Live prices drift. Fares can change between requests; expect small variance on repeated calls.
  • Airline logos are synthesised from the IATA code and may 404 for obscure carriers.
  • Multi-city (type=3) returns 400 until support lands.

Error Handling

{ "error": "error_code", "message": "Human readable error message" }

Common Error Codes

StatusErrorDescription
400token is requiredMissing authentication token
400departure_id is required (IATA or comma-separated IATAs)Missing origin
400arrival_id is required (IATA or comma-separated IATAs)Missing destination
400outbound_date is required (format: YYYY-MM-DD)Missing or malformed outbound date
400return_date is required for round-trip (format: YYYY-MM-DD)type=1 without return_date
400multi-city (type=3) is not yet supported — use one-way or round-triptype=3 requested
400travel_class must be 1 (economy), 2 (premium economy), 3 (business), or 4 (first)Invalid travel_class
400stops must be 0 (any), 1 (nonstop), 2 (≤1), or 3 (≤2)Invalid stops
400sort_by must be 1-6 (1=top, 2=price, 3=dep, 4=arr, 5=duration, 6=emissions)Invalid sort_by
400include_airlines and exclude_airlines are mutually exclusiveBoth supplied
400max_price is not yet supportedmax_price, max_duration, or bags passed
502request failedTransient upstream failure. Retry
502unexpected responseNon-200 from Google. Retry
500parse failedResponse parsing error

On this page