The Google Flights API provides real-time access to structured flight search results, enabling users to find flights based on various criteria.

Get Your API Key

Sign in at hasdata.com, go to your account settings, and copy your API key. All requests must include your key in the x-api-key header.

Make Your First Request

curl --request GET \
  --url 'https://api.hasdata.com/scrape/google/flights?departureId=LHR&arrivalId=JFK&outboundDate=2025-05-15&returnDate=2025-05-20' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <your-api-key>'

API Parameters

ParameterDefault ValueRequiredDescription
departureIdLHRYesSpecifies the departure airport code (IATA) or location kgmid.

- IATA Code: A 3-letter uppercase code (e.g., SFO for San Francisco, LHR for London Heathrow). Search on IATA.
- Location kgmid: A string starting with /m/, found in Wikidata under “Freebase ID” (e.g., /m/02_286 for New York, NY).

Multiple values can be separated by commas (e.g., JFK,LGA,/m/0hptm).
arrivalIdJFKYesSpecifies the arrival airport code (IATA) or location kgmid.

- IATA Code: A 3-letter uppercase code (e.g., SFO for San Francisco, LHR for London Heathrow). Search on IATA.
- Location kgmid: A string starting with /m/, found in Wikidata under “Freebase ID” (e.g., /m/02_286 for New York, NY).

Multiple values can be separated by commas (e.g., JFK,LGA,/m/0hptm).
outboundDate2025-05-15YesThe outbound travel date in ‘yyyy-MM-dd’ format.
returnDate2025-05-20NoThe return travel date in ‘yyyy-MM-dd’ format. Required when type is roundTrip.
type-NoSpecifies the type of flight. Options:

- roundTrip (default)
- oneWay
- multiCity (requires multiCityJson for flight details)

For round trips, retrieve return flight details with a separate request using departureToken.
multiCityJson-NoThis parameter specifies flight details for multi-city trips. It is a JSON string containing multiple flight objects. Each object must include the following fields:

- departureId – The departure airport code or location KGMID. Uses the same format as the main departureId parameter.
- arrivalId – The arrival airport code or location KGMID. Uses the same format as the main arrivalId parameter.
- date – The flight date. Uses the same format as the outboundDate parameter.
- times (optional) – The time range for the flight. Uses the same format as the outboundTimes parameter.
gl-NoThe two-letter country code for the country you want to limit the search to.
hl-NoThe two-letter language code for the language you want to use for the search.
currency-NoParameter defines the currency of the returned prices
travelClass-NoThe travel class for the flight (Economy, Premium Economy, Business, or First).
showHidden-NoIndicates whether to include hidden options in the results.
adults-NoNumber of adult passengers (>= 1 if specified).
children-NoNumber of child passengers.
infantsInSeat-NoNumber of infants occupying seats.
infantsOnLap-NoNumber of infants sitting on an adult’s lap.
sortBy-NoSort the flight results based on price, departure time, arrival time, etc.
stops-NoRestrict the number of stops (layovers) in the flight itinerary.
excludeAirlines-NoA comma separated list of airline codes to exclude from results. You can search for airline codes on IATA. For example, UA is United Airlines.
includeAirlines-NoA comma separated list of airline codes to exclusively include in results. You can search for airline codes on IATA. For example, UA is United Airlines.

excludeAirlines and includeAirlines parameters can’t be used together.
bags-NoNumber of carry-on bags per passenger.
maxPrice-NoMaximum price limit for the flight search, in the selected currency.
outboundTimes-NoSet up to 4 time boundaries (2 for departure, 2 for arrival) to filter flights. Each number represents the start of an hour.

Examples:
- 6,20 → 6:00 AM - 9:00 PM departure
- 1,15 → 1:00 AM - 4:00 PM departure
- 7,18,2,21 → 7:00 AM - 9:00 PM departure, 2:00 AM - 10:00 PM arrival
returnTimes-NoSet up to 4 time boundaries (2 for departure, 2 for arrival) to filter return flights. Each number represents the start of an hour.

Examples:
- 6,20 → 6:00 AM - 9:00 PM departure
- 1,15 → 1:00 AM - 4:00 PM departure
- 7,18,2,21 → 7:00 AM - 9:00 PM departure, 2:00 AM - 10:00 PM arrival
lessEmissions-NoPrefer flight options with lower carbon emissions.
layoverDuration-NoSet the maximum layover duration in minutes to filter flights. For example, 120, 360 filters layovers between 2 hours and 6 hours, while 45, 180 allows layovers from 45 minutes to 3 hours.
includeConnections-NoA comma separated list of specific airports to allow as connections.
excludeConnections-NoA comma separated list of specific airports to exclude as connections.
maxDuration-NoThe maximum total flight duration in minutes.
departureToken-NoUsed to select a flight and retrieve return flights for a round trip or the next leg of the itinerary for a multi-city trip.
bookingToken-NoUsed to request booking options for selected flights. This token is found in the flight results and cannot be used with departureToken.