EstateHub

Administrator Notifications API

Base URL: http://localhost:8000/api/v1
Prefix: /admins/notifications
Auth: JWT Bearer token for an active admin
Headers: Content-Type: application/json


1. List Notifications

Retrieve the authenticated admin’s notification history.

GET/admins/notifications/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Notifications retrieved successfully.",
  "data": {
    "notifications": {
      "count": 1,
      "next": null,
      "previous": null,
      "results": [
        {
          "id": "b18c23d8-7c92-492f-96a4-2c5d6d9a4d10",
          "title": "Property review requested",
          "body": "Downtown Apartment is awaiting review.",
          "type": "property",
          "reference_type": "property",
          "reference_id": "8d4b6d2e-1b7f-4a4b-8f2c-1efba83f9c91",
          "is_read": false,
          "read_at": null,
          "created_at": "2026-09-14T10:00:00Z",
          "updated_at": "2026-09-14T10:00:00Z"
        }
      ]
    }
  }
}

Notes

  • Returns only the logged-in admin’s notifications, newest first.

  • Default page size: 20.

  • Optional query parameters:

ParameterExamplePurpose
page2Pagination
is_readfalseRead/unread filter
typepropertyNotification category

Example:

HTTP
GET {{base_url}}/accounts/admins/notifications/?is_read=false&type=property&page=1
  • Valid types: property, conversation, appointment, purchase, rental, auction, investment, payment, payout, support, system.

  • Invalid filters return HTTP 400. Invalid pages return HTTP 404.

  • Currently generated alerts cover property review, KYC/KYB review, and purchase/rental reservation-payment verification.

  • KYC/KYB alerts use type: "system" and distinct reference types.

reference_typereference_idAdmin destination
propertyProperty UUIDProperty review/details
kycVerification UUIDKYC review
kybVerification UUIDKYB review
paymentPayment UUIDManual payment verification

The frontend maps these references to its screens. Payment navigation requires a corresponding payment-management screen/API. Handle deleted or unavailable target records gracefully.


2. Unread Count

Retrieve the admin’s unread notification count.

GET/admins/notifications/unread-count/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Unread notification count retrieved successfully.",
  "data": {
    "unread_count": 5
  }
}

Notes

  • Counts only the logged-in admin’s unread notifications.

  • Independent of notification-list filters.


3. Notification Details

Retrieve one notification belonging to the admin.

GET/admins/notifications/{notification_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Notification retrieved successfully.",
  "data": {
    "notification": {
      "id": "b18c23d8-7c92-492f-96a4-2c5d6d9a4d10",
      "title": "Property review requested",
      "body": "Downtown Apartment is awaiting review.",
      "type": "property",
      "reference_type": "property",
      "reference_id": "8d4b6d2e-1b7f-4a4b-8f2c-1efba83f9c91",
      "is_read": false,
      "read_at": null,
      "created_at": "2026-09-14T10:00:00Z",
      "updated_at": "2026-09-14T10:00:00Z"
    }
  }
}

Notes

  • Viewing details does not mark the notification read.

  • Missing notifications and notifications belonging to another user return HTTP 404.


4. Update Read State

Mark a notification read or unread.

PATCH/admins/notifications/{notification_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "is_read": true
}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Notification updated successfully.",
  "data": {
    "notification": {
      "id": "b18c23d8-7c92-492f-96a4-2c5d6d9a4d10",
      "title": "Property review requested",
      "body": "Downtown Apartment is awaiting review.",
      "type": "property",
      "reference_type": "property",
      "reference_id": "8d4b6d2e-1b7f-4a4b-8f2c-1efba83f9c91",
      "is_read": true,
      "read_at": "2026-09-14T10:05:00Z",
      "created_at": "2026-09-14T10:00:00Z",
      "updated_at": "2026-09-14T10:05:00Z"
    },
    "unread_count": 0
  }
}

Notes

  • is_read is required.

  • Use false to mark unread and clear read_at.

  • Repeating the current state preserves the timestamp and does not broadcast another event.

  • State changes broadcast notification.updated to this admin’s connected tabs/devices.

  • Invalid or missing is_read returns HTTP 400.

  • Missing or other-user notification IDs return HTTP 404.


5. Mark All Read

Mark all currently unread notifications belonging to the admin as read.

POST/admins/notifications/read-all/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Notifications marked as read successfully.",
  "data": {
    "updated": 5,
    "unread_count": 0
  }
}

Notes

  • No request body is required.

  • Other admins’ read states remain independent.

  • Broadcasts notifications.read_all when records change.

  • New arrivals can make the returned unread count nonzero.


6. Live Notification Connection

Receive notification events through WebSockets.

WebSocketws://localhost:8000/ws/admins/notifications/?token={access_token}

Auth: Required

Success Example

A new notification arrives as:

JSON
{
  "type": "notification.created",
  "notification": {
    "id": "b18c23d8-7c92-492f-96a4-2c5d6d9a4d10",
    "title": "Property review requested",
    "body": "Downtown Apartment is awaiting review.",
    "type": "property",
    "reference_type": "property",
    "reference_id": "8d4b6d2e-1b7f-4a4b-8f2c-1efba83f9c91",
    "is_read": false,
    "read_at": null,
    "created_at": "2026-09-14T10:00:00Z",
    "updated_at": "2026-09-14T10:00:00Z"
  },
  "unread_count": 1
}

Notes

  • Use the server’s root URL, without the /api/v1 REST prefix. Use wss:// with HTTPS deployments.

  • The connection joins the authenticated admin’s private group automatically.

  • WebSocket events do not use the REST success/message/data envelope.

EventPayload
notification.creatednotification, unread_count
notification.updatedUpdated notification, unread_count
notifications.read_allread_at, updated, unread_count

Read-all event example:

JSON
{
  "type": "notifications.read_all",
  "read_at": "2026-09-14T10:05:00+00:00",
  "updated": 5,
  "unread_count": 0
}
  • Perform read/unread updates through REST. Sending client messages over this socket returns:
JSON
{
  "type": "error",
  "message": "Use REST APIs to update notifications."
}
  • Invalid authentication or unavailable admin access closes the connection with code 4403.

  • Admin access is rechecked on incoming messages and outgoing events.

  • Notifications persist before broadcasting. Failed live delivery does not undo the saved notification.

  • After connecting or reconnecting, fetch history and unread count through REST. Missed events are not automatically replayed.

  • Deduplicate displayed notifications by ID. Refresh visible history after notifications.read_all.

  • Announcements, payouts, and disputes are not connected in this release.


Common Success Format

REST endpoints use:

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

HTTP 400 — validation error:

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "is_read": [
      "This field is required."
    ]
  }
}

HTTP 401 — missing authentication:

JSON
{
  "success": false,
  "message": "Authentication credentials were not provided.",
  "errors": {}
}

Invalid or expired tokens also return HTTP 401, with token-specific error details.

HTTP 403 — insufficient permissions:

JSON
{
  "success": false,
  "message": "You do not have permission to perform this action.",
  "errors": {}
}

Non-admin, inactive, blocked, and deleted accounts cannot access these APIs.

HTTP 404 — missing or other-user notification:

JSON
{
  "success": false,
  "message": "Notification not found.",
  "errors": {}
}

Malformed JSON returns HTTP 400. Unsupported methods return 405; unsupported request content types may return 415.