# Add Favorite
> Source: /api-reference/members/collections/add-favorite
> Add a property to favorites
> Endpoint: POST /members/me/collections/favorites

## Overview [#overview]

Adds a property to the member's favorites. The property can be added to a specific collection or the default favorites collection if no collection is specified.

## Authentication [#authentication]

Requires a valid Clerk JWT token in the Authorization header.

## Request Body [#request-body]

<ParamField body="propertyDocumentId" type="string" required>
  Property document ID to favorite
</ParamField>

<ParamField body="collectionId" type="number">
  Collection ID to add the property to (omit for default collection)
</ParamField>

<RequestExample>

```bash cURL - Add to Default Collection
curl -X POST "http://localhost:3000/v1/members/me/collections/favorites" \
  -H "Authorization: Bearer YOUR_CLERK_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "propertyDocumentId": "prop_luxury_maldives"
  }'
```

```bash cURL - Add to Specific Collection
curl -X POST "http://localhost:3000/v1/members/me/collections/favorites" \
  -H "Authorization: Bearer YOUR_CLERK_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "propertyDocumentId": "prop_luxury_maldives",
    "collectionId": 1
  }'
```

```typescript TypeScript
// Add to default collection
const response = await fetch('http://localhost:3000/v1/members/me/collections/favorites', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_CLERK_JWT',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    propertyDocumentId: "prop_luxury_maldives"
  })
});

// Add to specific collection
const response = await fetch('http://localhost:3000/v1/members/me/collections/favorites', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_CLERK_JWT',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    propertyDocumentId: "prop_luxury_maldives",
    collectionId: 1
  })
});

const favorite = await response.json();
```

</RequestExample>

## Response [#response]

<ResponseField name="propertyDocumentId" type="string" required>
  Property document identifier
</ResponseField>

<ResponseField name="propertyName" type="string" required>
  Property name
</ResponseField>

<ResponseField name="propertySlug" type="string">
  Property URL slug
</ResponseField>

<ResponseField name="heroImageUrl" type="string">
  Property hero image URL
</ResponseField>

<ResponseField name="collectionId" type="number">
  ID of the collection containing this favorite (null for default collection)
</ResponseField>

<ResponseField name="addedAt" type="string" required>
  ISO 8601 timestamp when property was favorited
</ResponseField>

<ResponseExample>

```json 201 Response - Success
{
  "propertyDocumentId": "prop_luxury_maldives",
  "propertyName": "Luxury Resort Maldives",
  "propertySlug": "luxury-resort-maldives",
  "heroImageUrl": "https://cdn.journey.com/properties/maldives-hero.jpg",
  "collectionId": 1,
  "addedAt": "2024-04-20T16:45:00Z"
}
```

```json 404 Response - Property Not Found
{
  "statusCode": 404,
  "message": "Property not found"
}
```

```json 404 Response - Collection Not Found
{
  "statusCode": 404,
  "message": "Collection not found"
}
```

```json 409 Response - Already Favorited
{
  "statusCode": 409,
  "message": "Property already favorited in this collection"
}
```

</ResponseExample>

## Collection Assignment [#collection-assignment]

### Default Collection [#default-collection]
- **No collectionId**: Property goes to default "Favorites" collection
- **collectionId: null**: Explicitly add to default collection
- **Auto-created**: Default collection exists for every member

### Specific Collection [#specific-collection]
- **collectionId: number**: Property goes to the specified collection
- **Must exist**: Collection must belong to the member
- **Validation**: System checks collection ownership

## Duplicate Handling [#duplicate-handling]

### Already Favorited [#already-favorited]
- **Same Collection**: Returns 409 error if property already in that collection
- **Different Collection**: Property can exist in multiple collections (if supported)
- **Default vs Named**: Same property can be in default and named collections

### Error Prevention [#error-prevention]
- Check [favorite status](/api-reference/members/collections/is-favorited) before adding
- Handle 409 errors gracefully in your UI
- Consider showing "already favorited" state to users

## Property Validation [#property-validation]

### Valid Properties [#valid-properties]
- **Exists**: Property must exist in the system
- **Active**: Property should be bookable/visible
- **Document ID**: Must use the property's document ID, not internal ID

### Invalid Properties [#invalid-properties]
- **Not Found**: Returns 404 for non-existent properties
- **Invalid Format**: Returns 400 for malformed document IDs
- **Restricted**: Some properties may not be favoritable

## Related Endpoints [#related-endpoints]

- [Get Favorites](/api-reference/members/collections/get-favorites) - View all favorites
- [Remove Favorite](/api-reference/members/collections/remove-favorite) - Remove from favorites
- [Check Favorite Status](/api-reference/members/collections/is-favorited) - Check if already favorited
- [Get Collections](/api-reference/members/collections/get-collections) - View available collections
