HasData
Scraper API

Google Flights API

for fares, itineraries, and flight deals

Get Google Flights fares and itineraries as JSON. Search routes and dates, or discover deals from a trip description.

SUCCESS
99.9%

of requests succeed

P50
1.5s

median response

P95
2.4s

95% finish faster

PRICE
$1.25

per 1k flight searches at volume

Performance figures cover route searches, not Flights Deals.

Stop maintaining scrapers

Fares change by the minute. Your code shouldn't care.

  • Session tokens that expire
  • Itineraries buried in nested JSON
  • Prices in a dozen formats
  • Headless browsers to keep warm
  • Fix the parsers again next week
One integration commit replaces a backlog you’ll never finish.
scraper | git log
✗ hotfix: markup changed, nulls in price
✗ fix: session token expired mid-crawl
✗ fix: itinerary leg misparse on stops
✗ chore: bump browser pool memory
✗ fix: nested JSON path changed again
✗ hotfix: price format switched with locale
✗ fix: layover dedupe on codeshares
✗ chore: re-run failed batch overnight
✗ fix: pagination token stopped working
✗ fix: retry storm on timeouts
✗ hotfix: markup changed, nulls in price
✗ fix: session token expired mid-crawl
✗ fix: itinerary leg misparse on stops
✗ chore: bump browser pool memory
✗ fix: nested JSON path changed again
✗ hotfix: price format switched with locale
✗ fix: layover dedupe on codeshares
✗ chore: re-run failed batch overnight
✗ fix: pagination token stopped working
✗ fix: retry storm on timeouts
✗ hotfix: markup changed, nulls in price
✗ fix: session token expired mid-crawl
✗ fix: itinerary leg misparse on stops
✗ chore: bump browser pool memory
✗ fix: nested JSON path changed again
✗ hotfix: price format switched with locale
✗ fix: layover dedupe on codeshares
✗ chore: re-run failed batch overnight
✗ fix: pagination token stopped working
✗ fix: retry storm on timeouts
✗ hotfix: markup changed, nulls in price
✗ fix: session token expired mid-crawl
✗ fix: itinerary leg misparse on stops
✗ chore: bump browser pool memory
✗ fix: nested JSON path changed again
✗ hotfix: price format switched with locale
✗ fix: layover dedupe on codeshares
✗ chore: re-run failed batch overnight
✗ fix: pagination token stopped working
✗ fix: retry storm on timeouts
✓ feat: integrate HasData API
Code Examples

One GET Request. That's the whole integration.

Start with just a query. Add more parameters when your use case needs them.

request example
curl -G 'https://api.hasdata.com/scrape/google/flights' \
	--data-urlencode 'departureId=LHR' \
	--data-urlencode 'arrivalId=JFK' \
	--data-urlencode 'outboundDate=2026-10-19' \
	--data-urlencode 'returnDate=2026-10-26' \
	--header 'x-api-key: <YOUR_API_KEY>' \
	--header 'Content-Type: application/json'
