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
Indicates if the request was successful
Array of favorite property objects. Each property object matches the structure returned by the properties list endpoint.
Property unique identifier
URL-friendly property identifier
Currency code (e.g., “USD”, “ARS”)
Type of property (e.g., “casa”, “departamento”)
Operation type (e.g., “venta”, “alquiler”)
Property address information
Detailed location data with coordinates
Covered surface area in square meters
Array of property features
Property status (e.g., “activo”)
Error Response
{
"success": false,
"message": "Failed to fetch favorites"
}
Example Request
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
The ID of the property to add to favorites
Response
Indicates if the property was added successfully
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"
}
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 -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
The ID of the property to remove from favorites
Response
Indicates if the property was removed successfully
Error Responses
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 -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