A price alert watches one market's price and fires once when the price crosses a level you choose. A fired alert is delivered to the notification center, where the account reads it with its other notifications.
- PriceAlertService (
alerts.v1) creates, lists, updates, and cancels alerts. - NotificationService (
notifications.v1) lists notifications, counts unread ones, and marks them read or unread.
Both are ConnectRPC only, with no REST route.
SDKs
- TypeScript:
client.priceAlertsandclient.notifications. - Python:
client.alerts. - Go:
client.Alerts. - Rust:
client.alerts.
The Python, Go and Rust SDKs cover price alerts; read the notification center with TypeScript or ConnectRPC.
alert = await client.alerts.create(
symbol="BTC-USDT",
direction="above",
price="70000",
channels=["in_app"],
idempotency_key="btc-70k-alert",
)
print(alert.alert_id, alert.status, alert.armed, alert.reference_price)Access
Alerts and notifications belong to the Main Account. A session and the Main Account's API keys see the same alerts.
- Price alerts accept a session, or a Main Account API key whose policy grants
READ_PRICE_ALERTSto list alerts andMANAGE_PRICE_ALERTSto create, update, or cancel them. Neither permission implies the other. A key without the permission is refused withPERMISSION_DENIEDandAUTH_API_KEY_ACCESS_DENIED; a Subaccount key is refused withPERMISSION_DENIEDandSUBACCOUNT_KEY_REFUSED. See API key policies. - Notifications accept a session, or a Main Account API key whose policy grants
READ_NOTIFICATIONSforListNotifications,GetNotification, andGetNotificationCounts. Marking notifications read or unread takes a session only; an API key is refused withPERMISSION_DENIEDandAUTH_SESSION_KIND_NOT_ALLOWED. A Subaccount key is refused withPERMISSION_DENIEDandAUTH_API_KEY_ACCESS_DENIED.
How an alert fires
- Condition.
ABOVEfires when the price rises to or above the alert price;BELOWfires when it falls to or below it. - Price source. An alert watches the market's last traded price (
LAST_PRICE) or its index price (INDEX_PRICE). Leave the source out to use the index price where the market has one, and the last traded price otherwise; the returned alert states which. A market without an index price refusesINDEX_PRICEwithPRICE_SOURCE_UNSUPPORTED. - Crossing. Creating an alert records the current price as
referencePriceTicks. An alert only fires on a crossing it observes, so one created already past its level starts witharmedfalse and waits for the price to move back and cross again. - Once. An alert fires at most once and becomes
TRIGGERED. Late prices and a feed that stops updating never fire it. - No expiry. Alerts do not expire and do not repeat. An
ACTIVEalert waits until it fires or you cancel it.
The status is ACTIVE, TRIGGERED, or CANCELLED.
Create, update, and cancel
CreateAlerttakes the market, direction, price, channels, an optional price source, and an optionalidempotencyKey. A retry with the same key and request returns the alert the first request created.UpdateAlertchanges the direction, price, or channels named inupdateMask, with therevisionfrom your last read asexpectedRevision. A new direction or price records a new reference price. Updating aTRIGGEREDalert sets it again, even with an empty mask. A replay with the sameidempotencyKeyreturns outcomeREPLAYEDand changes nothing, so a retried update never sets the alert again a second time.CancelAlertcancels anACTIVEalert, which then never fires. Cancelling it again returns it unchanged. ATRIGGEREDalert is refused withALERT_TRIGGERED; aCANCELLEDalert can't be updated (ALERT_CANCELLED).ListAlertsreturns alerts newest first, filtered by status and market, up to 200 per page. ReusenextPageTokenwith the same filters.
A Main Account holds at most 100 active alerts. Creating another, or setting a fired alert again,
is refused with ALERT_LIMIT_REACHED; cancel an alert first. A SERVICE_UNAVAILABLE on a create,
update, or cancel leaves the outcome unknown: send it again with the same idempotencyKey, or list
the alerts before retrying. See Error codes.
Delivery
channels names one or both of IN_APP and TELEGRAM. IN_APP delivers the fired alert to the
notification center as a PRICE_ALERT notification. TELEGRAM sends a direct message to the
Telegram account linked to the user's account. An alert delivered only by Telegram appears in the
notification center only when its Telegram message can't be delivered, for example after Telegram
was unlinked.
Telegram delivery is available on Testnet. Link Telegram before creating or updating an alert that keeps TELEGRAM among its channels. Without a linked
account, the request fails with FAILED_PRECONDITION and TELEGRAM_NOT_LINKED. If Telegram
delivery is disabled, the same requests return TELEGRAM_UNAVAILABLE. To change an alert without
Telegram, set its channels to IN_APP.
Notification center
ListNotifications returns the account's notifications newest first: 25 per page by default, at most 100. Filter by
category (ALERTS or SECURITY), read state, and creation time. nextPageToken is an exclusive
cursor bound to the account and the filters, so reuse it only with the same filters.
Each notification has a type, its category, a plain-text title and text, and a typed detail.
Exactly one detail is set, the one its type names. Show the title and text for a type your client
does not recognize.
A security notification the user does not recognize can mean someone else acts on the account:
for a Telegram type, unlink Telegram and review the account's sessions; for ADMIN_KEY_ACTION,
revoke the admin key and review the account's API keys.
- Read one with
GetNotification. - Count total and unread notifications, by type, with
GetNotificationCounts. - Mark read or unread with
MarkNotificationsReadandMarkNotificationsUnread: 1 to 100 IDs per call. Either every ID is the account's and each is marked, or nothing changes and the call fails withNOTIFICATION_NOT_FOUND.readAtis set while a notification is read. - Mark all read with
MarkAllNotificationsRead, optionally by category. Pass the newest notification you have shown asthroughNotificationId, so one that arrives later stays unread.
There is no streaming channel for notifications. Poll GetNotificationCounts for new unread
notifications, and list when the count changes.
Dust conversion approvals
TelegramApprovalAction.CONVERT_DUST identifies approval to convert dust into one Asset within
Trading. It appears as telegramApproval.action on a TELEGRAM_APPROVAL notification, rather than
as a separate notification type. See Dust conversion.
Rate limits
Alert creates, updates, and cancels, and read-state changes, spend from the ACCOUNT_ADMIN pool.
See Rate limits.