API Navigation
Roots & Peaks API Documentation
Introduction
Welcome to the Roots & Peaks Hotel API documentation. This API allows external systems to check room availability and integrate with our booking system.
Our API is designed for:
- Travel agencies and tour operators
- Online booking platforms
- Corporate partners
- Mobile applications
Authentication
All API requests require an API key. You can obtain an API key by contacting our support team.
The API key should be included either:
- As a query parameter:
api_key=YOUR_API_KEY - In the request header:
X-API-Key: YOUR_API_KEY
API Endpoints
Check Room Type Availability
POST /api/check_availability
Checks availability for a specific room type during a specific date range.
Request Body:
{
"room_type_id": 1,
"check_in": "2025-06-10",
"check_out": "2025-06-15"
}
Response:
{
"available": true,
"count": 5
}
Parameters:
| Name | Type | Description | Required |
|---|---|---|---|
| room_type_id | Integer | ID of the room type to check | Yes |
| check_in | String (YYYY-MM-DD) | Check-in date | Yes |
| check_out | String (YYYY-MM-DD) | Check-out date | Yes |
Get Full Availability
GET /api/availability
Returns availability information for all room types within a specified date range.
Request:
GET /api/availability?check_in=2025-06-10&check_out=2025-06-15&api_key=YOUR_API_KEY
Response:
{
"check_in": "2025-06-10",
"check_out": "2025-06-15",
"nights": 5,
"availability": [
{
"id": 1,
"name": "Standard Room",
"description": "Comfortable room with essential amenities",
"price_per_night": 100.00,
"capacity": 2,
"image_url": "/static/img/standard-room.jpg",
"available_rooms": 5,
"total_rooms": 8,
"available_room_ids": [101, 102, 104, 106, 108]
},
{
"id": 2,
"name": "Deluxe Room",
"description": "Spacious room with premium amenities",
"price_per_night": 150.00,
"capacity": 3,
"image_url": "/static/img/deluxe-room.jpg",
"available_rooms": 3,
"total_rooms": 6,
"available_room_ids": [201, 203, 206]
}
// Additional room types...
]
}
Parameters:
| Name | Type | Description | Required |
|---|---|---|---|
| check_in | String (YYYY-MM-DD) | Check-in date | Yes |
| check_out | String (YYYY-MM-DD) | Check-out date | Yes |
| api_key | String | Your API key | Yes |
Availability Calendar
GET /api/availability_calendar
Returns a detailed calendar with room availability for an entire month.
Request:
GET /api/availability_calendar?year=2025&month=6&api_key=YOUR_API_KEY
Response:
{
"year": 2025,
"month": 6,
"calendar": {
"2025-06-01": {
"date": "2025-06-01",
"total_rooms": 20,
"available_rooms": 15,
"booked_rooms": 5,
"occupancy_rate": 25,
"rooms": {
"101": {
"status": "available",
"room_number": "101",
"room_type_id": 1
},
"102": {
"status": "booked",
"room_number": "102",
"room_type_id": 1
},
// Additional rooms...
},
"room_types": {
"1": {
"name": "Standard Room",
"total": 8,
"booked": 2,
"available": 6
},
"2": {
"name": "Deluxe Room",
"total": 6,
"booked": 1,
"available": 5
}
// Additional room types...
}
},
// Additional days...
}
}
Parameters:
| Name | Type | Description | Required |
|---|---|---|---|
| year | Integer | Calendar year (defaults to current year if not provided) | No |
| month | Integer (1-12) | Calendar month (defaults to current month if not provided) | No |
| api_key | String | Your API key | Yes |
Code Examples
// Check availability for a specific room type
async function checkAvailability(roomTypeId, checkIn, checkOut) {
const response = await fetch('/api/check_availability', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
room_type_id: roomTypeId,
check_in: checkIn,
check_out: checkOut
})
});
return await response.json();
}
// Get full availability for all room types
async function getFullAvailability(checkIn, checkOut) {
const response = await fetch(
`/api/availability?check_in=${checkIn}&check_out=${checkOut}&api_key=YOUR_API_KEY`
);
return await response.json();
}
// Example usage
checkAvailability(1, '2025-06-10', '2025-06-15')
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests
import json
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://rootsandpeaks.com'
# Check availability for a specific room type
def check_availability(room_type_id, check_in, check_out):
url = f'{BASE_URL}/api/check_availability'
headers = {
'Content-Type': 'application/json',
'X-API-Key': API_KEY
}
data = {
'room_type_id': room_type_id,
'check_in': check_in,
'check_out': check_out
}
response = requests.post(url, headers=headers, json=data)
return response.json()
# Get full availability for all room types
def get_full_availability(check_in, check_out):
url = f'{BASE_URL}/api/availability'
params = {
'check_in': check_in,
'check_out': check_out,
'api_key': API_KEY
}
response = requests.get(url, params=params)
return response.json()
# Example usage
result = check_availability(1, '2025-06-10', '2025-06-15')
print(json.dumps(result, indent=2))
<?php
$API_KEY = 'YOUR_API_KEY';
$BASE_URL = 'https://rootsandpeaks.com';
// Check availability for a specific room type
function checkAvailability($roomTypeId, $checkIn, $checkOut) {
global $API_KEY, $BASE_URL;
$url = $BASE_URL . '/api/check_availability';
$data = array(
'room_type_id' => $roomTypeId,
'check_in' => $checkIn,
'check_out' => $checkOut
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\nX-API-Key: $API_KEY\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return json_decode($result, true);
}
// Get full availability for all room types
function getFullAvailability($checkIn, $checkOut) {
global $API_KEY, $BASE_URL;
$url = $BASE_URL . '/api/availability?check_in=' . $checkIn .
'&check_out=' . $checkOut . '&api_key=' . $API_KEY;
$result = file_get_contents($url);
return json_decode($result, true);
}
// Example usage
$result = checkAvailability(1, '2025-06-10', '2025-06-15');
echo json_encode($result, JSON_PRETTY_PRINT);
?>
Support
For questions or assistance with the API, please contact our support team:
- Email: api-support@rootsandpeaks.com
- Phone: +91 9958490489
We're available to help with integration, troubleshooting, and any questions about our API.