Google Flights API
The Google Flights API retrieves flight data from Google Flights supporting one-way, round-trip, and multi-city searches with filtering and sorting capabilities. Costs 5 API credits per request.
Endpoint:
https://api.scrapingdog.com/google_flightsAPI Parameters
π
Scrapingdog Parameters
api_keyRequiredThis is your API key.
Type: StringhtmlOptionalThis will return the full HTML of the Google page.
Default Value -false
Type - Boolean
π
Search Query
departure_idRequiredThe parameter sets the departure point using either an airport code or a location kgmid. Airport codes are 3-letter uppercase identifiers (e.g., JFK, LHR). Location kgmids begin with "/m/" (e.g., /m/02_286 for San Francisco). Multiple departure points can be separated by commas.
Type - Stringarrival_idRequiredAn airport code is a 3-letter uppercase identifier. Location kgmids begin with "/m/". Multiple arrival points can be separated by commas.
Type - String
π
Geographic Location and Localization
countryOptionalThis parameter specifies the country for the Google search using a two-letter country code (e.g., US for the United States, UK for the United Kingdom, or FR for France).
Default Value -us
Type - StringlanguageOptionalLanguage of the results. Possible Values -en,es,fr,de, etc.
Default Value -en
Type - StringcurrencyOptionalThis parameter sets the currency for the returned prices. For a complete list, see the Supported Google Flights Currency Codes.
Default:USD
Type - String
β
οΈ Advanced Google Flights Parameters
typeOptionalThis parameter specifies the flight type.
Available values:- 1 β Round trip (default)
- 2 β One way
- 3 β Multi-city
outbound_dateOptionalThis parameter sets the outbound travel date. The value must be in YYYY-MM-DD format. Example:2026-03-05.
Type - Stringreturn_dateOptionalThis parameter sets the return travel date. The value must be provided in YYYY-MM-DD format, for example:2026-03-06.
Note: It is required when thetypeparameter is set to1(Round trip).travel_classOptionalThis parameter specifies the travel class.
Available values:- 1 β Economy (default)
- 2 β Premium economy
- 3 β Business
- 4 β First class
multi_city_jsonOptionalThis parameter is used to provide flight details for multi-city trips. It should be passed as a JSON string containing an array of flight segment objects.
Type - JSON
π₯
Number of Passengers
adultsOptionalNumber of adult passengers.
Default:1
Type - StringchildrenOptionalNumber of child passengers.
Default:0
Type - Stringinfants_in_seatOptionalNumber of infants travelling in their own seat.
Default:0
Type - Stringinfants_on_lapOptionalNumber of infants traveling on an adult's lap.
Default:0
Type - String
π
Sorting
sort_byOptionalThis parameter sets how the flight results are sorted.
Available values:- 1 β Top flights (default)
- 2 β Price
- 3 β Departure time
- 4 β Arrival time
- 5 β Duration
- 6 β Emissions
β
οΈ Advanced Filters
stopsOptionalThis parameter specifies the maximum number of stops for the flight.
Available values:- 0 β Any number of stops (default)
- 1 β Nonstop only
- 2 β Up to 1 stop
- 3 β Up to 2 stops
exclude_airlinesOptionalThis parameter lets you exclude specific airlines from the results. Each airline must be provided as a 2-character IATA code. Cannot be used together withinclude_airlines.
Type - Stringinclude_airlinesOptionalThis parameter lets you include only specific airlines in the results. Each airline must be provided as a 2-character IATA code. Cannot be used together withexclude_airlines.
Type - StringbagsOptionalThis parameter sets the number of carry-on bags.
Default:0
Type - Stringmax_priceOptionalThis parameter sets the maximum ticket price allowed in the results. By default, there is no price limit.
Type - Stringoutbound_timesOptionalThis parameter sets the preferred time range for the outbound flight. Each number represents the start of an hour.
Type - Stringreturn_timesOptionalThis parameter sets the preferred time range for the return flight. Each number represents the start of an hour.
Note: Use this parameter only when thetypeparameter is set to1(Round trip).
Type - StringemissionsOptionalThis parameter filters flights based on emission level.
Available value:1β Show only flights with lower emissions.
Type - Stringlayover_durationOptionalThis parameter sets the preferred layover duration in minutes. Example:75,240means 1 hour 15 minutes to 4 hours.
Type - Stringexclude_connsOptionalThis parameter lets you exclude specific connecting airports from the results. You can exclude multiple airports by separating them with commas.
Type - Stringmax_durationOptionalThis parameter sets the maximum total flight duration in minutes. Example:960means up to 16 hours.
Type - String
π«
Next Flights
departure_tokenOptionalThis parameter is used to select a departure flight and retrieve the next set of results: for Round trip, it returns the available return flights; for Multi-city, it returns flights for the next segment.
Note: This token cannot be used withbooking_token.
Type - String
π
οΈ Booking Flights
booking_tokenOptionalThis parameter retrieves booking options for the selected flight. It cannot be used together withdeparture_token. When this token is used, date-based parameters and any parameters listed under Advanced Filters are ignored.
Type - String
API Examples
Code to Integrate
curl "https://api.scrapingdog.com/google_flights?api_key=APIKEY&departure_id=JFK&arrival_id=LHR&type=2&outbound_date=2026-03-05"
import requests url = "https://api.scrapingdog.com/google_flights" params = { "api_key": "APIKEY", "departure_id": "JFK", "arrival_id": "LHR", "type": "2", "outbound_date": "2026-03-05" } response = requests.get(url, params=params) if response.status_code == 200: print(response.json())
const axios = require('axios'); axios.get('https://api.scrapingdog.com/google_flights', { params: { api_key: 'APIKEY', departure_id: 'JFK', arrival_id: 'LHR', type: '2', outbound_date: '2026-03-05' } }).then(response => console.log(response.data)) .catch(error => console.error(error.message));
<?php $url = 'https://api.scrapingdog.com/google_flights/?' . http_build_query([ 'api_key' => 'APIKEY', 'departure_id' => 'JFK', 'arrival_id' => 'LHR', 'type' => '2', 'outbound_date' => '2026-03-05', ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch); curl_close($ch);
require 'net/http' require 'uri' url = URI.parse("https://api.scrapingdog.com/google_flights/") url.query = URI.encode_www_form( 'api_key' => 'APIKEY', 'departure_id' => 'JFK', 'arrival_id' => 'LHR', 'type' => '2', 'outbound_date' => '2026-03-05' ) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true puts http.request(Net::HTTP::Get.new(url)).body
import java.io.*; import java.net.*; public class Main { public static void main(String[] args) throws Exception { String apiUrl = "https://api.scrapingdog.com/google_flights/?api_key=APIKEY&departure_id=JFK&arrival_id=LHR&type=2&outbound_date=2026-03-05"; URL url = new URL(apiUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = reader.readLine()) != null) System.out.println(line); conn.disconnect(); } }
API Response
{
"best_flights": [
{
"flights": [
{
"departure_airport": {"id": "JFK", "name": "John F. Kennedy International Airport", "time": "2026-03-05 8:05"},
"arrival_airport": {"id": "LHR", "name": "Heathrow Airport", "time": "2026-03-05 20:00"},
"duration": 415,
"airplane": "Boeing 777",
"travel_class": "Economy",
"flight_number": "BA 178",
"airline": "British Airways",
"legroom": "31 in"
}
],
"total_duration": 415,
"price": 27733,
"type": "One Way"
}
]
}