|
Sign In |
|
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:
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" | |||