Skip to main content
Flight AI search takes the traveler’s request as written, for example “I want to go skiing over the Christmas holidays, any good destinations and flights from San Francisco?”, and answers with bookable options, priced for the travelers of the request, and a reply to show. When the destination is a kind of place, such as skiing or a beach, the options cover several destinations that fit. When the dates are a window, the options cover one or more days of it. When something is missing, the answer asks for it. The traveler can then refine the search in the same conversation.
Flight AI search is in preview. The API may change.

The flow

  1. Send the sentence. One call with text and the traveler’s timezone.
  2. Answer questions. An input_required answer carries a question; send the traveler’s answer with the same context_id. See Conversations.
  3. Get the options. A turn that searches usually takes 10 to 60 seconds, longer than the 20 seconds the call waits, so expect 202 first. Read the task until it ends, or stream it. See Waiting for results.
  4. Refine. “nonstop only”, “make it Porto instead”, “show me more”: each follow-up goes in the same conversation.
  5. Book. Add a fare’s trip_item_token to a trip and check out before its expires_at.

Quickstart

Flight AI search is served on production only, at https://api.gojinko.com, with a production API key; the sandbox does not serve it. The request is the traveler’s own words, in any language. This one asks, in Chinese, for ski destinations and flights from San Francisco over the Christmas holidays:
The search is still running after 20 seconds, so the call answers 202 with the task to read (Location, Retry-After: 2) and the early reply (other fields left out):
Read the task until status is no longer working:
The answer, with one option, one fare and two destinations of the group kept. Skiing became a theme destination searched at ski destinations, the Christmas holidays a departure window, and the trip a round trip with a 7-day stay, because no return was given:

The request

Optional headers: Prefer: wait=N to change the 20-second wait, Accept: text/event-stream to stream, and Idempotency-Key to retry safely. See Waiting for results.

The answer

Money is {"amount": 3412, "currency": "EUR"}, with amount in major units of the currency.

Options

Each option is one itinerary, priced for the travelers of the request with every filter applied, and bookable before each fare’s expires_at. Each fare of an option:

Groups

groups say how to present the options. Each group lists options by option_id, so an option shows once in options and can appear in several groups. A month search, “the cheapest day from Amsterdam to Lisbon in March 2027”, answers options for several days of the month:
Options s1_1, s2_1 and s3_1 are for March 9, 16 and 23; each carries its dates and its fares for the travelers of the request.

What the search understands

Every filter applies as the traveler stated it. No filter is relaxed: when nothing meets them, the answer says so. See When nothing matches. message is always in English; translate it in your app if your traveler reads another language.

Book a result

A fare is booked like any flight fare: add its trip_item_token to a trip, add the travelers and contact, then check out, before the fare’s expires_at.
  • total is the price for every traveler in priced_for, in currency.
  • expires_at is at most 75 minutes after the search. After it, the token is refused with 410 OFFER_EXPIRED (see Errors). Send a message in the same conversation to search again, and book from the newest answer.
See Flights for travelers, fares, baggage and seats, and Trips and checkout for the rest of the booking.

Charges

Each turn is charged. llm_usd is the language-model part of the charge, api_usd the flight search part, and total_usd their sum, in USD. A question runs no search, so its api_usd is 0. The JSON answer of a turn that has ended carries its charge:
turn is the message of the conversation the charge is for, from 1: the first message is 1 and each next message adds 1, whether it answers a question or asks for something new. A working answer and the events of a stream carry no charge: read the task once the turn has ended. A message is refused with 402 when your organization’s balance is below what a turn needs; see HTTP statuses.

Next