Authentication
Access to the Online Booking API uses partner credentials issued by HMS. The login endpoint exchanges apiKey and apiSecret for a token, which is sent as Authorization: Bearer on every other request. See the Authentication guide for details.
Log in and get a token#
POST
/external/public/loginNo authentication required · Body: application/x-www-form-urlencoded or multipart/form-data
Validates the partner credentials and issues a token if the partner is authorised for the hotel. The token is bound to one hotel; log in separately for each hotel.
Form fields
apiKeystringrequiredPartner key issued by HMS.
apiSecretstringrequiredPartner secret. Keep it server-side only.
hotelCodeintegerrequiredThe hotel’s HMS ID (
hotelID). The partner must be authorised for this hotel.hotelSeoUrlstringThe hotel’s SEO slug in HMS. Used instead of
hotelCode only by HMS’s own booking engine; third-party integrations should send hotelCode.Response
200 Token and hotel details. The token is valid for 7 days; renew it by logging in again before it expires.
successbooleanResult flag.
hotelCodestringHotel ID the token is bound to.
tokenstringBearer token. Treat it as opaque; do not parse it.
hotelSeoUrlstring | nullThe hotel’s SEO slug.
Error responses
- 200
partner_is_not_found— key pair did not match;hotel_is_not_found— no hotel forhotelSeoUrl;hotel_permission_is_not_found— the partner is not authorised for this hotel or the authorisation is inactive.
curl "https://test.hms.gen.tr/external/public/login" \
-d "apiKey=5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q=" \
-d "apiSecret=a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19" \
-d "hotelCode=1000"const res = await fetch("https://test.hms.gen.tr/external/public/login", {
method: "POST",
body: new URLSearchParams([
["apiKey", "5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q="],
["apiSecret", "a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19"],
["hotelCode", "1000"]
])
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/public/login');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'apiKey' => '5y94tLmALIKDyUVdEPlAAjg5xWGQNgQtnALlV4+Am7Q=',
'apiSecret' => 'a143d6408634696b811def06d236682950cacb9761aa8ad5827da4015bda4b19',
'hotelCode' => '1000',
]),
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"hotelCode": "1000",
"token": "eyJlbmREYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTE1IDEwOjI0OjMxLjAwMDAwMCIsInRpbWV6b25lX3R5cGUiOjMsInRpbWV6b25lIjoiRXVyb3BlL0lzdGFuYnVsIn0sInRva2VuIjoiM2tkOXNscTJwbTh2eHI0dHp5Nm53YjFoYzdmajVnYTAiLCJob3RlbElEIjoxMDAwLCJ1c2VySUQiOjQyLCJkYXRlIjp7ImRhdGUiOiIyMDI2LTA5LTA4IDEwOjI0OjMxLjAwMDAwMCJ9fQ==",
"hotelSeoUrl": "demo-otel"
}{
"success": false,
"token": null,
"message": "hotel_permission_is_not_found"
}