Skip to main content
These endpoints allow users to manage their favorite properties. All endpoints require authentication.

Get User Favorites

Retrieve all properties that the authenticated user has marked as favorites.

Authentication

Requires authentication token.

Response

success
boolean
required
Indicates if the request was successful
data
array
required
Array of favorite property objects. Each property object matches the structure returned by the properties list endpoint.

Error Response

{
  "success": false,
  "message": "Failed to fetch favorites"
}

Example Request

cURL
curl -X GET https://api.inmobiliaria.com/api/users/favorites \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"

Example Response

{
  "success": true,
  "data": [
    {
      "id": "123",
      "slug": "beautiful-apartment-palermo-abc123",
      "title": "Beautiful Apartment in Palermo",
      "description": "Spacious 2-bedroom apartment",
      "price": 250000,
      "currency": "USD",
      "propertyType": "departamento",
      "listingType": "venta",
      "bedrooms": 2,
      "bathrooms": 2,
      "surfaceCoveredM2": 85,
      "images": ["https://example.com/image1.jpg"],
      "features": ["Balcony", "Garage"],
      "status": "activo",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    }
  ]
}

Add Property to Favorites

Add a property to the authenticated user’s favorites list.

Authentication

Requires authentication token.

Path Parameters

id
integer
required
The ID of the property to add to favorites

Response

success
boolean
required
Indicates if the property was added successfully
message
string
required
Success or error message

Error Responses

400 Bad Request - Invalid ID
The property ID is not a valid integer
{
  "success": false,
  "message": "Invalid property ID"
}
400 Bad Request - Already Favorited
The property is already in the user’s favorites
{
  "success": false,
  "message": "Property already in favorites"
}
404 Not Found
The property does not exist
{
  "success": false,
  "message": "Property not found"
}
500 Internal Server Error
Server error while adding to favorites
{
  "success": false,
  "message": "Failed to add to favorites"
}

Example Request

cURL
curl -X POST https://api.inmobiliaria.com/api/properties/123/favorite \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"

Example Response

{
  "success": true,
  "message": "Property added to favorites"
}

Remove Property from Favorites

Remove a property from the authenticated user’s favorites list.

Authentication

Requires authentication token.

Path Parameters

id
integer
required
The ID of the property to remove from favorites

Response

success
boolean
required
Indicates if the property was removed successfully
message
string
required
Success or error message

Error Responses

400 Bad Request
The property ID is not a valid integer
{
  "success": false,
  "message": "Invalid property ID"
}
500 Internal Server Error
Server error while removing from favorites
{
  "success": false,
  "message": "Failed to remove from favorites"
}

Example Request

cURL
curl -X DELETE https://api.inmobiliaria.com/api/properties/123/favorite \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"

Example Response

{
  "success": true,
  "message": "Property removed from favorites"
}

Notes

  • All favorites endpoints require authentication
  • The GET favorites endpoint returns full property details matching the properties list structure
  • Adding/removing favorites uses the property ID (not slug)
  • Removing a favorite that doesn’t exist will still return success
  • Property slugs are auto-generated if missing when fetching favorites

Build docs developers (and LLMs) love