M1 API Reference
The M1 Villa Management API provides endpoints for managing villas, owners, staff, documents, and onboarding workflows.
Base URL
Section titled “Base URL”Production: https://obv.inspiringlivingsolutions.com/apiDevelopment: http://localhost:4002/apiAuthentication
Section titled “Authentication”All endpoints require authentication via Clerk session.
Authorization: Bearer <clerk_session_token>Endpoints
Section titled “Endpoints”Villas
Section titled “Villas”List Villas
Section titled “List Villas”GET /villasQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number |
| limit | number | Items per page |
| status | string | Filter by status |
| search | string | Search term |
Response:
{ "data": [ { "id": "uuid", "name": "Villa Sunrise", "status": "ACTIVE", "propertyType": "VILLA", "bedrooms": 4, "location": "Koh Samui" } ], "pagination": { "page": 1, "limit": 10, "total": 50 }}Get Villa
Section titled “Get Villa”GET /villas/:idCreate Villa
Section titled “Create Villa”POST /villasBody:
{ "name": "Villa Name", "propertyType": "VILLA", "villaStyle": "MODERN", "bedrooms": 4, "bathrooms": 5, "maxGuests": 8}Update Villa
Section titled “Update Villa”PATCH /villas/:idDelete Villa
Section titled “Delete Villa”DELETE /villas/:idOwners
Section titled “Owners”List Owners
Section titled “List Owners”GET /ownersGet Owner
Section titled “Get Owner”GET /owners/:idCreate Owner
Section titled “Create Owner”POST /ownersBody (Individual):
{ "ownerType": "INDIVIDUAL", "firstName": "John", "lastName": "Smith", "phone": "+66812345678"}Body (Company):
{ "ownerType": "COMPANY", "companyName": "ABC Holdings", "registrationNumber": "123456789", "contactPerson": "Jane Doe",}List Staff
Section titled “List Staff”GET /staffGet Staff
Section titled “Get Staff”GET /staff/:idCreate Staff
Section titled “Create Staff”POST /staffAssign Staff to Villa
Section titled “Assign Staff to Villa”POST /villas/:villaId/staffBody:
{ "staffId": "uuid", "role": "HOUSEKEEPER", "isPrimary": true}Documents
Section titled “Documents”List Villa Documents
Section titled “List Villa Documents”GET /villas/:villaId/documentsUpload Document
Section titled “Upload Document”POST /villas/:villaId/documentsContent-Type: multipart/form-dataBody:
- file: Document file
- documentType: Type of document
- title: Document title
Delete Document
Section titled “Delete Document”DELETE /documents/:idPhotos
Section titled “Photos”List Villa Photos
Section titled “List Villa Photos”GET /villas/:villaId/photosUpload Photos
Section titled “Upload Photos”POST /villas/:villaId/photosContent-Type: multipart/form-dataSet Cover Photo
Section titled “Set Cover Photo”PATCH /photos/:id/coverOnboarding
Section titled “Onboarding”Get Onboarding Status
Section titled “Get Onboarding Status”GET /villas/:villaId/onboardingResponse:
{ "overallStatus": "IN_PROGRESS", "completionPercentage": 60, "steps": [ { "step": "BASIC_INFO", "status": "COMPLETED" }, { "step": "OWNER_DETAILS", "status": "IN_PROGRESS" } ]}Update Step Status
Section titled “Update Step Status”PATCH /villas/:villaId/onboarding/steps/:stepOTA Credentials
Section titled “OTA Credentials”List OTA Credentials
Section titled “List OTA Credentials”GET /villas/:villaId/ota-credentialsAdd OTA Credential
Section titled “Add OTA Credential”POST /villas/:villaId/ota-credentialsBody:
{ "platform": "AIRBNB", "password": "encrypted_password", "propertyId": "12345"}Error Responses
Section titled “Error Responses”{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid input", "details": [ { "field": "email", "message": "Invalid email format" } ] }}Error Codes
Section titled “Error Codes”| Code | HTTP Status | Description |
|---|---|---|
| UNAUTHORIZED | 401 | Not authenticated |
| FORBIDDEN | 403 | No permission |
| NOT_FOUND | 404 | Resource not found |
| VALIDATION_ERROR | 400 | Invalid input |
| SERVER_ERROR | 500 | Internal error |