How it differs from flight search
The flow
- Send the sentence. One call with
textand the traveler’stimezone. - Answer questions. An
input_requiredanswer carries a question; send the traveler’s answer with the samecontext_id. See Conversations. - Get the options. A turn that searches usually takes 10 to 60 seconds, longer than the 20 seconds the call waits, so expect
202first. Read the task until it ends, or stream it. See Waiting for results. - Refine. “nonstop only”, “make it Porto instead”, “show me more”: each follow-up goes in the same conversation.
- Book. Add a fare’s
trip_item_tokento a trip and check out before itsexpires_at.
Quickstart
Flight AI search is served on production only, athttps://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:
202 with the task to read (Location, Retry-After: 2) and the early reply (other fields left out):
status is no longer working:
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’sexpires_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:
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 itstrip_item_token to a trip, add the travelers and contact, then check out, before the fare’s expires_at.
totalis the price for every traveler inpriced_for, incurrency.expires_atis at most 75 minutes after the search. After it, the token is refused with410OFFER_EXPIRED(see Errors). Send a message in the same conversation to search again, and book from the newest answer.
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
- Conversations: questions, follow-ups, corrections and expiry.
- Waiting for results:
202, reading the task, streaming, cancel and retries. - Statuses and errors: every status, failure code and HTTP status.
