Manage guest reviews: list, filter, activate/deactivate, delete. Supports bulk operations and statistics.
Retrieve a paginated list of reviews. Filter by lot, platform, rating, date range, and publication status.
| Name | Type | Description |
|---|---|---|
| page | number | Page number (default: 1) |
| limit | number | Results per page (default: 20, max: 100) |
| lotId | string | Filter by lot ID |
| lotIds | string | Filter by multiple lot IDs (comma-separated) |
| platform | string | Filter by platform: airbnb, thehills, booking, lodgify, vrbo, tripadvisor, other |
| minRating | number | Minimum rating (0-5) |
| maxRating | number | Maximum rating (0-5) |
| startDate | date | Reviews from this date (ISO 8601) |
| endDate | date | Reviews until this date (ISO 8601) |
| isPublished | boolean | Filter by publication status (true/false) |
| sort | string | rating_asc, rating_desc, newest, oldest (default: newest) |
curl -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews?page=1&limit=10&platform=airbnb&minRating=4"
{
"success": true,
"reviews": [
{
"_id": "664f1a2b3c4d5e6f7a8b9c0d",
"lotId": { "_id": "...", "name": "Suite 201", "lotNo": "A201", "lodgifyId": "499029" },
"platform": "airbnb",
"guestName": "John D.",
"rating": 5,
"comment": "Amazing stay! The view was incredible...",
"reviewDate": "2025-03-15T00:00:00.000Z",
"isPublished": true,
"categories": { "cleanliness": 5, "communication": 5, "checkIn": 5, "accuracy": 4.5, "location": 5, "value": 4.5 },
"createdAt": "2025-03-16T10:30:00.000Z"
}
],
"total": 245,
"page": 1,
"limit": 10,
"totalPages": 25
}
Get aggregated statistics: total count, average rating, platform breakdown, rating distribution, and category averages.
| Name | Type | Description |
|---|---|---|
| lotId | string | Optional: filter stats for a specific lot |
{
"success": true,
"stats": {
"totalReviews": 245,
"publishedReviews": 230,
"unpublishedReviews": 15,
"averageRating": 4.6,
"ratingDistribution": { "1": 2, "2": 3, "3": 10, "4": 45, "5": 185 },
"platformBreakdown": [
{ "platform": "airbnb", "count": 120, "avgRating": 4.7 },
{ "platform": "vrbo", "count": 85, "avgRating": 4.5 }
],
"categoryAverages": {
"cleanliness": 4.8, "communication": 4.7, "checkIn": 4.6,
"accuracy": 4.5, "location": 4.9, "value": 4.4
}
}
}
Get detailed review statistics for a specific lot: averages, platform breakdown, rating distribution, and category scores.
| Name | Type | Description |
|---|---|---|
| lotId | string | MongoDB ID of the lot (required, in URL path) |
curl -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/stats/664f1a2b3c4d5e6f7a8b9c0d"
Retrieve the full details of a single review by its MongoDB ID.
curl -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d"
Toggle the isPublished flag on a review. If published, it will be unpublished and vice versa.
curl -X PATCH -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d/toggle-published"
{
"success": true,
"message": "Review deactivated",
"review": { "_id": "...", "isPublished": false, ... }
}
Set isPublished for multiple reviews at once.
| Field | Type | Description |
|---|---|---|
| reviewIds | string[] | Array of review IDs (required) |
| isPublished | boolean | true = activate, false = deactivate (required) |
curl -X POST -H "x-api-key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"reviewIds": ["id1", "id2", "id3"], "isPublished": true}' \
"https://listings.4u-realestate.org/reviews/bulk-toggle-published"
{
"success": true,
"message": "3 review(s) activated",
"modifiedCount": 3
}
Automatically activates all 5★ reviews and deactivates all ≤3★ reviews. 4★ reviews are left untouched for manual validation.
curl -X POST -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/bulk-activate-high-rated"
{
"success": true,
"message": "12 5★ activated, 3 ≤3★ deactivated, 5 4★ pending",
"activated": 12,
"deactivated": 3,
"pending4Stars": 5
}
Permanently removes a review from the database. This action cannot be undone.
curl -X DELETE -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d"
{ "success": true, "message": "Review deleted" }
Permanently removes multiple reviews. This action cannot be undone.
| Field | Type | Description |
|---|---|---|
| reviewIds | string[] | Array of review IDs to delete (required) |
curl -X POST -H "x-api-key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"reviewIds": ["id1", "id2"]}' \
"https://listings.4u-realestate.org/reviews/bulk-delete"
{ "success": true, "message": "2 review(s) deleted", "deletedCount": 2 }
| Field | Type | Description |
|---|---|---|
| _id | string | Unique MongoDB ID |
| lotId | object | Lot reference { _id, name, lotNo, lodgifyId } |
| platform | string | Source platform: airbnb, thehills, booking, lodgify, vrbo, tripadvisor, other |
| guestName | string | Guest name |
| rating | number | Overall rating (0-5) |
| comment | string | Review text |
| reviewDate | date | Date of the review |
| isPublished | boolean | Whether the review is active/visible |
| response | string | Owner/manager response |
| responseDate | date | Date of the response |
| categories | object | Sub-ratings: cleanliness, communication, checkIn, accuracy, location, value (each 0-5) |
| externalReviewId | string | External platform review ID |
| bookingId | string | Associated booking ID (optional) |
| createdAt | date | Creation timestamp |
| updatedAt | date | Last update timestamp |
const API = 'https://listings.4u-realestate.org';
const KEY = 'YOUR_API_KEY';
const headers = { 'x-api-key': KEY, 'Content-Type': 'application/json' };
// List all unpublished reviews
const res = await fetch(`${API}/reviews?isPublished=false&limit=50`, { headers });
const { reviews } = await res.json();
// Activate a specific review
await fetch(`${API}/reviews/${reviews[0]._id}/toggle-published`, {
method: 'PATCH', headers
});
// Bulk activate all 5-star reviews
await fetch(`${API}/reviews/bulk-activate-high-rated`, {
method: 'POST', headers
});
// Delete a review
await fetch(`${API}/reviews/${reviews[0]._id}`, {
method: 'DELETE', headers
});
# List reviews for a lot curl -s -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews?lotId=LOT_ID&minRating=4" | jq . # Get statistics curl -s -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/stats" | jq . # Toggle a review curl -X PATCH -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/REVIEW_ID/toggle-published" # Delete a review curl -X DELETE -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/REVIEW_ID" # Bulk activate high-rated curl -X POST -H "x-api-key: YOUR_KEY" \ "https://listings.4u-realestate.org/reviews/bulk-activate-high-rated"
| Code | Meaning | Solution |
|---|---|---|
| 400 | Invalid ID or missing parameters | Check the review ID format or required fields |
| 401 | Missing or invalid API key | Add a valid x-api-key header |
| 404 | Review not found | Verify the review ID exists |
| 429 | Rate limit exceeded | Wait and retry |
| 500 | Server error | Contact support |