Mark as Unread
Mark a specific notification as unread
/members/me/notifications/{id}/unreadOverview
Marks a specific notification as unread for the authenticated member. This reverts the notification's read status, removing the read timestamp and affecting the unread count and filtering.
Authentication
Requires a valid Clerk JWT token in the Authorization header.
Path Parameters
idpathnumberrequiredNotification ID to mark as unread
Request
curl -X PATCH "http://localhost:3000/v1/members/me/notifications/1234/unread" \
-H "Authorization: Bearer YOUR_CLERK_JWT"Response
Returns the updated notification object with the same structure as individual notification items from Get Notifications.
idnumberrequiredNotification ID
typestringrequiredNotification type
titlestringNotification title
messagestringNotification message
messagePartsobjectStructured message parts
isReadbooleanrequiredRead status (will be false after marking as unread)
isWalletbooleanrequiredWhether this is a wallet-related notification
metadataobjectAdditional notification metadata
createdAtstringrequiredISO 8601 timestamp when notification was created
updatedAtstringrequiredISO 8601 timestamp when notification was last updated (updated when marked as unread)
readAtstringISO 8601 timestamp when notification was marked as read (will be null after marking as unread)
Response
{
"id": 1234,
"type": "wallet",
"title": "Points Earned",
"message": "You earned 2,500 points from your recent stay at Luxury Resort Bali",
"messageParts": {
"action": "points_earned",
"amount": 2500,
"source": "reservation",
"propertyName": "Luxury Resort Bali"
},
"isRead": false,
"isWallet": true,
"metadata": {
"reservationId": "550e8400-e29b-41d4-a716-446655440000",
"propertyId": "prop_luxury_resort_bali",
"pointsType": "VALID"
},
"createdAt": "2024-04-20T10:30:00Z",
"updatedAt": "2024-04-20T16:45:00Z",
"readAt": null
}Behavior
Read Status Revert
- isRead: Changes from true to false
- readAt: Set to null (removed)
- updatedAt: Updated to current timestamp
Already Unread
- No Error: Returns 200 even if notification was already unread
- Idempotent: Safe to call multiple times
- Timestamp: updatedAt timestamp is updated to the most recent call
Ownership Validation
- Member Check: Only the notification owner can mark it as unread
- Security: Returns 404 if notification doesn't belong to authenticated member
Use Cases
Undo Read Action
// Mark notification as unread to bring it back to user's attention
const markNotificationUnread = async (notificationId: number) => {
try {
const response = await fetch(`/api/members/me/notifications/${notificationId}/unread`, {
method: 'PATCH'
});
if (response.ok) {
// Update local state
updateNotificationInList(notificationId, { isRead: false, readAt: null });
// Update unread count
incrementUnreadCount();
}
} catch (error) {
console.error('Failed to mark notification as unread:', error);
}
};Bulk Unread Operations
// Mark multiple notifications as unread
const markMultipleAsUnread = async (notificationIds: number[]) => {
const promises = notificationIds.map(id =>
fetch(`/api/members/me/notifications/${id}/unread`, { method: 'PATCH' })
);
await Promise.allSettled(promises);
// Refresh notification list and unread count
refreshNotifications();
};Admin/Support Actions
// Support workflow to mark important notifications as unread for user review
const flagForUserReview = async (notificationId: number) => {
// Mark as unread to ensure user sees it again
await markNotificationUnread(notificationId);
// Optionally add metadata to track admin action
await updateNotificationMetadata(notificationId, {
flaggedForReview: true,
flaggedBy: 'support',
flaggedAt: new Date().toISOString()
});
};Impact on Other Endpoints
Unread Count
- Increased: Marking as unread increases the unread count by 1
- Immediate: Count is updated immediately
- Filtered: Affects both general and filtered counts (wallet=true)
Notification List
- Filtering: Notification will appear in
read=falsefilter - Will Not Appear: Notification will no longer appear in
read=truefilter - Timestamps: Updated updatedAt and removed readAt reflect the change
Related Endpoints
- Mark as Read - Mark notification as read
- Get Unread Count - Check updated count
- Get Notifications - View updated notification list