Table of Contents
- As of April 10, 2018, Google Flights API is now deprecated. Consider using Skyscanner Flights API instead (qpx express api alternative) as your travel api provider.
As of April 10, 2018, Google Flights API is now deprecated. Consider using Skyscanner Flights API instead (qpx express api alternative) as your travel api provider.
So, what can you do with the Google Flights API?
If you haven’t tried the Google Flights website before, you should check it out.
(Source: Money Inc.)
Google Flights lets you comprehensively search available flights by price across multiple airlines in one, easy-to-use interface. Google Flights’ clean interface and open-ended search functionality make it different from other flight search applications.
Google Flights is largely powered by the Google Flights API, which came from its 2010 acquisition of ITA software and its QPX API. The Google Flights API returns a number of values, letting you go as broad as general price information and tickets, or as granular as infants-in-seat vs. infants-in-lap (read the full list of returns here).
Why we ❤️ the Google Flights API
Unlike actually planning travel (we’re still recovering from the holidays ourselves!), using the
Google Flights API (checkout Skyscanner instead) is remarkably simple. In fact, our package only uses two endpoints:
searchTrips. These endpoints are pretty straightforward.
searchSingleTrip: This endpoint returns all data for a single trip’s worth of flights.
searchTrips: This endpoint will search multiple flights based on user parameters.
Searching for flights is a very useful integration, especially since the Google Flights API doesn’t discriminate by airline. While the first 50 queries of the day are free, afterwards you pay $0.035 US per query.
How to call the Google Flights API
Ok, who’s ready to call the Google Flights API and search some flights?
Here’s how to do it.
Step 1: Get an API key from Google
First things first, you’ll need to get an
apiKey from Google itself. Here’s how:
- Go to Google Developers Console
- Log in with your google account or create a new account
- Select a project, or create a new one.
- Go to the QRX Express Airfare API Dashboard on Google’s API Manager (remember, Google acquired this API, so the name of the API isn’t “Google Flights API”)
- Click the “Enable” button towards the top of the page
- Go to the Credentials tab on the left side of Google’s API Manager to get your
Step 2: Make an API call from your browser from RapidAPI
Now that you have the
apiKey, you can call the API from RapidAPI’s Google Flights package page.
- Head over to the Google Flights package page on RapidAPI.
- Pick an endpoint and fill in the parameters (including your
apiKeyfrom Step 1).
- Hit “Test Function” to call the API.
Here’s what a successful API call looks like.
Once you’ve made a successful call, you can export the Google Flights API code snippet into your script. Just pick your language and copy the code. If you decide to incorporate multiple APIs from RapidAPI into your app (browse what’s on the marketplace here), you won’t need to download multiple libraries. You can call multiple APIs from a single RapidAPI endpoint.
Speaking of multiple API integrations, here are some project ideas that you can build with some of the existing APIs on the marketplace.
- Dedicate a Slack channel to potential office retreat ideas based on Google Flights
- Decide on layover stopes by Google Flight prices and Yelp reviews of the airports
- Build the ultimate travel app that with Google Flights and a built-in translator with Google Translate
- Integrate Google Flights API and Plivo or Twilio‘s text messaging APIs to get text notifications when a flight becomes available at a price you set
Let us know what you build in the comments below!
Need more inspiration? There’s one more week of APIs left!
If you want more API ideas, check out our #12DaysOfAPIs series on the blog or follow along on Facebook or Twitter (@rapid_API). You can also browse our existing APIs on the marketplace. We add more every week! If you sign up for an account using an email address, we’ll send you a weekly update of what’s new to the marketplace.