Booking API
Connect your own booking form to RoomLink. Use your website's design, we handle availability and bookings.
Quick Start
Add this script to your website, then use the API in 3 lines:
<script src="https://roomlink.gr/roomlink-api.js"></script>
<script>
// Initialize with your RoomLink user ID
var rl = new RoomLinkAPI("YOUR_USER_ID");
// 1. Get available rooms for specific dates
rl.getAvailability("2026-06-01", "2026-06-05")
.then(function(data) {
console.log(data.rooms); // Array of available rooms with prices
});
// 2. Submit a booking request
rl.book({
roomId: "room_id_from_step_1",
name: "John Smith",
email: "john@example.com",
phone: "+30 6912345678",
guests: 2,
from: "2026-06-01",
to: "2026-06-05",
message: "Late arrival ~22:00"
}).then(function(res) {
if (res.ok) alert("Booking request sent!");
else alert("Error: " + res.data.error);
});
</script>Endpoints
GET
/api/public/availabilityReturns your rooms with pricing. When from and to are provided, only available (non-booked) rooms are returned.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | Your RoomLink user ID |
| from | YYYY-MM-DD | No | Check-in date |
| to | YYYY-MM-DD | No | Check-out date |
Response
{
"rooms": [
{
"id": "clx...",
"titlos": "Deluxe Suite",
"kodikos": "R01",
"xoritikotita": 4,
"description": "Sea view room with balcony",
"pricePerNight": 120
}
],
"businessName": "My Hotel",
"logoUrl": "https://...",
"from": "2026-06-01",
"to": "2026-06-05"
}POST
/api/public/bookSubmit a booking request. Creates a pending request that appears in the property owner's dashboard.
Request Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | Your RoomLink user ID |
| roomId | string | Yes | Room ID from availability response |
| name | string | Yes | Guest full name |
| from | YYYY-MM-DD | Yes | Check-in date |
| to | YYYY-MM-DD | Yes | Check-out date |
| guests | number | Yes | Number of guests |
| string | No | Guest email | |
| phone | string | No | Guest phone |
| message | string | No | Special requests (max 2000 chars) |
Success Response (201)
{ "id": "clx...", "success": true }Error Responses
400 Invalid data or dates
404 Room not found
409 Room not available for these dates
429 Rate limit (max 5 requests/minute)
Without the Helper Script
You can also call the API directly with fetch:
// Check availability
const res = await fetch(
"https://roomlink.gr/api/public/availability?userId=YOUR_ID&from=2026-06-01&to=2026-06-05"
);
const { rooms } = await res.json();
// Submit booking
const booking = await fetch("https://roomlink.gr/api/public/book", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
userId: "YOUR_ID",
roomId: rooms[0].id,
name: "John Smith",
email: "john@example.com",
guests: 2,
from: "2026-06-01",
to: "2026-06-05"
})
});
const result = await booking.json();Full HTML Example
Copy-paste this into any HTML page for a working booking form:
<!DOCTYPE html>
<html>
<head><title>Book a Room</title></head>
<body>
<h1>Book a Room</h1>
<form id="bookingForm">
<label>Check-in: <input type="date" id="from" required></label><br>
<label>Check-out: <input type="date" id="to" required></label><br>
<label>Room: <select id="room"></select></label><br>
<label>Name: <input type="text" id="name" required></label><br>
<label>Email: <input type="email" id="email"></label><br>
<label>Guests: <input type="number" id="guests" value="2" min="1"></label><br>
<button type="submit">Book Now</button>
</form>
<div id="result"></div>
<script src="https://roomlink.gr/roomlink-api.js"></script>
<script>
var rl = new RoomLinkAPI("YOUR_USER_ID");
// Load rooms when dates change
document.getElementById("to").addEventListener("change", function() {
var from = document.getElementById("from").value;
var to = this.value;
if (!from || !to) return;
rl.getAvailability(from, to).then(function(data) {
var sel = document.getElementById("room");
sel.innerHTML = "";
data.rooms.forEach(function(r) {
var opt = document.createElement("option");
opt.value = r.id;
opt.textContent = r.titlos + " - €" + (r.pricePerNight || "N/A") + "/night";
sel.appendChild(opt);
});
});
});
// Submit booking
document.getElementById("bookingForm").addEventListener("submit", function(e) {
e.preventDefault();
rl.book({
roomId: document.getElementById("room").value,
name: document.getElementById("name").value,
email: document.getElementById("email").value,
guests: parseInt(document.getElementById("guests").value),
from: document.getElementById("from").value,
to: document.getElementById("to").value
}).then(function(res) {
document.getElementById("result").textContent =
res.ok ? "Booking request sent!" : "Error: " + res.data.error;
});
});
</script>
</body>
</html>Find your User ID in Settings → Booking Widget section.