Saltar al contenido principal

Notifications API

Manage push notifications and communication preferences.

Send Notification

Send a notification to the authenticated user.

Endpoint: POST /notifications/send

Authentication: JWT Bearer Token

Request Body:

{
"title": "Payment Reminder",
"message": "Your loan payment is due in 3 days",
"notificationType": "payment_reminder"
}

Parameters:

ParameterTypeRequiredDescription
titlestringYesNotification title
messagestringYesNotification message
notificationTypestringNoType: payment_reminder, loan_update, promotion, etc.

Response:

{
"success": true,
"statusCode": 200,
"data": {
"notificationId": "notif_123",
"status": "Sent",
"sentAt": "2024-01-23T12:00:00Z"
},
"error": null
}

Error Responses:

  • 400 - Invalid notification data
  • 401 - Unauthorized

Get Notifications

Retrieve notifications for the authenticated user.

Endpoint: GET /notifications

Authentication: JWT Bearer Token

Query Parameters:

ParameterTypeDescription
statusstringFilter by status (Unread, Read)
typestringFilter by notification type
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20)

Response:

{
"success": true,
"statusCode": 200,
"data": [
{
"notificationId": "notif_123",
"title": "Payment Reminder",
"message": "Your loan payment is due in 3 days",
"type": "payment_reminder",
"status": "Unread",
"createdAt": "2024-01-23T12:00:00Z"
}
],
"error": null
}

Error Responses:

  • 401 - Unauthorized

Get Notification Details

Retrieve details of a specific notification.

Endpoint: GET /notifications/:notificationId

Authentication: JWT Bearer Token

Path Parameters:

ParameterTypeDescription
notificationIdstringNotification ID

Response:

{
"success": true,
"statusCode": 200,
"data": {
"notificationId": "notif_123",
"title": "Payment Reminder",
"message": "Your loan payment is due in 3 days",
"type": "payment_reminder",
"status": "Read",
"actionUrl": "https://app.quoota.com/loans/loan_123",
"readAt": "2024-01-23T12:05:00Z",
"createdAt": "2024-01-23T12:00:00Z"
},
"error": null
}

Error Responses:

  • 401 - Unauthorized
  • 404 - Notification not found

Mark Notification as Read

Mark a notification as read.

Endpoint: PUT /notifications/:notificationId/read

Authentication: JWT Bearer Token

Path Parameters:

ParameterTypeDescription
notificationIdstringNotification ID

Response:

{
"success": true,
"statusCode": 200,
"data": {
"notificationId": "notif_123",
"status": "Read",
"readAt": "2024-01-23T12:05:00Z"
},
"error": null
}

Error Responses:

  • 401 - Unauthorized
  • 404 - Notification not found

Register Device Token

Register a device token for push notifications.

Endpoint: POST /notifications/deviceToken

Authentication: JWT Bearer Token

Request Body:

{
"token": "device_token_here",
"platform": "ios",
"deviceName": "iPhone 12"
}

Parameters:

ParameterTypeRequiredDescription
tokenstringYesDevice push notification token
platformstringYesPlatform: ios, android, web
deviceNamestringNoDevice name/identifier

Response:

{
"success": true,
"statusCode": 200,
"data": {
"deviceId": "device_123",
"platform": "ios",
"status": "Active"
},
"error": null
}

Error Responses:

  • 400 - Invalid token or platform
  • 401 - Unauthorized

Unregister Device Token

Unregister a device token from push notifications.

Endpoint: DELETE /notifications/deviceToken/:deviceId

Authentication: JWT Bearer Token

Path Parameters:

ParameterTypeDescription
deviceIdstringDevice ID to unregister

Response:

{
"success": true,
"statusCode": 200,
"data": {
"message": "Device unregistered successfully"
},
"error": null
}

Error Responses:

  • 401 - Unauthorized
  • 404 - Device not found