How to get a signature for hotels search API

This article provides an example of generating a signature (md5 signature), which is required to work with the hotels' search API.

With the following query parameters:

  • iata=HKT; 
  • checkIn=2021-12-10; 
  • checkOut=2021-12-13; 
  • adultsCount=2; 
  • customerIP=192.168.1.1; 
  • childrenCount=1; 
  • childAge1=10;
  • lang=en; 
  • currency=USD; 
  • waitForResult=0.

Let’s sort them alphabetically:

  • adultsCount=2; 
  • checkIn=2021-12-10; 
  • checkOut=2021-12-13; 
  • childAge1=10;
  • childrenCount=1; 
  • currency=USD; 
  • customerIP=109.252.191.186
  • iata=HKT; 
  • lang=en; 
  • waitForResult=0.

Next, fix the values of the assorted parameters using colons and add the affiliate API token and partner ID (they can be found in each Travelpayouts account) before them.

You should get a string looking like this:

InsertHereYourToken:InsertHereYourPartnerID:2:2021-12-10:2021-12-13:10:1:USD:77.111.247.75:HKT:en:0

This string is used for signature creation. As a result, we have the following: 9961b6ecb56d45935667141b79cfbc28.
Attention! Signature is case-sensitive. 

To create a query, take the query parameters, add the affiliate’s security token and marker, and fix using & into the search string:

http://engine.hotellook.com/api/v2/search/start.json?