# Get Unread Count
> Source: /api-reference/members/notifications/get-unread-count
> Get count of unread notifications
> Endpoint: GET /members/me/notifications/unread-count

## Overview [#overview]

Returns the count of unread notifications for the authenticated member. Useful for displaying notification badges and indicators in the UI.

## Authentication [#authentication]

Requires a valid Clerk JWT token in the Authorization header.

## Query Parameters [#query-parameters]

<ParamField query="wallet" type="boolean">
  Count only wallet-related notifications (points, transactions, etc.)
</ParamField>

<RequestExample>

```bash cURL - All Unread
curl -X GET "http://localhost:3000/v1/members/me/notifications/unread-count" \
  -H "Authorization: Bearer YOUR_CLERK_JWT"
```

```bash cURL - Wallet Unread Only
curl -X GET "http://localhost:3000/v1/members/me/notifications/unread-count?wallet=true" \
  -H "Authorization: Bearer YOUR_CLERK_JWT"
```

```typescript TypeScript
// Get total unread count
const response = await fetch('http://localhost:3000/v1/members/me/notifications/unread-count', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_CLERK_JWT'
  }
});

// Get wallet unread count only
const response = await fetch('http://localhost:3000/v1/members/me/notifications/unread-count?wallet=true', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_CLERK_JWT'
  }
});

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

</RequestExample>

## Response [#response]

<ResponseField name="total" type="number" required>
  Total count of unread notifications matching the filter criteria
</ResponseField>

<ResponseExample>

```json 200 Response - Has Unread
{
  "total": 5
}
```

```json 200 Response - No Unread
{
  "total": 0
}
```

```json 200 Response - Wallet Only
{
  "total": 2
}
```

</ResponseExample>

## Use Cases [#use-cases]

### UI Badge Display [#ui-badge-display]
```typescript
// Display notification badge
const getNotificationBadge = async () => {
  const response = await fetch('/api/members/me/notifications/unread-count');
  const { total } = await response.json();
  
  // Update UI badge
  if (total > 0) {
    setBadgeCount(total > 99 ? '99+' : total.toString());
    setBadgeVisible(true);
  } else {
    setBadgeVisible(false);
  }
};
```

### Separate Counters [#separate-counters]
```typescript
// Show different counters for different notification types
const getNotificationCounts = async () => {
  const [allResponse, walletResponse] = await Promise.all([
    fetch('/api/members/me/notifications/unread-count'),
    fetch('/api/members/me/notifications/unread-count?wallet=true')
  ]);
  
  const allCount = await allResponse.json();
  const walletCount = await walletResponse.json();
  
  setGeneralNotificationCount(allCount.total - walletCount.total);
  setWalletNotificationCount(walletCount.total);
};
```

### Real-time Updates [#real-time-updates]
```typescript
// Poll for updates (or use websockets)
const pollUnreadCount = () => {
  setInterval(async () => {
    const response = await fetch('/api/members/me/notifications/unread-count');
    const { total } = await response.json();
    updateNotificationBadge(total);
  }, 30000); // Poll every 30 seconds
};
```

## Filtering [#filtering]

### All Notifications [#all-notifications]
- **No wallet parameter**: Counts all unread notifications
- **Use case**: Main notification badge

### Wallet Only [#wallet-only]
- **wallet=true**: Counts only wallet-related unread notifications
- **Use case**: Separate wallet notification indicator

### Non-Wallet [#non-wallet]
```typescript
// Calculate non-wallet count
const allResponse = await fetch('/api/unread-count');
const walletResponse = await fetch('/api/unread-count?wallet=true');
const nonWalletCount = allResponse.total - walletResponse.total;
```

## Performance Notes [#performance-notes]

### Caching [#caching]
- **Fast Response**: Optimized for frequent polling
- **Cache-Safe**: Results can be cached briefly for UI responsiveness
- **Invalidation**: Cache should be invalidated when notifications are read/created

### Rate Limits [#rate-limits]
- **Frequent Calls**: Safe to call frequently for real-time updates
- **Efficient**: Designed for high-frequency badge updates

## Related Endpoints [#related-endpoints]

- [Get Notifications](/api-reference/members/notifications/get-notifications) - Get full notification list
- [Mark as Read](/api-reference/members/notifications/mark-read) - Mark notification as read (decreases count)
- [Mark as Unread](/api-reference/members/notifications/mark-unread) - Mark notification as unread (increases count)
