# ✈️ Google Flights API — Real-Time Flight Search > Live airfare, price calendars and airport data from Google Flights — through one simple REST API. Search **real-time flight prices** for any route in the world, build **cheapest-day price calendars**, track **price history**, and resolve **airports** — all with clean JSON responses and zero scraping on your side. Perfect for travel apps, fare-alert bots, metasearch sites, chatbots and price-comparison tools. --- ## ✨ Why this API - **Real-time fares** — prices come straight from Google Flights at request time. - **One-way & round-trip** — full passenger mix (adults, children, infants), cabin class, and stop filters. - **Price calendar** — find the cheapest day to fly across a date range in a single call. - **Price history** — see how a route's lowest fare has moved over time. - **Airport autocomplete** — search 6,000+ airports by IATA code, city or name (instant, no extra quota cost). - **Fast** — popular queries are cached and returned in milliseconds. - **Simple** — plain query parameters in, structured JSON out. No tokens, no async polling. --- ## 🚀 Quick start After subscribing to a plan, every request needs the two RapidAPI headers (the dashboard fills them in for you): ``` X-RapidAPI-Key: YOUR_RAPIDAPI_KEY X-RapidAPI-Host: google-flights-data.p.rapidapi.com ``` ### cURL ```bash curl --request GET \ --url 'https://google-flights-data.p.rapidapi.com/v1/flights/search?from=JFK&to=LAX&departDate=2026-07-15&maxResults=5' \ --header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \ --header 'X-RapidAPI-Host: google-flights-data.p.rapidapi.com' ``` ### JavaScript (fetch) ```javascript const res = await fetch( 'https://google-flights-data.p.rapidapi.com/v1/flights/search?from=JFK&to=LAX&departDate=2026-07-15', { headers: { 'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY', 'X-RapidAPI-Host': 'google-flights-data.p.rapidapi.com', }, }, ); const data = await res.json(); console.log(data.lowestPrice, data.itineraries); ``` ### Python (requests) ```python import requests url = "https://google-flights-data.p.rapidapi.com/v1/flights/search" querystring = {"from": "JFK", "to": "LAX", "departDate": "2026-07-15"} headers = { "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY", "X-RapidAPI-Host": "google-flights-data.p.rapidapi.com", } resp = requests.get(url, headers=headers, params=querystring) print(resp.json()) ``` > Replace `google-flights-data.p.rapidapi.com` with the exact host shown on the **Endpoints** tab of this API. --- ## 📚 Endpoints ### 1. Search flights — `GET /v1/flights/search` Live itineraries for a one-way or round-trip route. | Parameter | Required | Default | Description | |-----------|:--------:|---------|-------------| | `from` | ✅ | — | Origin IATA code (e.g. `JFK`) | | `to` | ✅ | — | Destination IATA code (e.g. `LAX`) | | `departDate` | ✅ | — | Departure date, `YYYY-MM-DD` | | `returnDate` | — | — | Return date `YYYY-MM-DD`. Add it to make the search round-trip | | `adults` | — | `1` | Adults (1–9) | | `children` | — | `0` | Children (0–8) | | `infantsInSeat` | — | `0` | Infants in their own seat | | `infantsOnLap` | — | `0` | Lap infants | | `cabinClass` | — | `economy` | `economy`, `premium-economy`, `business`, `first` | | `stops` | — | `any` | `any`, `0` (nonstop), `1`, `2` | | `currency` | — | `USD` | ISO 4217 currency code | | `locale` | — | `en-US` | Result language (BCP-47) | | `country` | — | `US` | Market/country (ISO 3166-1) | | `sort` | — | `best` | `best`, `price`, `duration`, `departure`, `arrival` | | `maxResults` | — | `50` | Max itineraries (1–100) | | `refresh` | — | `false` | `true` to bypass cache and force a live fetch | **Sample response** ```json { "currency": "USD", "lowestPrice": 197, "source": "live", "fetchedAt": "2026-06-22T20:42:00.000Z", "resultCount": 5, "itineraries": [ { "airlines": ["JetBlue"], "price": 197, "currency": "USD", "departureTime": "7:35 PM", "arrivalTime": "10:49 PM", "arrivalDayOffset": 0, "departureAirport": "JFK", "arrivalAirport": "LAX", "durationMinutes": 374, "durationLabel": "6 hr 14 min", "stops": 0, "stopAirports": [], "co2Kg": null, "priceLevel": "typical", "selfTransfer": false } ] } ``` | Field | Meaning | |-------|---------| | `lowestPrice` | Cheapest price across the returned itineraries | | `source` | `live` (fetched now) or `cache` (served from a recent fetch) | | `arrivalDayOffset` | `1` means the flight arrives the next day, `2` two days later, etc. | | `stops` | `0` = nonstop | | `priceLevel` | Google's read on the price: `low`, `typical`, `high`, or `null` | | `co2Kg` | Estimated CO₂ in kg, when shown by Google | --- ### 2. Price calendar — `GET /v1/flights/calendar` Cheapest fare **per departure date** across a range (up to 30 days). Great for "when is it cheapest to fly?" features. | Parameter | Required | Default | Description | |-----------|:--------:|---------|-------------| | `from`, `to` | ✅ | — | Route IATA codes | | `startDate`, `endDate` | ✅ | — | Inclusive date range, `YYYY-MM-DD` | | `tripLengthDays` | — | — | For round trips: nights at destination | | `cabinClass` | — | `economy` | Cabin class | | `currency` | — | `USD` | Currency code | **Sample response** ```json { "from": "JFK", "to": "LAX", "currency": "USD", "cheapest": { "date": "2026-07-09", "price": 178 }, "days": [ { "date": "2026-07-08", "price": 199, "currency": "USD" }, { "date": "2026-07-09", "price": 178, "currency": "USD" }, { "date": "2026-07-10", "price": 205, "currency": "USD" } ] } ``` > This endpoint queries one day at a time, so it takes longer than a single search. Keep the date range tight for the fastest response. --- ### 3. Price history — `GET /v1/flights/price-history` Lowest prices observed for a route/date over time, so you can show trends or "good deal" badges. | Parameter | Required | Default | Description | |-----------|:--------:|---------|-------------| | `from`, `to` | ✅ | — | Route IATA codes | | `departDate` | ✅ | — | Departure date, `YYYY-MM-DD` | | `limit` | — | `50` | Max data points (1–200) | **Sample response** ```json { "from": "JFK", "to": "LAX", "departDate": "2026-07-15", "count": 3, "series": [ { "observedAt": "2026-06-22T21:07:03Z", "lowestPrice": 254 }, { "observedAt": "2026-06-21T09:14:00Z", "lowestPrice": 268 }, { "observedAt": "2026-06-20T18:02:00Z", "lowestPrice": 249 } ] } ``` > History builds up as routes are searched over time. A route with no prior searches returns an empty `series`. --- ### 4. Airport search — `GET /v1/airports/search` Autocomplete airports by IATA code, city or name. Ideal for search boxes. Instant and lightweight. | Parameter | Required | Default | Description | |-----------|:--------:|---------|-------------| | `q` | ✅ | — | Query: IATA code, city or airport name | | `limit` | — | `10` | Max results (1–50) | **Sample response** ```json { "count": 2, "results": [ { "iata": "MAD", "name": "Adolfo Suárez Madrid–Barajas Airport", "city": "Madrid", "country": "Spain", "lat": 40.4719, "lon": -3.5626 } ] } ``` --- ## 🧭 Common use cases - **Fare-alert bots** — poll `search`/`price-history` and notify users when a route drops. - **"Cheapest day to fly"** — power a date picker with `calendar`. - **Travel chatbots / AI agents** — resolve cities with `airports/search`, then quote fares with `search`. - **Metasearch & comparison sites** — surface live prices, airlines, stops and durations. --- ## ⚠️ Error responses All errors share a consistent JSON shape: ```json { "error": "bad_request", "message": "Unknown origin airport code: \"ZZZ\".", "statusCode": 400 } ``` | Status | `error` | When | |:------:|---------|------| | `400` | `bad_request` | Invalid/missing parameters or unknown IATA code | | `403` | `forbidden` | Missing/invalid RapidAPI subscription | | `429` | `rate_limited` | Plan quota exceeded | | `502` | `upstream_error` | Temporary issue reaching Google Flights — retry shortly | --- ## ❓ FAQ **How fresh are the prices?** Live at request time. Identical recent searches may be served from a short-lived cache (look at the `source` field) — pass `refresh=true` to force a live fetch. **Which currencies and markets are supported?** Any ISO 4217 `currency` and ISO 3166-1 `country`/market that Google Flights supports. Defaults are `USD` / `US`. **Do airport lookups count against my quota?** They're served locally and are extremely fast; treat them as free, lightweight calls. **Why is `price` sometimes `null`?** Occasionally Google hides a price for a specific itinerary; the rest of the itinerary data is still returned. **Is this affiliated with Google?** No. This API is independent and not affiliated with, endorsed by, or sponsored by Google. "Google Flights" is a trademark of Google LLC. Prices are indicative — always confirm on the airline/booking site before purchase. --- ## 📨 Support Questions, feature requests or a route that looks off? Reach out through the **Discussions** tab on this API's RapidAPI page and we'll help.