Flight API: Google Flights and Kiwi Data as JSON
A flight API takes an origin, a destination and a date and returns itineraries with a price, carrier, times, stops and duration. Google Flights' one-way endpoint returns those plus CO2 emissions and a booking_token; Kiwi.com's flights-search returns them plus baggage allowances and a booking_url. Both charge 1 credit per call, so one route on one date costs 1 credit. For a range of dates, each has a calendar-style endpoint that takes a start and end date in one call.
What should a flight API return per itinerary?
A flight API is useful when each itinerary carries enough to compare and act on without another call: a price with its currency, the carrier, departure and arrival airports and times, the number of stops, the total duration, and a handle to book or fetch details. Both recorded responses carry all of these, with different field names and different extras.
The extras decide which source fits. Google Flights adds an emissions object per flight, with grams of CO2 and a difference_percent against a typical figure. Kiwi.com adds a baggage object, with how many hand and checked bags are included, and travel_hacks flags named virtual_interlining and hidden_city. If your product shows bag costs, Kiwi's fields matter; if it ranks by emissions, Google's do.
Times need care in both. The recorded departure and arrival times are local clock times with no offset (2026-12-15T08:01:00, 2026-12-04T15:35:00), so subtracting them doesn't give the flight time across time zones. Use the duration field instead.
What does Google Flights' one-way search return?
Google Flights' one-way search returns a flights array, each item a priced itinerary with its legs, plus a search_metadata object that echoes the search as it ran. It needs origin, destination and departure_date, and takes filters such as max_stops, cabin_class, sort_by (one of top_flights, cheapest, departure_time, arrival_time, duration, emissions), airlines[] and max_price. A successful call costs 1 credit.
curl "https://api.perceptlayer.com/v1/google-flights/one-way?origin=JFK&destination=LAX&departure_date=2026-12-15" \
-H "X-API-Key: $API_KEY"
The recorded response, trimmed to the first flight and part of the metadata:
{
"flights": [
{
"price": 179,
"currency": "USD",
"total_duration_minutes": 384,
"stops": 0,
"airline_name": "JetBlue",
"emissions": {
"co2_grams": 426000,
"co2_kilograms": 426,
"typical_co2_grams": 344000,
"typical_co2_kilograms": 344,
"difference_percent": 24
},
"booking_token": "CjRISVFvemhYdy1QZTBBQTR3SXdCRy0tLS0tLS0tLWVqY3J5N0FBQUFBR3JhOFJBQUFyOGdBEgZCNjIyMjMaCwiwiwEQAhoDVVNEOBxwsIsB",
"legs": [
{
"airline": "B6",
"flight_number": "2223",
"departure_airport": "JFK",
"arrival_airport": "LAX",
"departure_time": "2026-12-15T08:01:00",
"arrival_time": "2026-12-15T11:25:00",
"duration_minutes": 384
}
]
},
…
],
"search_metadata": {
"origin": "JFK",
"destination": "LAX",
"departure_date": "2026-12-15",
…
"cabin_class": "Economy",
…
"max_stops": "Any number of stops",
…
"currency": "USD",
"response_time_ms": 5598
}
}
total_duration_minutes is 384, which is 6 hours 24 minutes: the 3 hours 24 minutes between the local times plus the 3-hour difference between New York and Los Angeles. Each flight has a booking_token, and the booking-details endpoint takes a required booking_token along with the route, date, airline and flight_number; the names match, but we haven't recorded that call. The round-trip endpoint adds a required return_date and an optional departure_token.
What does Kiwi.com's flight search return?
Kiwi.com's flight search returns data.itineraries, each with an id, a price object, duration, stops, carriers, departure and arrival objects, segments, a baggage object and a booking_url. It also echoes the search: trip_type, currency, sort, limit and total_available. Required parameters are origin, destination and departure_date; return_date, max_stops, sort (quality, price or duration) and carriers[] are optional. Each call costs 1 credit.
curl "https://api.perceptlayer.com/v1/kiwi/flights-search?origin=LON&destination=BCN&departure_date=2026-12-04" \
-H "X-API-Key: $API_KEY"
The recorded response, trimmed to the first itinerary:
{
"success": true,
"data": {
"trip_type": "one_way",
"origin": "LON",
"destination": "BCN",
…
"currency": "EUR",
"sort": "quality",
…
"total_available": 23,
"itineraries": [
{
"id": "ItineraryOneWay:eyJwcm92aWRlcnMiOiJLSVdJLUJBU0lDOktJV0kiLCJyb3V0ZV9kYXRhIjoiRlI6NzgwNzpMVE46MTc5NjM5ODUwMDpCQ046MTc5NjQwNjMwMDplY29ub215OkZhbHNlOjo6IiwicHJpY2Ui…",
…
"price": {
"amount": 29,
"currency": "EUR",
"formatted": "29 €"
},
"price_eur": 29,
"duration": 7800,
…
"baggage": {
"hand_bags_included": 0,
"checked_bags_included": 0,
"personal_item_included": 1,
…
},
"booking_url": "https://www.kiwi.com/en/booking/?direct=true&locale=en¤cy=eur&passengers=1-0-0&token=Hhoyto0aDRzGf7RBtr6qW50xdrd381w4wOMBtYctggZ7a2BQwGlN4QCwjESAZb1G5zED3…",
"stops": 0,
"carriers": [
{
"code": "FR",
"name": "Ryanair",
"icao": "RYR"
}
],
"departure": {
"airport_code": "LTN",
"airport": "Luton",
"city": "London",
…
"local_time": "2026-12-04T15:35:00"
},
"arrival": {
"airport_code": "BCN",
…
"local_time": "2026-12-04T18:45:00"
},
…
},
…
]
},
…
}
duration is 7800. The local times are 3 hours 10 minutes apart, and Barcelona's clock is an hour ahead of London's in December, so the flight takes 2 hours 10 minutes, which is 7,800 seconds. The second recorded itinerary leaves from Stansted, so the city code LON covers more than one airport. Each itinerary's id and the flights-detail endpoint's required itinerary_id share a name; we haven't recorded that call.
How do the itinerary fields compare?
The two responses carry the same core facts under different names, and each has one set of extras the other lacks. Map them once into your own schema and the rest of your code doesn't need to know which source a fare came from. The table lists the field for each concept in the recorded responses.
| Concept | Google Flights one-way |
Kiwi.com flights-search |
|---|---|---|
| Price | price (number) and currency |
price.amount, price.currency, price.formatted, plus price_eur |
| Carrier | airline_name; legs[].airline code |
carriers[].name, code, icao |
| Flight number | legs[].flight_number (2223) |
segments[].flight_number (FR7807) |
| Airports | legs[].departure_airport, arrival_airport |
departure.airport_code, arrival.airport_code, with city and country |
| Times | legs[].departure_time, arrival_time (local, no offset) |
departure.local_time, arrival.local_time |
| Duration | total_duration_minutes (minutes) |
duration (7800 for a 2 h 10 min flight) |
| Stops | stops |
stops |
| Extras | emissions with CO2 and difference_percent |
baggage, travel_hacks |
| Next step | booking_token |
booking_url, id |
| Origin input | Up to 3 characters (JFK) |
City code accepted (LON) |
| Endpoints | 7 | 7 |
| Cost | 1 credit per call | 1 credit per call |
This Python maps both into one row shape, using only those fields:
import os
import requests
BASE = "https://api.perceptlayer.com"
HEADERS = {"X-API-Key": os.environ["API_KEY"]}
def get(path, params):
r = requests.get(BASE + path, params=params, headers=HEADERS, timeout=60)
r.raise_for_status()
return r.json()
def google(origin, dest, date):
data = get("/v1/google-flights/one-way",
{"origin": origin, "destination": dest, "departure_date": date})
for f in data["flights"]:
yield ("google", date, f["price"], f["currency"], f["stops"],
f["airline_name"], f["total_duration_minutes"])
def kiwi(origin, dest, date):
data = get("/v1/kiwi/flights-search",
{"origin": origin, "destination": dest, "departure_date": date})
for it in data["data"]["itineraries"]:
yield ("kiwi", date, it["price"]["amount"], it["price"]["currency"],
it["stops"], it["carriers"][0]["name"], it["duration"] // 60)
rows = list(google("JFK", "LAX", "2026-12-15")) + list(kiwi("LON", "BCN", "2026-12-04"))
for row in sorted(rows, key=lambda r: r[2]):
print(row)
Converting Kiwi's duration with // 60 assumes seconds, which matches the recorded flight; check it against a second route before you rely on it. The two sources also price in different currencies here (USD and EUR), so convert or pass currency before you compare prices across them.
How do you search a range of dates?
You have two options: one one-way call per date, or one calendar call per route that takes a start and end date. Google Flights' date-range endpoint requires origin, destination, from_date and to_date, and takes trip_duration and max_stops. Kiwi.com's calendar-cheapest-dates requires origin, destination, start_date and end_date, with optional nights_min and nights_max; calendar-price-graph makes the nights required.
We haven't recorded any of the calendar endpoints, so we don't describe their fields, how wide a window one call answers, or whether they return full itineraries. Run one in the playground on the Google Flights API page or the Kiwi.com API page first.
The pattern that keeps costs down is a calendar call to find the cheap dates, then one-way calls only for those. Kiwi.com also has explore-price-map and flights-one-per-city, which take an origin without a required destination, for "where can I fly from here" questions.
What does a route cost per day?
Cost is 1 credit per successful call on every endpoint here, so one route on one departure date is 1 credit with a one-way search, and one route over a window is 1 credit per calendar call. Failed calls cost nothing and return X-Credits-Used: 0. What you pay is set by how many calls your schedule makes.
| Schedule | Calls a month | Credits |
|---|---|---|
| 5 routes × 1 date, daily, one source | 5 × 30 = 150 | 150 |
| 5 routes on both sources, daily | 5 × 2 × 30 = 300 | 300 |
| 20 routes × 30 dates, daily, one-way calls | 20 × 30 × 30 = 18,000 | 18,000 |
| 20 routes, one date-range call each, daily | 20 × 30 = 600 | 600 |
| The 600 above, plus 3 one-way checks per route daily | 600 + 20 × 3 × 30 = 2,400 | 2,400 |
The last row is the calendar-then-detail pattern: 2,400 credits against 18,000 for checking every date. It's past the 100 free credits on signup, and the Starter pack's 10,000 credits cover it for four months. Purchased credits last 12 months; pricing shows what credits cost. The recorded Google Flights call reports response_time_ms: 5598, so allow a generous client timeout; a call that timed out on your side may still have succeeded and been billed, because requests have no idempotency key.
Which one should you use?
Pick by the extra field your product needs and by the trip shape. Both cover a priced itinerary per route and date at the same cost; the differences are bags versus emissions, airport versus city origins, and a token versus a link for the next step.
- Fare tracking on fixed routes: either works. Use the date-range or calendar endpoint daily, then one-way for the cheap dates. Store price, currency, stops and duration with the time of the call.
- Showing total trip cost with bags: Kiwi.com. The
baggageobject says what's included and lists checked-bag prices. - Ranking by emissions: Google Flights, with
emissions.co2_kilogramsanddifference_percent, orsort_by=emissions. - City-to-city searches across several airports: Kiwi.com, which took
LONand returned Luton and Stansted. - "Where can I go from here" questions for an agent: Kiwi.com's
explore-price-maporflights-one-per-city, through the MCP server; the AI agents docs cover setup. - A booking engine: neither. These endpoints return search data as found at the time of the call; booking happens on the site.
To compare on your own route, run one-way in the playground on the Google Flights API page and flights-search on the Kiwi.com API page. When the fields fit, get a free API key. More guides like this are in the API guides category and on the travel APIs page.
APIs in this post
Frequently asked questions
Is there a free flight API?
Every account gets 100 free credits after verifying an email address, with no credit card. A Google Flights or Kiwi.com search costs 1 credit, so that's 100 searches, enough to test a fare tracker on a few routes. Failed calls cost nothing. Beyond that, credits come in prepaid packs; pricing has what they cost.
Do the prices include baggage?
The recorded Kiwi.com itinerary includes a baggage object showing 0 checked bags and 1 personal item included, with a list of checked-bag prices, so the headline price there covers no checked bag. Google Flights' one-way endpoint takes an include_baggage parameter, but we haven't recorded it, so test it in the playground.
Are the times in the response local or UTC?
The recorded departure and arrival times carry no offset, and they read as local clock times at each airport. Both durations match that reading once you allow for the time difference. Store the airport code with each time and use total_duration_minutes or duration for the flight length rather than subtracting times.
Can I book a flight through these endpoints?
No. The endpoints return search data. Kiwi.com itineraries include a booking_url that points to the booking page on kiwi.com, and Google Flights results carry a booking_token that the booking-details endpoint takes as a parameter. Booking itself happens on the site, under its own terms.
What happens when a flight search fails?
A failed call returns an HTTP status and a JSON body with error.code, error.message and request_id, and costs nothing. A 429 or 503 response carries Retry-After with the seconds to wait. When credits run out, calls return insufficient_credits (402). The errors docs list every code.