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
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number for pagination |
limit | integer | 20 | Number 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
| Type | Description | Email Sent |
|---|---|---|
comment_reply | Someone replied to your comment | Yes |
comment_mention | You were @mentioned in a comment | No |
new_comment_on_video | Someone commented on your video | Yes |
video_shared | A video was shared with you | No |
video_processing_complete | Your video has finished processing | Yes |
video_processing_failed | Your video failed to process | Yes |
invitation_received | You received an organization invitation | Yes |
trial_ending | Your trial subscription is ending soon | Yes |
subscription_created | Your subscription was activated | Yes |
subscription_updated | Your subscription was updated | Yes |
subscription_canceled | Your subscription was canceled | Yes |
payment_failed | Your payment failed | Yes |
payment_succeeded | Your payment succeeded | Yes |
Notification Object
| Field | Type | Description |
|---|---|---|
id | string | Unique notification identifier |
userId | string | The user who receives the notification |
type | string | Notification type (see types above) |
title | string | Short notification title |
body | string | Detailed notification message |
resourceType | string | Type of related resource (e.g., "video", "comment") |
resourceId | string | ID of the related resource |
actorId | string | User who triggered the notification |
read | boolean | Whether the notification has been read |
createdAt | datetime | When the notification was created |
actor | object | User object of the actor (optional) |
Error Responses
401 Unauthorized
{
"success": false,
"error": "Unauthorized"
}
404 Not Found
{
"success": false,
"error": "Notification not found"
}
See Also: