Guides
Sessions & Notifications
Your own sessions, sign-out of one device, push devices, the inbox and notification preferences.
The /api/v1/console/me/** routes belong to the person who is signed in. They are self-service,
so no capability is needed, and they are open on every plan.
- Console JWT only. An API key or OAuth token is refused with 403, because a machine credential has no sessions or devices.
- Your own data only. Another person's id reads 404.
- Open during maintenance. They keep working during a read-only maintenance window.
Sessions
Every sign-in is one session. The sign-in and refresh result carries sessionId, and your access
token names the same session.
| Route | What it does |
|---|---|
GET /api/v1/console/me/sessions | Your live sessions: the current one first, then by last activity, at most 50 |
DELETE /api/v1/console/me/sessions/{id} | End another session. Its access token stops working on its next request. 409 for the session you are using: sign out instead |
POST /api/v1/console/me/sessions/revoke-others | End every session except this one: { "revoked": n }. 409 if your token is older than session ids: refresh, then retry |
Each session carries id, current, label (for example "Galaxy Tab A7 · Panoptes Staff"),
deviceId, deviceName, client, platform, appVersion, ip, userAgent, signedInAt,
lastActiveAt and expiresAt. Send an optional deviceName with deviceId when you sign in, so
the list is readable.
Signing out with POST /api/v1/console/auth/logout:
| You send | What ends |
|---|---|
Bearer + { "refreshToken": "…" } in the body | This device's session only |
Bearer + { "everywhere": true } | Every session |
| Bearer and no body | Every session, as before |
| Only a refresh token, in the body or the cookie | That one session |
Push devices
Register the device's Firebase Cloud Messaging token after every sign-in, whenever the token refreshes, and at least once a day:
curl -X POST https://staging-api.panoptesos.com/api/v1/console/me/push-devices \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "deviceId": "6f1c2a4e-5b7d-4c1a-9e2f-0a1b2c3d4e5f", "token": "<fcm token>",
"platform": "android", "appVersion": "1.3.0+21", "locale": "ar",
"deviceName": "Galaxy Tab A7" }'
- The fields.
platformisandroid,iosorweb;windowsis refused, because Windows apps use the inbox only.localeisaroren, and pushes arrive in that language.deviceIdmust be the one the session signed in with. - Other routes.
GETlists your devices.DELETE /me/push-devices/{deviceId}stops pushes; it is idempotent.POST /me/push-devices/{deviceId}/testsends a test notification, at most once a minute per device, and answers 429 withRetry-Afterbeyond that. - When a registration retires itself. Signing out, ending a session or changing your password retires the matching registrations. You do not need to clean them up.
- When pushes are off. If push is not enabled on the server,
transportEnabledisfalse. The inbox still works.
Each push's data carries v (the payload version, "1"), notificationId, category, event,
severity, route, createdAt and, when relevant, entityType, entityId and branchId. Open route when the user taps the
push; treat an unknown route as /notifications.
Inbox
Every notification is kept in your inbox, whether or not its push arrived.
| Route | What it does |
|---|---|
GET /api/v1/console/me/notifications | Newest first: page, per_page (at most 100), unread=true, category. No sort |
GET /api/v1/console/me/notifications/unread-count | { "unread": n } |
POST /api/v1/console/me/notifications/{id}/read | Mark one read; idempotent |
POST /api/v1/console/me/notifications/read-all | Mark all read, optionally one category's: { "category": "hr" } → { "updated": n } |
Each item carries id, category, event, severity, titleAr, titleEn, bodyAr, bodyEn,
entityType, entityId, branchId, route, createdAt, readAt and pushState.
Preferences
GET /api/v1/console/me/notification-preferences lists every category, with:
push: on or off;optional: whether it can be switched off;relevant: whether your role in the active branch receives it;quietHours:dropordefer.
It also returns the quiet-hours window (Baghdad time) and transportEnabled.
| Category | Can be muted | During quiet hours |
|---|---|---|
guest_payments | yes | dropped |
integrity | yes | delivered after |
hr | yes | delivered after |
announcements | yes | delivered after |
system | no | delivered after |
PATCH merges, so anything you leave out is unchanged:
{
"categories": [{ "category": "hr", "push": false }],
"quietHours": { "enabled": true, "start": "22:30", "end": "07:00" }
}
The PATCH answers 422 for:
- an unknown category;
- switching
systemoff; - a time that is not
HH:mm; - enabled quiet hours whose start equals their end.
Muting stops the push only. The inbox still records the notification.