Skip to content

Room Categories API

Manage room categories (e.g. Standard, Deluxe, Suite) within an organization.

Authentication

All endpoints require a valid Bearer token in the Authorization header.

Endpoints

MethodPathDescription
POST/api/roomcategory/:orgId/createCreate a room category
GET/api/roomcategory/:orgId/listList all room categories
GET/api/roomcategory/:orgId/:categoryIdGet category by ID
PUT/api/roomcategory/:orgId/:categoryId/updateUpdate a room category
DELETE/api/roomcategory/:orgId/:categoryId/deleteDelete a room category

Path Parameters

ParameterTypeDescription
orgIdstringOrganization ID
categoryIdstringRoom category document ID

Create Room Category

POST /api/roomcategory/:orgId/create

Request Body

json
{
  "name": "Deluxe Suite",
  "description": "Spacious suite with premium amenities and city view",
  "basePrice": 12000,
  "maxOccupancy": 4,
  "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony"],
  "images": [
    "https://storage.example.com/rooms/deluxe-1.jpg",
    "https://storage.example.com/rooms/deluxe-2.jpg"
  ]
}

Success Response 201

json
{
  "success": true,
  "message": "Room category created successfully",
  "data": {
    "_id": "64f1b2c3d4e5f6a7b8c9d0e1",
    "name": "Deluxe Suite",
    "description": "Spacious suite with premium amenities and city view",
    "basePrice": 12000,
    "maxOccupancy": 4,
    "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony"],
    "images": [
      "https://storage.example.com/rooms/deluxe-1.jpg",
      "https://storage.example.com/rooms/deluxe-2.jpg"
    ],
    "orgId": "64f1b2c3d4e5f6a7b8c9d0e0",
    "createdAt": "2026-02-20T10:00:00.000Z",
    "updatedAt": "2026-02-20T10:00:00.000Z"
  }
}

Error Response 400

json
{
  "success": false,
  "message": "Validation error",
  "errors": [
    "name is required",
    "basePrice must be a positive number"
  ]
}

Error Response 409

json
{
  "success": false,
  "message": "Room category 'Deluxe Suite' already exists"
}

List Room Categories

GET /api/roomcategory/:orgId/list

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
limitnumber10Results per page
searchstringSearch by category name

Success Response 200

json
{
  "success": true,
  "data": [
    {
      "_id": "64f1b2c3d4e5f6a7b8c9d0e1",
      "name": "Deluxe Suite",
      "description": "Spacious suite with premium amenities and city view",
      "basePrice": 12000,
      "maxOccupancy": 4,
      "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony"],
      "roomCount": 15,
      "createdAt": "2026-02-20T10:00:00.000Z"
    },
    {
      "_id": "64f1b2c3d4e5f6a7b8c9d0e5",
      "name": "Standard",
      "description": "Comfortable room with essential amenities",
      "basePrice": 4000,
      "maxOccupancy": 2,
      "amenities": ["wifi", "air-conditioning"],
      "roomCount": 20,
      "createdAt": "2026-02-18T10:00:00.000Z"
    }
  ],
  "pagination": {
    "total": 5,
    "page": 1,
    "limit": 10,
    "totalPages": 1
  }
}

Get Room Category by ID

GET /api/roomcategory/:orgId/:categoryId

Success Response 200

json
{
  "success": true,
  "data": {
    "_id": "64f1b2c3d4e5f6a7b8c9d0e1",
    "name": "Deluxe Suite",
    "description": "Spacious suite with premium amenities and city view",
    "basePrice": 12000,
    "maxOccupancy": 4,
    "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony"],
    "images": [
      "https://storage.example.com/rooms/deluxe-1.jpg",
      "https://storage.example.com/rooms/deluxe-2.jpg"
    ],
    "orgId": "64f1b2c3d4e5f6a7b8c9d0e0",
    "createdAt": "2026-02-20T10:00:00.000Z",
    "updatedAt": "2026-02-20T10:00:00.000Z"
  }
}

Error Response 404

json
{
  "success": false,
  "message": "Room category not found"
}

Update Room Category

PUT /api/roomcategory/:orgId/:categoryId/update

Request Body

json
{
  "name": "Deluxe Suite Plus",
  "basePrice": 14000,
  "maxOccupancy": 5,
  "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony", "jacuzzi"]
}

Success Response 200

json
{
  "success": true,
  "message": "Room category updated successfully",
  "data": {
    "_id": "64f1b2c3d4e5f6a7b8c9d0e1",
    "name": "Deluxe Suite Plus",
    "basePrice": 14000,
    "maxOccupancy": 5,
    "amenities": ["wifi", "minibar", "room-service", "smart-tv", "balcony", "jacuzzi"],
    "updatedAt": "2026-02-21T09:00:00.000Z"
  }
}

Error Response 404

json
{
  "success": false,
  "message": "Room category not found"
}

Delete Room Category

DELETE /api/roomcategory/:orgId/:categoryId/delete

Success Response 200

json
{
  "success": true,
  "message": "Room category deleted successfully"
}

Error Response 404

json
{
  "success": false,
  "message": "Room category not found"
}

Error Response 409

json
{
  "success": false,
  "message": "Cannot delete category with assigned rooms. Remove or reassign rooms first."
}

Released under the MIT License.