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 signal that told you to resync. 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 notificationid, which is identical across the read and the live channel.
- 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
Every notification carries atype and a small type-specific payload.
Fill-driven position notifications (
position_opened, position_increased,
position_reduced, and position_closed) can include an order_type field
that names the kind of order behind the fill: market, limit, take_profit,
or stop_loss. An order fired by a take-profit or stop-loss
trigger reports the trigger that fired it. Otherwise an aggressing order
submitted without a limit price reports market, and everything else reports
limit, including fills on a resting maker order. The field is omitted when
the fill cannot be attributed to an order, so treat it as optional display
metadata.
A liquidation_warning for an isolated-margin position names the instrument
and its liquidation price. A cross-margin warning covers the whole account
instead. It has no single instrument or liquidation price and lists the
affected instruments. See Liquidation
Mechanics for how
liquidations work.
- TypeScript
- Python
- API
The On
PerpsNotificationType and PerpsNotificationOrderType enums export the
type and order_type values. Each notification type carries these fields.position_liquidated, pnl is null when no fill produced a realized
figure, for example a backstop close. viaBackstop reports whether an
insurance-fund backstop applied to the liquidation.