Notifications

Endpoints for retrieving, updating, and managing notifications for authenticated users.

All notification endpoints require authentication via Sanctum.


Get Notifications

GET /api/v1/notifications

Get a paginated list of notifications for the authenticated user.

Query Parameters

  • Name
    page
    Type
    integer
    Description

    Page number (default: 1)

  • Name
    per_page
    Type
    integer
    Description

    Items per page (default: 15)

  • Name
    unread_only
    Type
    boolean
    Description

    Show only unread notifications (default: false)

Response

{
  "success": true,
  "data": {
    "notifications": [],
    "pagination": {
      "total": 0,
      "per_page": 15,
      "current_page": 1,
      "last_page": 1,
      "from": null,
      "to": null
    },
    "unread_count": 0
  }
}

Mark Notification as Read

POST /api/v1/notifications/{id}/read

Mark a specific notification as read.

## Path Parameters

  • Name
    id
    Type
    string
    Description

    Notification ID

Response

{
  "success": true,
  "message": "Notification marked as read",
  "data": {}
}

Mark All Notifications as Read

POST /api/v1/notifications/mark-all-read

Mark all unread notifications as read for the authenticated user.

Response

{
  "success": true,
  "message": "Marked 3 notification(s) as read",
  "data": {
    "marked_count": 3
  }
}

Delete Notification

DELETE /api/v1/notifications/{id}

Delete a specific notification.

## Path Parameters

  • Name
    id
    Type
    string
    Description

    Notification ID

Response

{
  "success": true,
  "message": "Notification deleted"
}

Delete All Notifications

DELETE /api/v1/notifications

Delete all notifications for the authenticated user.

Response

{
  "success": true,
  "message": "Deleted 5 notification(s)",
  "data": {
    "deleted_count": 5
  }
}

Get Unread Notification Count

GET /api/v1/notifications/unread-count

Get the total count of unread notifications.

Response

{
  "success": true,
  "data": {
    "unread_count": 2
  }
}

Was this page helpful?