Quickstart
On this page you will generate an API key in the hotel’s HMS panel and fetch the in-house guest list. You need panel access with a user who is allowed to manage API keys; otherwise the hotel management can generate the key and pass it to you.
1. Generate a key#
- In the HMS admin panel open the API page and switch to the Custom API tab.
- Enter where the key will be used in the description field (e.g. Hotspot – Main building) and save. HMS generates a 13-character key.
- Copy the key from the list. It is bound to the hotel and does not expire; it becomes invalid the moment it is deleted from the list.
export HMS_API_KEY="017f1daf2d139"Also note the hotel’s HMS ID; the samples send it as HotelCode: 1000. The header is not used for validation, but it shows in logs which hotel was queried.
2. Fetch the list#
The endpoint is called with POST and takes no body:
curl -X POST "https://test.hms.gen.tr/public/json/customer/inhotel" \
-H "ApiKey: $HMS_API_KEY" \
-H "HotelCode: 1000"const res = await fetch("https://test.hms.gen.tr/public/json/customer/inhotel", {
method: "POST",
headers: {
"ApiKey": process.env.HMS_API_KEY,
"HotelCode": "1000"
}
});
if (res.status === 401) throw new Error("Invalid ApiKey");
const data = await res.json();
for (const g of data.otelde) {
console.log(g.roomName, g.firstName, g.lastName, new Date(g.checkout * 1000));
}$ch = curl_init('https://test.hms.gen.tr/public/json/customer/inhotel');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'ApiKey: ' . getenv('HMS_API_KEY'),
'HotelCode: 1000',
],
]);
$body = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 401) {
throw new RuntimeException('Invalid ApiKey');
}
$data = json_decode($body, true);
foreach ($data['otelde'] as $g) {
echo $g['roomName'], ' · ', $g['firstName'], ' ', $g['lastName'], ' · ', date('d.m.Y', $g['checkout']), "\n";
}3. Read the response#
Every in-house guest is a separate record in the otelde array. A truncated example for two guests sharing a room:
{
"success": 1,
"otelde": [
{
"unique": 58211,
"firstName": "AYŞE",
"lastName": "DEMİR",
"identityNumber": "11111111110",
"birthDate": "14.03.1985",
"roomID": 4,
"roomName": "104",
"checkin": 1788863400,
"checkout": 1788998400,
"rezervasyon_id": 282799
},
{
"unique": 58212,
"firstName": "MEHMET",
"lastName": "DEMİR",
"identityNumber": "22222222220",
"birthDate": "02.11.1982",
"roomID": 4,
"roomName": "104",
"checkin": 1788863400,
"checkout": 1788998400,
"rezervasyon_id": 282799
}
]
}uniqueis unique per guest; tie the hotspot user to it.rezervasyon_idis shared by guests in the same room.- The room number asked on the portal is compared with
roomName, the surname withlastName. Values are usually upper case. checkinis the check-in moment;checkoutis the planned check-out date (00:00 UTC) with no time of day. Add the hotel’s check-out time to get the session end.- If nobody is in house,
oteldeis an empty array andsuccessis still1.
What next#
- Guest verification flow — matching rules, session lifetime, periodic sync
- Authentication — key management and the 401 response
- API reference — every field explained