EstateHub

Customer Review API

Base URL: http://localhost:8000/api/v1
Prefix: /customers
Auth: Customer JWT bearer token
Headers: Content-Type: application/json


1. List Customer Reviews

Returns reviews submitted by the authenticated customer.

GET/customers/reviews/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Reviews retrieved successfully.",
  "data": {
    "reviews": {
      "count": 1,
      "next": null,
      "previous": null,
      "results": [
        {
          "id": "a8ed69c8-9290-4a73-8c60-feb7815a5087",
          "property": {
            "id": "00aab84a-c95d-45c3-94c5-a60361434bb8",
            "title": "Modern Apartment in South Congress",
            "slug": "modern-apartment-in-south-congress",
            "city": "Austin",
            "area_name": "South Congress",
            "status": "sold"
          },
          "seller": {
            "id": "8935775e-cfaa-47d0-8830-986f88b1d695",
            "full_name": "James Wilson"
          },
          "transaction_type": "purchase",
          "transaction_id": "15537676-b847-47be-b644-3fd15c883015",
          "rating": 5,
          "comment": "The transaction went smoothly.",
          "status": "published",
          "created_at": "2026-10-08T10:30:00Z",
          "updated_at": "2026-10-08T10:30:00Z"
        }
      ]
    }
  }
}

Notes

  • Results are ordered from newest to oldest.
  • The default page size is 12; page_size can request up to 50 results.
  • Returns 401 when authentication is missing or invalid.
  • Returns 403 when the authenticated account does not have a customer role.

2. Submit Customer Review

Submits a review for the seller or landlord connected to an eligible transaction.

POST/customers/reviews/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "transaction_type": "purchase",
  "transaction_id": "15537676-b847-47be-b644-3fd15c883015",
  "rating": 5,
  "comment": "The seller was helpful and the transaction went smoothly."
}

Success Example

JSON
{
  "success": true,
  "message": "Review submitted successfully.",
  "data": {
    "review": {
      "id": "a8ed69c8-9290-4a73-8c60-feb7815a5087",
      "property": {
        "id": "00aab84a-c95d-45c3-94c5-a60361434bb8",
        "title": "Modern Apartment in South Congress",
        "slug": "modern-apartment-in-south-congress",
        "city": "Austin",
        "area_name": "South Congress",
        "status": "sold"
      },
      "seller": {
        "id": "8935775e-cfaa-47d0-8830-986f88b1d695",
        "full_name": "James Wilson"
      },
      "transaction_type": "purchase",
      "transaction_id": "15537676-b847-47be-b644-3fd15c883015",
      "rating": 5,
      "comment": "The seller was helpful and the transaction went smoothly.",
      "status": "published",
      "created_at": "2026-10-08T10:30:00Z",
      "updated_at": "2026-10-08T10:30:00Z"
    }
  }
}

Notes

  • transaction_type must be purchase or rental.
  • A purchase review uses the purchase ID and requires a purchase owned by the customer with status completed.
  • A rental review uses the rental application ID exposed by deal history and requires its related lease to have status active or ended.
  • rating must be an integer from 1 to 5; comment is optional.
  • The backend derives the reviewer, property, and seller from the transaction.
  • Only one review is allowed per customer transaction.
  • Returns 400 for invalid input, an ineligible or unrelated transaction, or a duplicate review.
  • Returns 401 when authentication is missing or invalid.
  • Returns 403 when the authenticated account does not have a customer role.

3. Get Customer Review

Returns one review owned by the authenticated customer.

GET/customers/reviews/{review_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Review retrieved successfully.",
  "data": {
    "review": {
      "id": "a8ed69c8-9290-4a73-8c60-feb7815a5087",
      "property": {
        "id": "00aab84a-c95d-45c3-94c5-a60361434bb8",
        "title": "Modern Apartment in South Congress",
        "slug": "modern-apartment-in-south-congress",
        "city": "Austin",
        "area_name": "South Congress",
        "status": "sold"
      },
      "seller": {
        "id": "8935775e-cfaa-47d0-8830-986f88b1d695",
        "full_name": "James Wilson"
      },
      "transaction_type": "purchase",
      "transaction_id": "15537676-b847-47be-b644-3fd15c883015",
      "rating": 5,
      "comment": "The seller was helpful and the transaction went smoothly.",
      "status": "published",
      "created_at": "2026-10-08T10:30:00Z",
      "updated_at": "2026-10-08T10:30:00Z"
    }
  }
}

Notes

  • The customer can retrieve only reviews they submitted.
  • Returns 401 when authentication is missing or invalid.
  • Returns 403 when the authenticated account does not have a customer role.
  • Returns 404 when the review does not exist or belongs to another customer.

4. Update Customer Review

Updates the rating, comment, or both for a review owned by the authenticated customer.

PATCH/customers/reviews/{review_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "rating": 4,
  "comment": "The transaction was completed successfully."
}

Success Example

JSON
{
  "success": true,
  "message": "Review updated successfully.",
  "data": {
    "review": {
      "id": "a8ed69c8-9290-4a73-8c60-feb7815a5087",
      "property": {
        "id": "00aab84a-c95d-45c3-94c5-a60361434bb8",
        "title": "Modern Apartment in South Congress",
        "slug": "modern-apartment-in-south-congress",
        "city": "Austin",
        "area_name": "South Congress",
        "status": "sold"
      },
      "seller": {
        "id": "8935775e-cfaa-47d0-8830-986f88b1d695",
        "full_name": "James Wilson"
      },
      "transaction_type": "purchase",
      "transaction_id": "15537676-b847-47be-b644-3fd15c883015",
      "rating": 4,
      "comment": "The transaction was completed successfully.",
      "status": "published",
      "created_at": "2026-10-08T10:30:00Z",
      "updated_at": "2026-10-08T11:15:00Z"
    }
  }
}

Notes

  • At least one of rating or comment must be provided.
  • rating must be an integer from 1 to 5.
  • Transaction, property, seller, reviewer, and moderation status cannot be changed.
  • Updating a hidden review does not publish it again.
  • Returns 400 when the request is empty or contains invalid values.
  • Returns 401 when authentication is missing or invalid.
  • Returns 403 when the authenticated account does not have a customer role.
  • Returns 404 when the review does not exist or belongs to another customer.

5. Delete Customer Review

Permanently deletes a review owned by the authenticated customer.

DELETE/customers/reviews/{review_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Review deleted successfully.",
  "data": {}
}

Notes

  • The customer can delete only reviews they submitted.
  • Deletion is permanent.
  • Returns 401 when authentication is missing or invalid.
  • Returns 403 when the authenticated account does not have a customer role.
  • Returns 404 when the review does not exist or belongs to another customer.

Common Success Format

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "field_name": [
      "Error message."
    ]
  }
}