Nuclom Docs
API Reference

Notifications API

The Notifications API provides endpoints for managing user notifications, including viewing, marking as read, and deleting notifications.

Notifications API

The Notifications API provides endpoints for managing user notifications, including viewing, marking as read, and deleting notifications.

Overview

Nuclom has a comprehensive notification system that supports both in-app notifications and email notifications. Notifications are automatically created when:

Comment Events

  • Someone replies to your comment
  • Someone comments on your video
  • You are @mentioned in a comment

Video Events

  • A video is shared with you
  • Your video processing is complete
  • Your video processing fails

Organization Events

  • You receive an invitation to join an organization

Billing Events

  • Your trial is ending soon
  • Your subscription is created
  • Your subscription is updated
  • Your subscription is canceled
  • A payment succeeds
  • A payment fails

Email Notifications

Email notifications are automatically sent alongside in-app notifications for important events. Emails include styled HTML templates with action buttons. You can configure the sender email address using the RESEND_FROM_EMAIL environment variable.

Endpoints

List Notifications

Retrieves all notifications for the authenticated user.

GET /api/notifications
Authorization: Bearer {token}

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number for pagination
limitinteger20Number of notifications per page

Response

{
  "success": true,
  "data": {
    "data": [
      {
        "id": "notification-uuid",
        "userId": "user-uuid",
        "type": "comment_reply",
        "title": "New reply to your comment",
        "body": "John Doe replied to your comment",
        "resourceType": "video",
        "resourceId": "video-uuid",
        "actorId": "actor-user-uuid",
        "read": false,
        "createdAt": "2025-01-01T12:00:00Z",
        "actor": {
          "id": "actor-user-uuid",
          "name": "John Doe",
          "image": "https://example.com/avatar.jpg"
        }
      }
    ],
    "unreadCount": 5
  }
}

Mark All as Read

Marks all notifications as read for the authenticated user.

POST /api/notifications
Authorization: Bearer {token}

Response

{
  "success": true,
  "data": {
    "markedAsRead": 5
  }
}

Mark Single as Read

Marks a specific notification as read.

PATCH /api/notifications/{notificationId}
Authorization: Bearer {token}

Response

{
  "success": true,
  "data": {
    "id": "notification-uuid",
    "userId": "user-uuid",
    "type": "comment_reply",
    "title": "New reply to your comment",
    "body": "John Doe replied to your comment",
    "resourceType": "video",
    "resourceId": "video-uuid",
    "actorId": "actor-user-uuid",
    "read": true,
    "createdAt": "2025-01-01T12:00:00Z"
  }
}

Delete Notification

Deletes a specific notification.

DELETE /api/notifications/{notificationId}
Authorization: Bearer {token}

Response

{
  "success": true,
  "data": {
    "message": "Notification deleted successfully",
    "id": "notification-uuid"
  }
}

Notification Types

TypeDescriptionEmail Sent
comment_replySomeone replied to your commentYes
comment_mentionYou were @mentioned in a commentNo
new_comment_on_videoSomeone commented on your videoYes
video_sharedA video was shared with youNo
video_processing_completeYour video has finished processingYes
video_processing_failedYour video failed to processYes
invitation_receivedYou received an organization invitationYes
trial_endingYour trial subscription is ending soonYes
subscription_createdYour subscription was activatedYes
subscription_updatedYour subscription was updatedYes
subscription_canceledYour subscription was canceledYes
payment_failedYour payment failedYes
payment_succeededYour payment succeededYes

Notification Object

FieldTypeDescription
idstringUnique notification identifier
userIdstringThe user who receives the notification
typestringNotification type (see types above)
titlestringShort notification title
bodystringDetailed notification message
resourceTypestringType of related resource (e.g., "video", "comment")
resourceIdstringID of the related resource
actorIdstringUser who triggered the notification
readbooleanWhether the notification has been read
createdAtdatetimeWhen the notification was created
actorobjectUser object of the actor (optional)

Error Responses

401 Unauthorized

{
  "success": false,
  "error": "Unauthorized"
}

404 Not Found

{
  "success": false,
  "error": "Notification not found"
}

See Also: