Skip to content
Blog

An API for flight prices: why the number is not yet a fare

Tekravel Editorial
Written with the help of AI

The demo works. A developer wires an API for flight prices into a calendar of the cheapest days to fly, the grid fills with numbers, and everyone in the room is pleased. Then the first real customer picks a date, sees a lower figure on the results page than the one on the payment page, and writes to support with a screenshot. Nothing is broken. The API did exactly what it was asked: it answered a question about price, and the site treated the answer as a promise.

A price is an offer with a short memory

An airline fare is not a fixed label on a seat. It is a bucket that opens and closes as seats sell, and the number attached to it changes with the passenger mix, the exact flights, the taxes of the airports involved and the currency the quote is expressed in. A price response is a snapshot of that, taken at one moment, for one set of inputs. Treat it as a fact about the past and you will build the right thing; treat it as a fact about the present and you will spend a month on refunds.

So the useful question for a developer is never just what the price is. It is what kind of price this is, how old it is, and what the system will do if it turns out to be wrong.

Three numbers that all get called a price

Most providers return all three of these somewhere in their documentation, often under the same field name. Keep them apart in your own data model from the first day.

StateWhere it comes fromHow freshCan you sell it?What to show
Browse priceCached or aggregated search, built for speed and breadthPossibly stale, and not computed for your passengersNo"From" wording, a label that it can change
Priced offerA live request for the exact itinerary, passenger types and fareFresh at the moment of the call, with an expiry or a reprice signalYes, until it expiresThe total, taxes itemised, fare rules
Ticketed amountWhat the airline or issuing system actually charged at the orderFinalAlready soldThe receipt; reconcile it against the offer

The browse price is the one that makes calendars and "cheapest from" badges possible, and it is a fine thing to build. It is just not the same object as the second row. The mistake is a single field called price that all three flow into.

In practice this means three separate types or tables in your code, not one with a flag. A browse price is allowed to be wrong in small ways, because it is only a prompt to click. A priced offer is a commitment you are about to make on your own name, so it gets stored with the time it was fetched, the inputs that produced it and the identifier the provider will want back at order time. The ticketed amount is accounting. When support asks why a customer paid a different number from the one in an email, the answer sits in the gap between rows, and you can only read that gap if you kept all three.

What a price response has to carry

A bare number is not enough to build a checkout on. When you read a provider's sample response, look for the following, and be suspicious of any that arrive as free text.

  • The currency, stated on the response, not assumed from your account.
  • Base fare and taxes separately, so you can show a breakdown and so a tax change does not look like a fare change.
  • The passenger types the price was computed for. An adult price multiplied by three is not a family fare.
  • Fare rules and baggage as structured data, since these decide whether a cheap option is actually cheaper for your customer.
  • An expiry or reprice signal: a timestamp, or an explicit statement that you must reprice before ordering.

That last item is the one people skip. If nothing in the response tells you how long the offer lives, you are guessing, and the guess gets made in production.

Reprice before the order, not after it

The safest rhythm has a rule in it. Search for browsing. When a customer chooses an itinerary, ask for a live priced offer for exactly that itinerary and those passengers. Show the customer that total. Only then create the order. If the live price differs from the one on the results page, you tell the customer before they pay, in plain words, instead of after they have paid.

Skip the middle step and you inherit the difference. Either you charge more than the customer saw and lose the sale at the payment page, or you honour the lower number and the gap comes out of your own margin. A small agency can absorb that a few times; it cannot absorb it as a design.

Ask these in writing before you integrate

Documentation describes the happy path. The behaviour that costs you money is in the answers to a short list of questions, and the answers are worth having in an email rather than on a call.

  1. Is the price in the search response live or cached, and is that stated on the response itself?
  2. Is there a separate pricing call for the exact itinerary, and is it required before an order?
  3. What happens at order time if the price has moved: a refusal, a new price in the response, or a silent ticket at the new amount?
  4. How are taxes and carrier surcharges itemised, and can they change between pricing and ticketing?
  5. In which currency is the price computed, and where does conversion happen if the customer sees another one?
  6. How long does a priced offer remain valid, and how will you know?

A provider who answers these precisely has thought about the checkout. One who answers "it is always up to date" has not told you anything you can test. If you cannot try the behaviour yourself, that is a reason to look at the whole stack differently before committing to build around it.

What getting this wrong costs

It rarely fails loudly. It fails as a small drop at the payment step that nobody attributes to price, as support tickets that begin "the price changed", as a customer who trusted the results page and now does not. Staff end up reconfirming fares by hand before ticketing. Somebody eventually proposes a rule that rounds prices up to be safe, and then the site is expensive on the one screen where people compare. Every one of those is a tax on a decision that was cheap to make correctly at the start.

Where this platform sits

The platform exposes flight and hotel APIs, activated per tenant. Access starts as a conversation rather than a self-serve key, so there is no signup form that hands you a token and a rate table. This page does not publish latency, coverage or fare counts, because a number we cannot show you how to test is not worth printing. What you can do is bring the questions above to that conversation and ask to see the response for a priced offer, not just for a search. If that is the stage you are at, the travel APIs page is where it starts.

Tekravel Editorial

Travel technology desk

The Tekravel travel-technology desk writes for the trade: agency owners, consolidators and the developers who integrate them. Every article is checked against the platform it describes before it is published.