Skip to main content

List notifications

Retrieve the authenticated user’s recent notifications, ordered by most recent first.
GET /api/notifications
Authentication: Required Rate limit: Standard Query parameters:
ParameterTypeDefaultDescription
limitinteger50Number of notifications to return. Min: 1, max: 100.
unread_onlystring"false"Set to "true" to return only unread notifications.
Response 200 OK:
{
  "notifications": [
    {
      "id": "ntf_12345",
      "user_id": "usr_abc",
      "type": "security_alert",
      "title": "New device sign-in",
      "body": "A new device signed in to your account from San Francisco, CA.",
      "color": "red",
      "icon": "shield-alert",
      "action_url": "/dashboard/security",
      "actor_id": null,
      "actor_email": null,
      "actor_name": null,
      "metadata": { "device": "Chrome on macOS", "ip": "203.0.113.42" },
      "is_read": false,
      "created_at": "2026-03-05T14:30:00Z"
    },
    {
      "id": "ntf_67890",
      "user_id": "usr_abc",
      "type": "share_request",
      "title": "Password shared with you",
      "body": "Alice shared GitHub credentials with you.",
      "color": "default",
      "icon": null,
      "action_url": "/dashboard/passwords",
      "actor_id": "usr_def",
      "actor_email": "alice@example.com",
      "actor_name": "Alice",
      "metadata": {},
      "is_read": true,
      "created_at": "2026-03-04T09:15:00Z"
    }
  ],
  "unread_count": 3
}
FieldTypeDescription
notificationsarrayArray of notification objects, ordered by created_at descending
unread_countintegerTotal number of unread notifications for the user (independent of the limit parameter)
The unread_count is computed in parallel with the notification list query for efficiency. It always reflects the total unread count, not just the count within the returned page.

Create notification

Create a notification for the authenticated user. Typically called server-side by internal systems (security alerts, sharing events, system updates).
POST /api/notifications
Authentication: Required Rate limit: 30 requests per 60 seconds per user Request body:
{
  "user_id": "usr_abc",
  "type": "security_alert",
  "title": "New device sign-in",
  "body": "A new device signed in to your account.",
  "color": "red",
  "icon": "shield-alert",
  "action_url": "/dashboard/security",
  "actor_id": "usr_def",
  "actor_email": "alice@example.com",
  "actor_name": "Alice",
  "metadata": { "device": "Chrome on macOS" }
}
FieldTypeRequiredDescription
user_idstring (UUID)YesTarget user ID. Must match the authenticated user.
typestringYesNotification type (e.g., security_alert, share_request, info). Max 100 characters.
titlestringYesShort title. Max 500 characters.
bodystringYesFull notification message. Max 5000 characters.
colorstringNoColor theme for the notification badge. Default: "default". Max 50 characters.
iconstringNoIcon identifier. Max 200 characters.
action_urlstring (URL)NoURL to navigate to when the notification is clicked. Max 2000 characters.
actor_idstring (UUID)NoUser ID of the actor who triggered the notification.
actor_emailstring (email)NoEmail of the actor.
actor_namestringNoDisplay name of the actor. Max 200 characters.
metadataobjectNoArbitrary JSON metadata. Default: {}.
Users can only create notifications for themselves. If user_id does not match the authenticated user’s ID, the endpoint returns 403 Forbidden.
Response 201 Created:
{
  "notification": {
    "id": "ntf_new",
    "user_id": "usr_abc",
    "type": "security_alert",
    "title": "New device sign-in",
    "body": "A new device signed in to your account.",
    "is_read": false,
    "created_at": "2026-03-05T14:30:00Z"
  }
}
Errors:
StatusCodeDescription
400validation_failedMissing or invalid required fields
403forbiddenuser_id does not match the authenticated user
429rate_limitedRate limit exceeded
500internal_errorDatabase insert failed (sanitized message)

Clear all notifications

Delete all notifications for the authenticated user.
DELETE /api/notifications
Authentication: Required Rate limit: 30 requests per 60 seconds per user Response 200 OK:
{
  "success": true
}
Errors:
StatusCodeDescription
429rate_limitedRate limit exceeded
500internal_errorDatabase delete failed (sanitized message)
This endpoint deletes all notifications for the user, including both read and unread. There is no undo. Individual notification deletion is not currently supported via this endpoint.