Favorites API
Endpoints for managing user favorites (saved listings).
Get Favorites
Retrieve the current user's favorited listings. Requires authentication.
Response
[
{
"id": "clm...",
"userId": "clm...",
"listingId": "clm...",
"createdAt": "2024-01-15T10:30:00Z",
"listing": {
"id": "clm...",
"title": "iPhone 14 Pro",
"slug": "iphone-14-pro",
"price": "999",
"condition": "LIKE_NEW",
"status": "AVAILABLE",
"location": "Singapore",
"images": [{ "url": "https://..." }],
"seller": {
"id": "clm...",
"name": "John Doe",
"image": null
}
}
}
]
Add Favorite
Add a listing to favorites. Requires authentication.
Request Body
Response
Error Responses
| Status | Description |
|---|---|
| 400 | Listing already favorited |
| 401 | Not authenticated |
| 404 | Listing not found |
Remove Favorite
Remove a listing from favorites. Requires authentication.
Response
Error Responses
| Status | Description |
|---|---|
| 401 | Not authenticated |
| 404 | Favorite not found |
Check if Favorited
The isFavorited field is included in listing responses when the user is authenticated: