Journey Docs
Members APICollections

Check Favorite Status

Check if a property is favorited by the member

GET/members/me/collections/favorites/{propertyDocumentId}/status

Overview

Returns whether the specified property is currently favorited by the authenticated member. Useful for showing the correct favorite state in UI (filled vs empty heart icons).

Authentication

Requires a valid Clerk JWT token in the Authorization header.

Path Parameters

propertyDocumentIdpathstringrequired

Property document ID to check favorite status for

Request

curl -X GET "http://localhost:3000/v1/members/me/collections/favorites/prop_luxury_maldives/status" \
  -H "Authorization: Bearer YOUR_CLERK_JWT"

Response

isFavoritedbooleanrequired

Whether the property is currently favorited by the member

Response

{
  "isFavorited": true
}

Use Cases

UI State Management

// Check favorite status before rendering property card
const checkFavoriteStatus = async (propertyId: string) => {
  const response = await fetch(`/api/members/me/collections/favorites/${propertyId}/status`);
  const { isFavorited } = await response.json();
  
  // Update UI accordingly
  setHeartIcon(isFavorited ? 'filled' : 'empty');
};

Preventing Duplicates

// Check before adding to prevent 409 errors
const addToFavorites = async (propertyId: string) => {
  const statusResponse = await fetch(`/api/members/me/collections/favorites/${propertyId}/status`);
  const { isFavorited } = await statusResponse.json();
  
  if (!isFavorited) {
    // Safe to add
    await fetch('/api/members/me/collections/favorites', {
      method: 'POST',
      body: JSON.stringify({ propertyDocumentId: propertyId })
    });
  }
};

Bulk Status Checking

// Check multiple properties (call this endpoint for each)
const checkMultipleFavorites = async (propertyIds: string[]) => {
  const statuses = await Promise.all(
    propertyIds.map(async (id) => {
      const response = await fetch(`/api/members/me/collections/favorites/${id}/status`);
      const { isFavorited } = await response.json();
      return { propertyId: id, isFavorited };
    })
  );
  return statuses;
};

Performance Notes

Caching

  • Fast Response: Optimized for quick UI state checks
  • Safe to Cache: Results can be cached briefly for UI responsiveness
  • Invalidation: Cache should be invalidated when adding/removing favorites

Rate Limits

  • Frequent Calls: Safe to call frequently for UI updates
  • Batch Considerations: For many properties, consider checking only visible items

On this page