Notifications require an authenticated
session.
Read Notifications
Start with a read to render the feed. It returns the account’s notifications newest first, together with the unread count for the badge.- TypeScript
- Python
- API
Fetch the first page of notifications.Each entry pairs one notification with its read state, and For the unread badge, fetch the count directly.
readAt stays
null until the notification is marked read. The read is paginated, so iterate
it to walk older history.Output: PerpsNotificationEntry[]
Output: PerpsNotificationEntry[]
Stream Notifications
Subscribe to the live channel to append new notifications and bump the unread badge without polling.- TypeScript
- Python
- API
Notification events arrive on the session stream alongside the other private
session updates.The stream yields
PerpsNotificationUpdateEvent objects like this.Mark Notifications Read
Read state drives the unread count. Mark notifications read when the user views them, either one by one or everything up to the newest one they have seen. Read state is scoped to the account, so a session can only mark its own notifications read.- TypeScript
- Python
- API
Mark specific notifications read by id, or mark everything up to an entry read.
upTo marks the given notification and every earlier one read, inclusive. Pass
the newest entry the user has seen to clear the feed in one call.Backfill Missed Notifications
The live channel can miss notifications. A reconnect leaves a gap, and under load the server can drop frames. The notifications read closes these gaps. Pass a sequence lower bound and it returns every notification from that point forward, so the feed catches up with stored history. Anchor the bound at the sequence of the last notification you processed, not at the sequence of the recovery signal. The bound is inclusive and one event can emit several notifications that share one sequence, so the backfill re-covers the boundary. Deduplicate merged results by notification identifier, which is identical across stored history and live updates. Stored history can lag behind live notifications. Retry from the same anchor and read every page on each attempt until stored history covers the missed interval.- TypeScript
- Python
- API
Track the sequence of the last notification event you processed. When the
session signals a Follow-up pages keep the same
resync, run the backfill from that anchor.sinceSeq bound automatically. If you have not
processed any notifications yet, leave sinceSeq unset and the read returns the
newest notifications.Notification Types
Each notification describes one account event. Auto-deleveraging can close or reduce a profitable position to settle another account’s liquidation without an action by the position holder.- TypeScript
- Python
- API
The Handle auto-deleveraging in the existing
PerpsNotificationType and PerpsNotificationOrderType enums export the
type and orderType values shown in the examples below.Fill-driven position notifications can include an
orderType field that names
the kind of order behind the fill. The field is omitted when the fill cannot
be attributed to an order, so treat it as optional display metadata.Each notification type carries the fields shown below.
PerpsSession iterator. The same
PerpsPositionDeleveragedNotification is available as entry.notification
from session.listNotifications().Output: PerpsPositionDeleveragedNotification
Output: PerpsPositionDeleveragedNotification
sizeClosed is the quantity closed or reduced, price is the settlement
price, and pnl is the realized PnL. All three are decimal strings.