← Back to API Home

Reviews API

Manage guest reviews: list, filter, activate/deactivate, delete. Supports bulk operations and statistics.

Read Endpoints

GET /reviews List reviews with filters & pagination

Retrieve a paginated list of reviews. Filter by lot, platform, rating, date range, and publication status.

QUERY PARAMETERS

NameTypeDescription
pagenumberPage number (default: 1)
limitnumberResults per page (default: 20, max: 100)
lotIdstringFilter by lot ID
lotIdsstringFilter by multiple lot IDs (comma-separated)
platformstringFilter by platform: airbnb, thehills, booking, lodgify, vrbo, tripadvisor, other
minRatingnumberMinimum rating (0-5)
maxRatingnumberMaximum rating (0-5)
startDatedateReviews from this date (ISO 8601)
endDatedateReviews until this date (ISO 8601)
isPublishedbooleanFilter by publication status (true/false)
sortstringrating_asc, rating_desc, newest, oldest (default: newest)

Example Request

curl -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews?page=1&limit=10&platform=airbnb&minRating=4"

Example Response

{
  "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 /reviews/stats Global review statistics

Get aggregated statistics: total count, average rating, platform breakdown, rating distribution, and category averages.

NameTypeDescription
lotIdstringOptional: filter stats for a specific lot

Example Response

{
  "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 /reviews/stats/:lotId Statistics for a specific lot

Get detailed review statistics for a specific lot: averages, platform breakdown, rating distribution, and category scores.

NameTypeDescription
lotIdstringMongoDB ID of the lot (required, in URL path)

Example

curl -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews/stats/664f1a2b3c4d5e6f7a8b9c0d"
GET /reviews/:id Get review detail by ID

Retrieve the full details of a single review by its MongoDB ID.

Example

curl -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d"

Activate / Deactivate

PATCH /reviews/:id/toggle-published Toggle publish status of a review

Toggle the isPublished flag on a review. If published, it will be unpublished and vice versa.

Example Request

curl -X PATCH -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d/toggle-published"

Example Response

{
  "success": true,
  "message": "Review deactivated",
  "review": { "_id": "...", "isPublished": false, ... }
}
POST /reviews/bulk-toggle-published Bulk activate/deactivate reviews

Set isPublished for multiple reviews at once.

REQUEST BODY (JSON)

FieldTypeDescription
reviewIdsstring[]Array of review IDs (required)
isPublishedbooleantrue = activate, false = deactivate (required)

Example Request

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"

Example Response

{
  "success": true,
  "message": "3 review(s) activated",
  "modifiedCount": 3
}
POST /reviews/bulk-activate-high-rated Auto-activate 5★ / deactivate ≤3★ Smart

Automatically activates all 5★ reviews and deactivates all ≤3★ reviews. 4★ reviews are left untouched for manual validation.

Example Request

curl -X POST -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews/bulk-activate-high-rated"

Example Response

{
  "success": true,
  "message": "12 5★ activated, 3 ≤3★ deactivated, 5 4★ pending",
  "activated": 12,
  "deactivated": 3,
  "pending4Stars": 5
}

Delete

DELETE /reviews/:id Permanently delete a review Destructive

Permanently removes a review from the database. This action cannot be undone.

Example

curl -X DELETE -H "x-api-key: YOUR_KEY" \
  "https://listings.4u-realestate.org/reviews/664f1a2b3c4d5e6f7a8b9c0d"

Example Response

{ "success": true, "message": "Review deleted" }
POST /reviews/bulk-delete Bulk delete multiple reviews Destructive

Permanently removes multiple reviews. This action cannot be undone.

REQUEST BODY (JSON)

FieldTypeDescription
reviewIdsstring[]Array of review IDs to delete (required)

Example

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"

Example Response

{ "success": true, "message": "2 review(s) deleted", "deletedCount": 2 }

Review Fields

FieldTypeDescription
_idstringUnique MongoDB ID
lotIdobjectLot reference { _id, name, lotNo, lodgifyId }
platformstringSource platform: airbnb, thehills, booking, lodgify, vrbo, tripadvisor, other
guestNamestringGuest name
ratingnumberOverall rating (0-5)
commentstringReview text
reviewDatedateDate of the review
isPublishedbooleanWhether the review is active/visible
responsestringOwner/manager response
responseDatedateDate of the response
categoriesobjectSub-ratings: cleanliness, communication, checkIn, accuracy, location, value (each 0-5)
externalReviewIdstringExternal platform review ID
bookingIdstringAssociated booking ID (optional)
createdAtdateCreation timestamp
updatedAtdateLast update timestamp

Code Examples

JavaScript - List & toggle reviews

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
});

cURL - Common operations

# 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"

Error Codes

CodeMeaningSolution
400Invalid ID or missing parametersCheck the review ID format or required fields
401Missing or invalid API keyAdd a valid x-api-key header
404Review not foundVerify the review ID exists
429Rate limit exceededWait and retry
500Server errorContact support