Skip to content

M4 API Reference

The M4 Reporting API provides endpoints for dashboard metrics, listings, reservations, and data export.

Production: https://m4.inspiringlivingsolutions.com/api
Development: http://localhost:3000/api

Requires Clerk session authentication.

Endpoint TypeLimit
Dashboard120 req/min
Listings60 req/min
Sync5 req/min
Default60 req/min
GET /dashboard/metrics

Query Parameters:

ParameterTypeDescription
startDatestringStart date (YYYY-MM-DD)
endDatestringEnd date (YYYY-MM-DD)
listingIdsstringComma-separated IDs

Response:

{
"revenue": {
"total": 1250000,
"previous": 1100000,
"change": 13.6
},
"occupancy": {
"rate": 72.5,
"previous": 68.2,
"change": 4.3
},
"adr": {
"value": 8500,
"previous": 8200,
"change": 3.7
},
"bookings": {
"count": 45,
"previous": 42,
"change": 7.1
},
"revpar": {
"value": 6163,
"previous": 5594,
"change": 10.2
}
}
GET /dashboard/charts

Query Parameters:

ParameterTypeDescription
typestringrevenue, occupancy
periodstringdaily, weekly, monthly
startDatestringStart date
endDatestringEnd date

Response:

{
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{
"label": "Revenue",
"data": [450000, 520000, 480000]
}
]
}
GET /dashboard/occupancy

Response:

{
"calendar": [
{
"date": "2024-01-15",
"occupancy": 85,
"bookedNights": 17,
"availableNights": 20
}
],
"byProperty": [
{
"listingId": "uuid",
"name": "Villa Sunrise",
"occupancy": 78
}
]
}
GET /dashboard/reservations

Query Parameters:

ParameterTypeDescription
limitnumberNumber of results
statusstringFilter by status

GET /listings

Response:

{
"data": [
{
"id": "uuid",
"hostifyId": "12345",
"name": "Villa Sunrise",
"status": "ACTIVE",
"bedrooms": 4,
"location": "Koh Samui",
"metrics": {
"revenue": 850000,
"occupancy": 72,
"bookings": 15
}
}
]
}
GET /listings/:id

GET /reservations

Query Parameters:

ParameterTypeDescription
pagenumberPage number
limitnumberItems per page
listingIdstringFilter by listing
statusstringFilter by status
startDatestringCheck-in from
endDatestringCheck-in to
channelstringBooking channel

Response:

{
"data": [
{
"id": "uuid",
"hostifyId": "RES-12345",
"guestName": "John Smith",
"listing": { "id": "uuid", "name": "Villa Sunrise" },
"checkIn": "2024-01-15",
"checkOut": "2024-01-20",
"nights": 5,
"channel": "AIRBNB",
"totalAmount": 42500,
"netAmount": 36125,
"status": "CONFIRMED"
}
],
"pagination": { "page": 1, "limit": 20, "total": 150 }
}
GET /reservations/:id

POST /sync/trigger

Body:

{
"type": "full",
"entities": ["listings", "reservations"]
}

Response:

{
"syncId": "uuid",
"status": "STARTED",
"startedAt": "2024-01-15T10:00:00Z"
}
GET /sync/status/:syncId

POST /export

Body:

{
"type": "reservations",
"format": "excel",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"listingIds": ["uuid1", "uuid2"]
}

Response:

{
"exportId": "uuid",
"status": "PROCESSING"
}
GET /export/:exportId/download

GET /health

Response:

{
"status": "healthy",
"database": "connected",
"hostify": "connected",
"timestamp": "2024-01-15T10:00:00Z"
}

EndpointCache Duration
Listings10 minutes
Reservations2 minutes
Dashboard5 minutes
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests",
"retryAfter": 60
}
}