Google Flights had an API, but it is was deprecated on April 10th, 2018.
Unfortunately, it's been discontinued. But there is a great alternative called the Skyscanner Flight Search API.
The main function of the Sky Scanner API is searching for flights. This can be done in two ways: cached search and live search.
The Hipmunk API is available to consume on RapidAPI.