Notifications
Manage in-app notifications for scan completions, drift alerts, and system events.
Base path: /api/notifications
Authentication: Bearer token required on all routes
List Notifications
GET /api/notifications/
Get all notifications for the current user.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | No | Page number (default: 1) |
limit | number | No | Items per page (default: 20) |
unreadOnly | boolean | No | Only return unread notifications |
Response
json
{
"success": true,
"data": [
{
"_id": "notif1",
"type": "scan_completed",
"title": "Scan completed",
"message": "Scan for org/terraform-infra found 3 new drifts",
"read": false,
"createdAt": "2025-06-15T10:32:45.000Z",
"metadata": {
"scanId": "scan123",
"repositoryName": "org/terraform-infra"
}
}
]
}Example
bash
curl -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/notifications/Get Unread Count
GET /api/notifications/unread-count
Get the number of unread notifications.
Response
json
{
"success": true,
"data": {
"count": 5
}
}Example
bash
curl -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/notifications/unread-countMark All as Read
POST /api/notifications/mark-all-read
Mark all notifications as read.
Example
bash
curl -X POST -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/notifications/mark-all-readMark as Read
PATCH /api/notifications/:id/read
Mark a specific notification as read.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Notification ID |
Delete Notification
DELETE /api/notifications/:id
Delete a notification.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Notification ID |