API EndpointsApp NotificationsFetch Notifications

Get App Notifications

Endpoint

URL: /:projectId/app-notifications

Method: GET

Authentication Required: Yes


Description

Retrieve a paginated list of app notifications for the authenticated user, ordered by most recent first.


Request

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication.

Query Parameters

ParameterTypeRequiredDefaultDescription
pagenumberNo1The page number (must be a whole number >= 1).
limitnumberNo5Number of notifications to return (max 50).

Example Request

GET /proj1234/app-notifications?page=2&limit=10
Authorization: Bearer <ACCESS_TOKEN>

Response

Success Response (200 OK)

[
  {
    "id": "notif123",
    "userId": "user_abc",
    "projectId": "proj1234",
    "type": "new-follow",
    "action": "open-profile",
    "metadata": {
      "initiatorId": "user_xyz",
      "initiatorName": "Jane",
      "initiatorUsername": "jane123",
      "initiatorAvatar": "https://example.com/avatar.jpg"
    },
    "createdAt": "2024-07-10T10:00:00.000Z",
    "updatedAt": "2024-07-10T10:00:00.000Z"
  }
]

Error Responses

Invalid Page (400 Bad Request)

{
  "error": "Invalid request: 'page' must be a whole number greater than 0",
  "code": "app-notification/invalid-page"
}

Invalid Limit (400 Bad Request)

{
  "error": "Invalid request: limit must be a number",
  "code": "app-notification/invalid-limit"
}

Server Error (500 Internal Server Error)

{
  "error": "Internal server error.",
  "code": "app-notification/server-error",
  "details": "<Error message>"
}

Notes

  • Requires authentication.
  • Pagination is supported via page and limit query parameters.
  • Max value for limit is 50.