How flight search works
The model behind the Flights Search API. How a search is created and read as it fills in, what a result holds, and which endpoint to call.
The Flights Search API searches one trip and answers with priced itineraries. Each itinerary carries links that open the airline's own site or Google Flights on those flights, so the traveller books there. The API never books, holds a seat or takes payment.
A search fills in over time
You start a search with GET /v1/flights/search (or POST with a JSON body). The answer names the search with a search_id and says how far it has got in status:
status | What it means |
|---|---|
complete | Every itinerary has arrived. The list will not change. |
partial | Itineraries are still arriving. The ones you have are real and usable, but the cheapest may not be among them yet. |
A partial answer is still HTTP 200. To get the rest, read the same search again with GET /v1/flights/search/{search_id}. That never starts another search. A search that fails ends with an error instead of a status: supplier_timeout or supplier_error. Once that happens, search the trip again.
How long a search takes depends on whether the trip was searched recently:
- A trip searched in the last few minutes answers at once, from the stored search.
- A new trip starts a search with the supplier. Itineraries arrive as the supplier finds them, most within the first 5 to 15 seconds. The supplier's closing answer can take about 30 seconds on a large route. The supplier is given 45 seconds in all.
- By default, a search waits for the complete answer, up to 30 seconds. Ask for
response_mode=partial(or send await_ms) to get what has arrived sooner, then read the rest bysearch_id. Read a search shows the loop.
Searches are stored by trip: the route, the dates, the number of travellers, the cabin and the currency. Asking for the same trip again while its stored answer is fresh returns that stored search, however you sort or filter it.
How fresh a price is
Every answer says how old its prices are, in data.pricing:
| Field | What it is |
|---|---|
priced_at | When the supplier priced this answer, in UTC |
age_s | How many seconds ago that was |
refreshing | true when the answer came from a stored search and a new search is running behind it |
A stored answer under 4 minutes old is served as it is. One up to 30 minutes old is served at once and searched again behind the reply. An older one is searched again before the reply. Reading a search by its search_id never refreshes it, so its age_s keeps growing.
Search again after four minutes
A supplier's fares run out about five minutes after a search. When age_s is over 240, search the trip again before you show a price or a booking link.
What one result holds
Each entry in data.results is one itinerary: the same flights in each direction, at the cheapest fare found for them.
| Field | What it holds |
|---|---|
id | Names these flights on this trip. The same flights on the same trip always get the same id, in every answer and every later search. |
airlines | The airlines selling the flights, in flying order, with code and name. |
price | The cheapest fare: total for all travellers, per_adult, and the currency you asked for. Prices are numbers with at most two decimals. |
stops, total_duration_min | The most stops in any direction, and each direction's minutes from departure to arrival, added together. |
slices | One per direction. depart and arrive are local to each airport, as the airline prints them. depart_utc and arrive_utc are the same moments in UTC. flights lists the flight numbers in flying order. |
fare | What the cheapest fare includes: its family name, the cabins it flies in, whether it is refundable or changeable, whether a carry-on or checked bag is included, and seats_left at that price. |
booking_links | Where to send the traveller to book. See Send travellers to book. |
The same itinerary can be sold at several fares. In the default detail=summary, a result shows only the cheapest, in fare. With detail=full it shows up to 10 fares in fares, cheapest first, each with its base fare, taxes, bag allowances and conditions. Full detail also adds every flight segment, layovers, aircraft and airline logos.
Suppliers fill in some details for some airlines and not for others. A detail the supplier did not give is null, which means "not known", not "no".
Live and test keys
A live key searches live prices. A test key is answered from saved sample data: one round trip from San Francisco to Tokyo Narita, 9 to 16 February 2027, whatever trip you ask for. It costs nothing and gives the same answer every time, so build against it first. Test and live keys keep separate searches. Every answer says which kind of key was used, in meta.mode (live or test). See Test mode.
Which endpoint to use
| You want to | Call |
|---|---|
| Search a trip | GET /v1/flights/search |
| Search a trip, with the fields in a JSON body | POST /v1/flights/search |
| Get the rest of a partial search, sort, filter or page it, or read one result in full | GET /v1/flights/search/{search_id} |
| See your key's limits and how much of them is used | GET /v1/flights/usage |
| Show an airline's logo | GET /logos/{code}.png |
| Send a traveller to book | Open a booking_links address in the traveller's browser |
The API searches one-way and round trips. It does not search multi-city trips.