Air Malta is a tiny operator with 10 aircraft that had experienced two decades of annual losses. It was €10.8m in the red (£9.6m, $12.1m) in the financial year to March 2017.
"We said, this is our last chance," explains Alan Talbot, the airline's chief information officer.
Malta, a 17-mile long island between Sicily and North Africa with 450,000 people, relies heavily on its five million annual tourists.
But Air Malta had trouble competing with the big airlines who also shuttle tourists to Malta's beaches and baroque buildings.
It has to supplement its income doing odd jobs for the small country, including air ambulance and postal services.
"We were in a position where there could possibly be no more Air Malta," says Mr Talbot.
He calls the four-decade-old company's battle to find a niche against Air France, Lufthansa, and Gulf Air "a David and Goliath story" of the air.
But the next year, the state-owned airline turned a profit of €1.2m – its first in 18 years. The number of passengers soared to two million, a rise of 11%.
And this reversal of fortune was down – in part – to clever use of technology, the company says.
Two-and-a-half years ago, Air Malta decided to redesign its computer systems around web-based APIs (Application Programming Interfaces) – publicly available ways one company can make its data available for others to use.
It's part of a growing collaborative economy.
By working with other businesses and sharing data, you make it easier for them to sell what you offer as part of their own offerings.
This kind of collaboration isn't new to the industry – airlines started widespread codeshares in the 1990s, when large alliances like Oneworld and Star Alliance formed.
But back then, making back-end servers talk to each other was an expensive and cumbersome business.
With APIs, this process has become fast and painless.
Ryanair, for example, started listing Air Malta flights on its website and the tech integration process took just 11 weeks
"We started getting connectivity requests from third parties who never considered us as an option," Mr Talbot says.
"Now, instead of us chasing them, we are in the flattering position they are asking us to connect."
API interfaces also let Air Malta connect more easily to cloud-based software handling different parts of airline operations, like flight operations, reservations, and customer management, the company says.
Other companies, like car service Addison Lee, also are moving towards more integrated, cloud-based offerings in this new API economy.
Addison Lee needed to rethink its place in a "market that gets disrupted by new entrants" like Uber, says Ian Cohen, its chief information officer.
And when it bought global chauffeur service Tristar Worldwide in 2016 in an attempt to expand its upmarket offerings, APIs made it easier to integrate their systems.
Air Malta and Addison Lee use a platform from San Francisco-based Mulesoft to connect their back-end systems to the cloud through APIs.
Amsterdam's Schiphol Airport uses a platform from North Carolina open source developer Red Hat.
The airport started integrating APIs as part of a digital airport strategy in 2015, says spokeswoman Willemeike Koster, enabling passengers and airlines to access up-to-date information.
"We had approximately 1.5 billion API calls [the number of times external software accesses a database] in 2018, and now have more than 300 API uses. Airport data is clearly a valuable asset for many," she says.
APIs bring down the cost of personalising offerings for a particular customer, like a flight followed by a taxi ride, says Uri Sarid, Mulesoft's chief technology officer.
And since customers will get more personalised solutions, companies will sell more of their products, he argues.
"Once GPS is available, who's going to look at maps?" he says.
Shifting from back-end servers to the cloud is "laying building blocks for much bigger disruptions to traditional businesses," says Red Hat's Mark Cheshire.
Still, a frequent mistake is for companies to say "everybody's got an API and we should, too", he says.
Instead, "don't try to boil the ocean but focus on getting one API successful for a particular use case, and build up from that," he recommends.
Companies like Air Malta and Addison Lee have been ahead of the curve in moving to a model of co-operating with other companies.
But over the next year, more businesses are "going to migrate into a world of mainstream adoption, where this is routine," says Michael Beckley, chief technology officer at Appian, a northern Virginia cloud computing company that works with APIs.
It will be "a new omnipresent expectation of how computer systems work – they should be collaborative, transparent, and should be scalable," he says.
But there are special challenges with APIs too, he warns.
Companies might find APIs they rely on suddenly slowing down. Maybe the designer of a data source wasn't anticipating a big spike in demand.
While APIs are "great at exposing data, and connecting back-office systems to new ideas," those back-office systems "may never have been designed for that workload," he says.
So in the API economy, says Mr Beckley, businesses "should plan for success and that growth, and have an ability to swap in an alternate service, or scale-up services."
Air Malta also boosted its fortunes by selling its summer landing rights at London's Heathrow and Gatwick airports to Malta's government, says Gabor Bukta, an aviation analyst in Budapest.
It will be leasing these rights back, giving it a cash boost of €33.9m – a helpful cushion as Air Malta pivots to its new business model.
Competition is increasing, though – Ryanair recently announced it will start a new low-cost airline called Malta Air.
Malta's Tourism Minister Konrad Mizzi says the new airline will not harm Air Malta, with its different business focus on medium-haul flights, routes to key hubs like Heathrow and Frankfurt, and cargo.
Air Malta is a "small airline, but a very ambitious airline", says Mr Talbot. Embracing the API economy seems to have put extra lift under its wings.
BBC