departureId * Departure airport code / location kgmid
Specifies 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](https://www.iata.org/en/publications/directories/code-search). - **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`).
arrivalId * Arrival airport code / location kgmid
Specifies 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](https://www.iata.org/en/publications/directories/code-search). - **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`).
outboundDate * Outbound Date
The outbound travel date in 'yyyy-MM-dd' format.
returnDate Return Date
The return travel date in 'yyyy-MM-dd' format. Required when **type** is `roundTrip`.
type Flight Type
Specifies 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 Multi-city JSON
This 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 Country
The two-letter country code for the country you want to limit the search to.
hl Language
The two-letter language code for the language you want to use for the search.
currency Currency
Parameter defines the currency of the returned prices
travelClass Travel Class
The travel class for the flight (Economy, Premium Economy, Business, or First).
showHidden Show Hidden Fares
Indicates whether to include hidden options in the results.
adults Adults
Number of adult passengers (>= 1 if specified).
children Children
Number of child passengers.
infantsInSeat Infants in Seat
Number of infants occupying seats.
infantsOnLap Infants on Lap
Number of infants sitting on an adult's lap.
sortBy Sort By
Sort the flight results based on price, departure time, arrival time, etc.
stops Stops
Restrict the number of stops (layovers) in the flight itinerary.
excludeAirlines Exclude Airlines
A comma separated list of airline codes to exclude from results. You can search for airline codes on [IATA](https://www.iata.org/en/publications/directories/code-search). For example, `UA` is United Airlines.
includeAirlines Include Airlines
A comma separated list of airline codes to exclusively include in results. You can search for airline codes on [IATA](https://www.iata.org/en/publications/directories/code-search). For example, `UA` is United Airlines. `excludeAirlines` and `includeAirlines` parameters can't be used together.
bags Number of Bags
Number of carry-on bags per passenger.
maxPrice Maximum Price
Maximum price limit for the flight search, in the selected currency.
outboundTimes Outbound Times
Set 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 Return Times
Set 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 Fewer Emissions
Prefer flight options with lower carbon emissions.
layoverDuration Maximum Layover Duration
Set 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 Include Connections
A comma separated list of specific airports to allow as connections.
excludeConnections Exclude Connections
A comma separated list of specific airports to exclude as connections.
maxDuration Maximum Flight Duration
The maximum total flight duration in minutes.
deepSearch Deep Search
Enable deep search. Returns the same results as Google Flights in a browser, but takes longer to respond. Default is `false`.
departureToken Departure Token
Used 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 Booking Token
Used to request booking options for selected flights. This token is found in the flight results and cannot be used with `departureToken`.
TRY ALL 31 PARAMETERS FREE
AI Integration

Add Google Flights API with your AI agent

Paste a ready-to-use integration prompt into your coding agent. It includes API references, setup requirements, and testing instructions.

google-flights-integration.md
# Integrate HasData Google Flights API

## Task

Add the flight-search or deal-discovery function this project needs using HasData Google Flights API.
Inspect project instructions, the server-side runtime, existing HTTP client, and tests first.
Follow the project's conventions and preserve unrelated code. No new SDK is required.
Choose the endpoint for the requested task; do not build both workflows unless needed.
Do not replace the REST integration with an MCP connection or a custom Google Flights scraper.

## References

Read the relevant endpoint documentation before implementing:

- Routes and itineraries: https://docs.hasdata.com/apis/google-travel/flights.md
- Natural-language deal search: https://docs.hasdata.com/apis/google-travel/flights-deals.md
- Error handling: https://docs.hasdata.com/api-codes.md
- Documentation index: https://docs.hasdata.com/llms.txt
- Full documentation (fallback): https://docs.hasdata.com/llms-full.txt

Start with the endpoint references. Use `llms.txt` to find additional pages.
Use `llms-full.txt` only when needed; extract relevant sections instead of loading everything into context.
If a `.md` reference is unavailable, try its HTML URL without `.md`.
If it is still unavailable, ask for the missing documentation rather than guessing.

## Optional agent skill

If the official `hasdata` skill is already available, use its relevant guidance.
Otherwise, if this agent supports skills, ask before installing it in this project:

```sh
npx skills add hasdata/agent-skills --skill hasdata
```

Run from the project directory and select the coding agent in use.
The `hasdata-cli` skill is not required. If installation is declined or unsupported, continue with the docs.
Flag conflicts between skill guidance and current API docs rather than guessing.

## Implementation

- Route search: `GET https://api.hasdata.com/scrape/google/flights`. Use documented `departureId`, `arrivalId`, and `outboundDate` for a dated route search. Airport identifiers can be IATA codes or supported location IDs.
- Set `type` explicitly: `oneWay`, `roundTrip`, or `multiCity`. A round trip requires `returnDate`; multi-city uses the documented `multiCityJson` structure. Implement only the trip types the project needs.
- For route search, keep dates in YYYY-MM-DD format and validate future dates and ordering. Preserve currency, passenger counts, and cabin class throughout a search and follow-up requests.
- Treat `bestFlights`, `otherFlights`, `priceInsights`, and `airports` as optional response blocks. Preserve returned itinerary prices, flight legs, layovers, and their local-time strings. Do not infer missing return-leg details.
- If needed, use a returned `departureToken` for return or onward flights, or `bookingToken` for booking options. Never combine these tokens. Each follow-up is a separate request; do not automatically expand every result.
- Deal discovery: `GET https://api.hasdata.com/scrape/google/flights-deals` with required `q` (natural-language travel request) and `departureId` (one uppercase three-letter IATA airport code, not a city name or a list). Read its own parameters; use a verified response fixture when available rather than reusing route-search field assumptions.
- For Deals, use `arrivalId` when the user needs documented structured filters. Google ignores those filters without an explicit destination; do not silently claim they were applied. Preserve returned dates, destination, duration, currency, and price basis together.
- Deals dates accept an exact date or a comma-separated date window. Its `returnDate`, `travelDuration`, and `tripLength` options are mutually exclusive; `returnDate` requires `outboundDate`. Implement only the documented combinations needed for the task.
- Preserve `searchInformation` and `flightDeals`. Each deal can contain `destination`, `outboundDate`, `returnDate`, `price`, `typicalPrice`, `discountPercent`, and `bookingLink`. Preserve currency and each deal’s dates; do not assume all suggestions cover the same stay or recalculate reported discounts. One-way deals can omit return dates.
- Treat an empty `flightDeals` array as a valid result. Do not silently relax the user's constraints or retry to force matches.
- Add only documented filters needed for the task. Avoid incompatible airline filters and handle opaque tokens without decoding or modifying them.
- Handle timeouts, documented errors, empty results, and missing optional price, baggage, emissions, or historical data. Unknown does not mean zero or false.
- Price alerts, scheduled monitoring, saved search history, and recommendations belong to this application. The API retrieves results; do not implement ticket purchases or promise guaranteed fares.
- Keep requests server-side. If there is no suitable server-side runtime, discuss options before changing the architecture.

## Credentials

- Implement the integration and mocked tests without requiring a live API key.
- Read `HASDATA_API_KEY` from the project's existing environment or secret store and send it as `x-api-key`.
- If the key is missing before live verification, ask the user to configure it from https://app.hasdata.com/api-keys.
- Never ask the user to paste the key into chat. Check only that it is configured, without printing its value.
- Never put the key in browser code, logs, or version control. Add only a placeholder to example configuration.
- If using a local `.env` file, make sure it is gitignored.
- Send the key only to `https://api.hasdata.com`. Never forward it to documentation, Google, airline URLs, or redirects to another origin.

## Verification

- Add mocked tests for the chosen endpoint: success, empty results, missing optional blocks, documented errors, and parameter encoding. Test date validation and token handling only for the implemented workflow.
- Include a usage example and run local checks without paid API calls. If no verified response fixture is available, ask for one instead of inventing a schema.
- Only after explicit user approval and with a configured key, make one live verification request with agreed travel inputs. Successful requests consume credits, including empty results.
- Validate HTTP status, documented API status, and response structure. Do not automatically repeat paid requests to obtain data.
- Report changed files, setup commands, and test results. State separately whether live verification passed, failed, or was skipped.
- Ask before deploying.

Use Cases

Build with Google Flights API

Build airfare comparisons, trip discovery, and fare alerts with structured Google Flights data.

Compare airfare with travel time

Build flight comparison tools that weigh ticket prices against airlines, stops, and outbound travel time.

  • LHR to JFK
  • Departure: 20 Sep 2026
  • USD · saved response
Fare and itinerary shortlist Illustrative app output
Fare and itinerary shortlist — Illustrative app output
ItineraryReported round-trip fareOutbound duration
JetBlue · BOS$1,14012h 20m
Virgin Atlantic · Nonstop$1,5618h 10m
Royal Air Maroc · CMN$90229h 35m
API data
bestFlights[].priceotherFlights[].pricebestFlights[].totalDurationbestFlights[].flights[]
Your app
Combine returned itineraries into a shortlist using the traveler's price and journey-time limits.
Explore response fields

Saved round-trip fares, with outbound durations only. Compare fresh results using the same dates, trip type, passengers, and currency.

Flag long and overnight layovers

Use connection airports and layover durations to filter flight itineraries for business travel tools and trip planners.

  • LHR to JFK
  • Departure: 20 Sep 2026
  • USD · saved response
Connection review Illustrative app output
Connection review — Illustrative app output
Connection airportLayoverOvernight reported
BOS3h 26mNot specified
CMN18h 25mYes
API data
bestFlights[].layovers[]otherFlights[].layovers[].durationotherFlights[].layovers[].overnight
Your app
Apply connection-time rules and flag reported overnight layovers before showing a traveler's shortlist.

Build fare alerts with price context

Use Google Flights price insights and historical fares to explain current prices and power your own monitoring rules.

  • LHR to JFK
  • Departure: 20 Sep 2026
  • USD · saved response
Example alert rule: fare below $800 Illustrative app output
Example alert rule: fare below $800 — Illustrative app output
SignalValue
Lowest returned fare$902
Typical price range$425–$810
Reported price levelhigh
Your app's alert decisionNo alert
API data
priceInsights.lowestPricepriceInsights.typicalPriceRangepriceInsights.priceLevelpriceInsights.priceHistory
Your app
Schedule searches, store snapshots, and trigger your own notifications when a matching fare crosses the traveler's threshold.

Match flight options to cabin preferences

Compare cabin classes, aircraft, and reported legroom to build flight search experiences that go beyond the lowest fare.

  • LHR to JFK
  • Departure: 20 Sep 2026
  • USD · saved response
Outbound flight-leg comparison Illustrative app output
Outbound flight-leg comparison — Illustrative app output
FlightCabinAircraftLegroom
B6 1621EconomyAirbus A321neo32 in
VS 3EconomyAirbus A330-900neo31 in
API data
bestFlights[].flights[].travelClassbestFlights[].flights[].airplanebestFlights[].flights[].legroom
Your app
Display per-leg comfort details alongside fares; keep each aircraft and seat-pitch value attached to its flight.

Compare reported flight emissions

Add carbon emission estimates and route benchmarks to travel dashboards so users can compare options alongside fare and duration.

  • LHR to JFK
  • Departure: 20 Sep 2026
  • USD · saved response
Estimated CO₂ for returned flight options Illustrative app output
Estimated CO₂ for returned flight options — Illustrative app output
ItineraryEstimated CO₂Versus typical
JetBlue · BOS608 kg+86%
Virgin Atlantic · Nonstop267 kg-18%
API data
bestFlights[].carbonEmissions.thisFlightbestFlights[].carbonEmissions.typicalForThisRoutebestFlights[].carbonEmissions.differencePercent
Your app
Convert reported grams to kilograms and show Google's comparison with the typical route estimate.
Explore response fields

These are Google's estimates, not measured emissions. Preserve the reported percentage even when rounded amounts differ.

Find flight deals from a trip idea

Turn a natural-language travel request into destination suggestions with dates, fares, and reported discounts for your trip-planning app.

  • beach escape
  • From LAX
  • 1 adult · USD
Destination ideas from Los Angeles Captured flight deals
Destination ideas from Los Angeles — Captured flight deals
DestinationTravel datesReported fareBelow typical
Gold Coast (OOL)7 Dec 2026 – 13 Dec 2026$94342%
Honolulu (HNL)5 Oct 2026 – 13 Oct 2026$22937%
Saint Lucia (SLU)31 Jan 2027 – 9 Feb 2027$1,11032%
API data
flightDeals[].destinationflightDeals[].outboundDateflightDeals[].returnDateflightDeals[].priceflightDeals[].discountPercent
Your app
Present the returned destinations and dates as travel ideas, with links to inspect each flight offer.
Explore response fields

Each suggestion has its own dates. Discounts are reported by Google against typical fares, not guaranteed savings.

Response

Every route, one predictable schema

Explore itineraries, connections, price insights, and flight deals. Available fields depend on the endpoint and search.

bestFlights.json
[
  {
    "price": 758,
    "type": "Round trip",
    "totalDuration": 490,
    "flights": [
      {
        "departureAirport": {
          "id": "LHR",
          "name": "Heathrow Airport",
          "time": "2026-08-15 8:20"
        },
        "arrivalAirport": {
          "id": "JFK",
          "name": "John F. Kennedy International Airport",
          "time": "2026-08-15 11:30"
        },
        "airline": "Virgin Atlantic",
        "airplane": "Airbus A350",
        "flightNumber": "VS 3",
        "travelClass": "Economy",
        "legroom": "31 in",
        "duration": 490
      }
    ],
    "carbonEmissions": {
      "thisFlight": 243000,
      "typicalForThisRoute": 326000,
      "differencePercent": -25
    },
    "departureToken": "W1t7ImRlcGFydHVyZUlkIjoiTEhSI…"
  }
]
Fields in bestFlights
price number

Total price for the itinerary

type string

Round trip | One way

totalDuration number

Total travel time in minutes

flights[] object[]

Each leg of the itinerary

flights[].departureAirport / arrivalAirport object

id, name, and local time

flights[].airline / airplane string

Carrier and aircraft

flights[].travelClass / legroom string

Cabin and seat pitch

carbonEmissions.thisFlight / typicalForThisRoute number

Estimated emissions in grams: this flight and the typical route

carbonEmissions.differencePercent number

Reported percentage difference from the typical route estimate

departureToken string

Token to fetch return/onward options

What We Offer

An all-in-one scraping service

Every feature you need to collect data from thousands to millions of requests.

Loved by developers

Teams that deleted their scraper

Now it's the part of the pipeline they don't think about

4.8 ★★★★★
across 100+ reviews on 5 platforms
Clutch Clutch ★★★★★

Their ability to handle dynamic content, including time-sensitive flight pricing, was particularly impressive.

BT
Bunny Tharpe
Former VP at Quark Software Inc.
Trustpilot Trustpilot ★★★★★

HasData delivers exactly what we need: speed and comprehensive search features. It's the fastest API we've used in this space. Plus, their customer support is fantastic.

Denver Sinclair
Denver Sinclair
Capterra Capterra ★★★★★

We rely on HasData for search performance data and broader scraping needs. Their APIs deliver highly structured data that integrates directly into our platforms.

JN
Jacob N.
Trustpilot Trustpilot ★★★★★

Great web scraping API which is incredibly easy to use. It requires minimal effort to get up and running, and the documentation is very clear and helpful.

Arnold Foster
Arnold Foster
Trustpilot Trustpilot ★★★★★

I needed to scrape some information they didn't already support, and they wrote the code for me right away, which was super nice of them.

Hussein Ali
Hussein Ali
Pricing

Plans that get cheaper at scale

Fixed price, fixed volume, no surprises at the end of the month. Upgrade when you need more.

Free
$0 /mo
Free forever
67 flight searches / month
1,000 credits / month
1 concurrent request
Structured JSON, no parsers to maintain
Only successful requests billed
Team seats
Community support
Start free
Startup
$49 /mo
$3.69 / 1k flight searches
13.3K flight searches / month
200K credits / month
5 concurrent requests
Structured JSON, no parsers to maintain
Only successful requests billed
Team seats
Email support
Get started
Basic
Recommended
$99 /mo
$1.49 / 1k flight searches
66.7K flight searches / month
1M credits / month
15 concurrent requests
Structured JSON, no parsers to maintain
Only successful requests billed
Team seats
Priority email support
Get started
Growth
$208 /mo
$1.04 / 1k flight searches
3M credits / month
50 concurrent requests
Structured JSON, no parsers to maintain
Only successful requests billed
Team seats
Dedicated account manager
Get started
Monthly flight search volume
Free 66.7K 333.3K 1.3M
Best fit
Basic
flight searches / mo
66.7K
Concurrency
15
$ / 1k flight searches
$1.49
$99 /mo
Get Started
Enterprise
Custom price based on required volume

Past 20M credits a month, or terms the self-serve plans do not cover. We shape the contract around your workload.

Credits rollover
Unused credits carry into the next billing period.
Concurrency 2000+
Parallel request limits set to your peak load.
#1 request priority
Highest speed, always first in the queue.
Personal manager
A direct line to the founding team.
SSO
SAML single sign-on for the whole team.
Security review
Security questionnaire, DPA, and controls overview.
Talk to sales Quote within one business day
FAQ

Questions, answered

1 Grab your API key 2 Send a GET request 3 Get structured JSON

Your first Google Flights response
is minutes away

66 flight searches free · no credit card