Skip to main content

Notifications API

Push notifications and in-app notification management.

Endpoints

Get Notifications

GET /notifications

Get user's notifications with pagination.

Query Parameters

ParameterTypeDescription
unreadOnlybooleanOnly return unread notifications
typestringFilter by notification type
skipnumberPagination offset
takenumberResults per page (default: 50)

Response

{
"notifications": [
{
"id": "notif123",
"type": "MISSION_ACCEPTED",
"title": "Mission Accepted!",
"body": "João has accepted your delivery mission",
"data": {
"missionId": "mission123",
"performerId": "user456"
},
"read": false,
"createdAt": "2025-12-01T10:00:00Z"
}
],
"unreadCount": 5,
"total": 150
}

Mark as Read

POST /notifications/:id/read

Mark a single notification as read.


Mark All as Read

POST /notifications/read-all

Mark all notifications as read.


Get Unread Count

GET /notifications/unread-count

Response

{
"count": 5
}

Update Preferences

PATCH /notifications/preferences

Request Body

{
"pushEnabled": true,
"emailEnabled": false,
"missionUpdates": true,
"guildUpdates": true,
"xpUpdates": false,
"marketingUpdates": false
}

Notification Types

TypeDescriptionDefault
MISSION_ACCEPTEDSomeone accepted your mission✅ On
MISSION_SUBMITTEDPerformer submitted proof✅ On
MISSION_COMPLETEDMission completed successfully✅ On
MISSION_DISPUTEDDispute raised on mission✅ On
GUILD_INVITEInvited to join a guild✅ On
GUILD_PROMOTEDPromoted to curator/officer✅ On
XP_LEVEL_UPReached new XP level✅ On
ACHIEVEMENT_EARNEDNew achievement unlocked✅ On
RATING_RECEIVEDSomeone rated you⚠️ Optional
DISPUTE_RESOLVEDDispute outcome announced✅ On

Push Notification Setup

Mobile (React Native)

import * as Notifications from 'expo-notifications';

// Register for push notifications
const token = await Notifications.getExpoPushTokenAsync();

// Send token to backend
await api.post('/notifications/register-device', {
token: token.data,
platform: Platform.OS,
});

Web (Service Worker)

const registration = await navigator.serviceWorker.ready;
const subscription = await registration.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: VAPID_PUBLIC_KEY,
});

await api.post('/notifications/register-device', {
subscription,
platform: 'web',
});