Skip to content

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

ParameterTypeRequiredDescription
pagenumberNoPage number (default: 1)
limitnumberNoItems per page (default: 20)
unreadOnlybooleanNoOnly 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-count

Mark 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-read

Mark as Read

PATCH /api/notifications/:id/read

Mark a specific notification as read.

Path Parameters

ParameterTypeDescription
idstringNotification ID

Delete Notification

DELETE /api/notifications/:id

Delete a notification.

Path Parameters

ParameterTypeDescription
idstringNotification ID