EstateHub

Favorite Collections API

Base URL: http://localhost:8000/api/v1
Prefix: /customers/favorite-collections/
Auth: Bearer token required, customer role required
Headers: Content-Type: application/json

1. List Favorite Collections

Get the authenticated customer’s collections

GET/customers/favorite-collections/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Favorite collections retrieved successfully.",
  "data": {
    "collections": [
      {
        "id": "8e7fd6a0-8a4a-4e44-8c63-7dc1a0f61f21",
        "name": "Shortlist",
        "properties_count": 2,
        "created_at": "2026-07-29T10:30:00Z",
        "updated_at": "2026-07-29T10:30:00Z"
      }
    ]
  }
}

2. Create Favorite Collection

Create a new customer collection

POST/customers/favorite-collections/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "name": "Weekend visits"
}

Success Example

JSON
{
  "success": true,
  "message": "Favorite collection created successfully.",
  "data": {
    "collection": {
      "id": "8e7fd6a0-8a4a-4e44-8c63-7dc1a0f61f21",
      "name": "Weekend visits",
      "properties_count": 0,
      "created_at": "2026-07-29T10:30:00Z",
      "updated_at": "2026-07-29T10:30:00Z"
    }
  }
}

Notes

  • Collection names must be unique per customer.

  • properties_count is read-only.


3. Get Favorite Collection Details

Get one collection with its saved properties

GET/customers/favorite-collections/{collection_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Favorite collection retrieved successfully.",
  "data": {
    "collection": {
      "id": "8e7fd6a0-8a4a-4e44-8c63-7dc1a0f61f21",
      "name": "Weekend visits",
      "properties_count": 1,
      "created_at": "2026-07-29T10:30:00Z",
      "updated_at": "2026-07-29T10:35:00Z",
      "properties": [
        {
          "id": "5ceec559-e735-4a09-955f-f1c2f9bb7628",
          "property": {
            "id": "9dc7a092-b173-4f14-a767-e74f5a620d38",
            "title": "Modern Apartment in Downtown",
            "slug": "modern-apartment-in-downtown",
            "property_type": "apartment",
            "purpose": "buy",
            "price": "625000.00",
            "currency": "USD",
            "city": "Austin",
            "area_name": "Downtown",
            "bedrooms": 3,
            "bathrooms": 2,
            "area_size": "1450.00",
            "area_unit": "sqft",
            "ownership_verified": true,
            "is_featured": false,
            "is_trending": false,
            "primary_media": null,
            "amenities": [],
            "approved_at": "2026-07-29T09:00:00Z",
            "created_at": "2026-07-29T08:30:00Z"
          },
          "created_at": "2026-07-29T10:35:00Z"
        }
      ]
    }
  }
}

4. Update Favorite Collection

Rename a collection

PATCH/customers/favorite-collections/{collection_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "name": "Ready to visit"
}

Success Example

JSON
{
  "success": true,
  "message": "Favorite collection updated successfully.",
  "data": {
    "collection": {
      "id": "8e7fd6a0-8a4a-4e44-8c63-7dc1a0f61f21",
      "name": "Ready to visit",
      "properties_count": 1,
      "created_at": "2026-07-29T10:30:00Z",
      "updated_at": "2026-07-29T10:40:00Z"
    }
  }
}

5. Delete Favorite Collection

Delete one customer collection

DELETE/customers/favorite-collections/{collection_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

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

6. Add Property To Collection

Add an available property to a collection

POST/customers/favorite-collections/{collection_id}/properties/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "property_id": "9dc7a092-b173-4f14-a767-e74f5a620d38"
}

Success Example

JSON
{
  "success": true,
  "message": "Property added to favorite collection.",
  "data": {
    "collection_property": {
      "id": "5ceec559-e735-4a09-955f-f1c2f9bb7628",
      "property": {
        "id": "9dc7a092-b173-4f14-a767-e74f5a620d38",
        "title": "Modern Apartment in Downtown",
        "slug": "modern-apartment-in-downtown",
        "property_type": "apartment",
        "purpose": "buy",
        "price": "625000.00",
        "currency": "USD",
        "city": "Austin",
        "area_name": "Downtown",
        "bedrooms": 3,
        "bathrooms": 2,
        "area_size": "1450.00",
        "area_unit": "sqft",
        "ownership_verified": true,
        "is_featured": false,
        "is_trending": false,
        "primary_media": null,
        "amenities": [],
        "approved_at": "2026-07-29T09:00:00Z",
        "created_at": "2026-07-29T08:30:00Z"
      },
      "created_at": "2026-07-29T10:35:00Z"
    }
  }
}

Notes

  • Property must exist and be available.

  • Adding a property to a collection also creates the customer favorite if it does not already exist.

  • If the property is already in the collection, the API returns 200 with message "Property is already in favorite collection.".


7. Remove Property From Collection

Remove one property from a collection

DELETE/customers/favorite-collections/{collection_id}/properties/{property_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Property removed from favorite collection.",
  "data": {}
}

Common Success Format

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

Common Error Format

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "field_name": [
      "This field is invalid."
    ]
  }
}