Sign In   |  

Kayak Search API Specification

The table below details the exact HTTP calls you need to make for the search API to work. The basic idea is that you make this sequence of calls:

  1. GetSession: for each search thread you make you need a session. You can do several searches in a row after a single GetSession, but you must have a separate session if you are going to run searches in parallel. You can run as many searches as you want with a given developer key in parallel, within quota.
  2. Start Search (flight or hotel): this will initiate the search, and give you a search id back.
  3. Get Results (first time): you post to the general URL for results.
  4. Get Results (subsequent times): you should poll every 5-10 seconds until the morepending element is not true. You can specify filters to this call, and call it as many times as you like as long as the session is active.

Note that you should use api.kayak.com as the host name for connecting. If you are are a Kayak affiliate, you should use the host name for your affiliate site, so that searches will track to your account. Note well: your code must accept the "cluster" set-cookie header that is returned, and post that on all subsequent calls; otherwise your requests will be sent to a random cluster, and your program will not work. Using www.kayak.com and honoring the cluster cookie is the best way to use the API, though it can be more difficult, depending on the client technology you use.

Function URL
prefix with http://api.kayak.com
Parameters
(name and values)
Notes
GetSession /k/ident/apisession token This is your developer key. Sample
You want to extract the "sid" element value out (in this example 1-hX4lII_wS$8b06aO7kHj). The session id is good for 30 minutes. Do not perform parallel searches against one sid. It will yield unpredictable results.

The session id (sid) you get back from this call should be passed as _sid_ to to all subsequent calls. It is the key to your search state.
version The version of the API the client is expecting. The only current supported version is "1"
Start Flight Search /s/apisearch basicmode must be "true" Sample
The searchid is what you need (along with session ID) for the next step, polling for results.
oneway "y" or "n"
origin three-letter airport code (e.g. "BOS")
destination three-letter airport code (e.g. "SFO")
depart_date MM/DD/YYYY
return_date MM/DD/YYYY
depart_time Values:
"a" = any time; "r"=early morning; "m"=morning; "12"=noon; "n"=afternoon; "e"=evening; "l"=night
return_time see depart_time
travelers integer from 1-8
cabin f, b or e(default) (first, business, economy/coach)
action must be "doFlights"
apimode must be "1"
_sid_ the Session ID you get from GetSession
version The version of the API the client is expecting. The only current supported version is "1"
Get Flight Results /s/apibasic/flight searchid from the start search call Sample
Eventually (after 30-60 seconds) the "morepending" element will contain the value "false." At that point, the search is done, and you should make a final call with the "c" parameter equal to the resultcount.
c integer, the number of results to return
m filter mode: normal or airline:?? where ?? is a two-letter airline code
d sort direction: up, down
s sort key: price, duration, depart, arrive, airline
_sid_ the Session ID you get from GetSession
version The version of the API the client is expecting. The only current supported version is "1"
apimode must be "1"
Start Hotel Search /s/apisearch basicmode must be "true" Sample
The searchid is what you need (along with session ID) for the next step, polling for results.
apimode must be "1"
othercity String locating the city. Should be City, RegionCode, CountryCode for US, Canada. Should be City, CountryCode for others. Examples:
"Boston, MA, US"
"New York, NY, US"
"Vancouver, BC, CA"
"Paris, FR"
"London, UK"
checkin_date MM/DD/YYYY
checkout_date MM/DD/YYYY
guests1 integer from 1-6
rooms integer from 1-3
action must be "dohotels"
_sid_ the Session ID you get from GetSession
version The version of the API the client is expecting. The only current supported version is "1"
Get Hotel Results /s/apibasic/hotel searchid from the start search call Sample
Eventually (after 30-60 seconds) the "morepending" element will contain the value "false." At that point, the search is done, and you should make a final call with the "c" parameter equal to the resultcount.

Generally, you will be better off requesting the minimal number results you need because it will take kayak less time to assemble and transmit the result, and it will take your application less time and bandwidth to receive and parse the result.

_sid_ the Session ID you get from GetSession
c integer, the number of results to return
m filter mode: normal or stars:? where ? is a 1,2,3,4 or 5
d sort direction: up, down
s sort key: price, stars, hotel, distance
version The version of the API the client is expecting. The only current supported version is "1"
apimode must be "1"
About  |  Advertise  |  Privacy  |  Destinations  |  Feedback  |  Hotel Reviews - TravelPost.com
©2009 Kayak.com