Basefloor Dev
Api

API Overview

Introduction to the Basefloor REST API — authentication, versioning, and conventions.

API Overview

The Basefloor API is a RESTful JSON API served by hms-core (Ruby on Rails). All frontend applications communicate exclusively through this API.

Base URL

EnvironmentURL
Productionhttps://hms-api.kaisersakhi.com/api/v1
Developmenthttp://localhost:4000/api/v1

Authentication

The API uses token-based authentication. After logging in, every subsequent request must include the token in the Authorization header:

Authorization: Bearer <your_token>

Login

POST /api/v1/users/sessions
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "your_password"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiJ9...",
  "user": {
    "id": 1,
    "email": "[email protected]",
    "role": "manager",
    "hotel_chain_id": 5
  }
}

Logout

DELETE /api/v1/users/sessions
Authorization: Bearer <token>

Multi-Tenancy Headers

Every API request is automatically scoped to a hotel chain. The chain is resolved from the subdomain of the request origin. When calling from a frontend on khyber.hms.com, the API automatically scopes all queries to the Khyber chain.

For direct API testing (e.g., with Bruno or curl), pass the chain slug via the X-Hotel-Chain header:

X-Hotel-Chain: khyber

Request Format

  • All request bodies must be application/json
  • Dates use ISO 8601 format: 2025-06-15
  • Times use UTC: 2025-06-15T14:00:00Z

Response Format

Successful responses return a JSON object with a data key:

{
  "data": {
    "id": 42,
    "type": "booking",
    "attributes": { ... }
  }
}

List responses include pagination metadata:

{
  "data": [ ... ],
  "meta": {
    "total": 120,
    "page": 1,
    "per_page": 25
  }
}

Error Format

Errors return an errors array:

{
  "errors": [
    {
      "status": "422",
      "title": "Unprocessable Entity",
      "detail": "Check-out date must be after check-in date"
    }
  ]
}

HTTP Status Codes

CodeMeaning
200OK — request succeeded
201Created — resource was created
204No Content — successful delete
400Bad Request — malformed request
401Unauthorized — missing or invalid token
403Forbidden — insufficient permissions
404Not Found — resource does not exist
422Unprocessable Entity — validation failed
500Internal Server Error

Key Endpoints Reference

Properties

MethodPathDescription
GET/propertiesList all properties for the chain
POST/propertiesCreate a property
GET/properties/:idGet a property
PATCH/properties/:idUpdate a property
DELETE/properties/:idDelete a property

Bookings

MethodPathDescription
GET/bookingsList bookings (filterable by date, property, status)
POST/bookingsCreate a booking
GET/bookings/:idGet booking details
PATCH/bookings/:idUpdate a booking
POST/bookings/:id/check_inCheck in a guest
POST/bookings/:id/check_outCheck out a guest
POST/bookings/:id/cancelCancel a booking

Guests

MethodPathDescription
GET/guestsList guests
POST/guestsCreate a guest
GET/guests/:idGet guest profile and stay history
PATCH/guests/:idUpdate guest

Users

MethodPathDescription
GET/usersList staff users
POST/users/invitationsSend invite to a new user
PATCH/users/:idUpdate user role or property assignment
DELETE/users/:idDeactivate user

API Collection

A full Bruno API collection is available in the bruno/ directory of the hms-core repository. Import it into Bruno to explore and test all endpoints interactively.

On this page