alerts.v1.PriceAlertService
UpdateAlert
UpdateAlert changes an alert's direction, price or channels. A change of direction or price records a new reference price, as creating does. Updating a TRIGGERED alert sets it again: it becomes ACTIVE with a new reference price, even when no field changes; an empty update_mask does only that. An update that changes nothing on an ACTIVE alert returns it unchanged. With an idempotency_key already used for the same request, it returns the alert as it is now and changes nothing: a retried or replayed update never sets the alert again. Errors: - INVALID_ARGUMENT: malformed request or update_mask. - NOT_FOUND: ALERT_NOT_FOUND. - ALREADY_EXISTS: IDEMPOTENCY_CONFLICT. - ABORTED: REVISION_CONFLICT. - FAILED_PRECONDITION: ALERT_CANCELLED, PRICE_SOURCE_UNSUPPORTED, ALERT_LIMIT_REACHED or ALERT_UPDATE_LIMIT_REACHED. - UNAVAILABLE: PRICE_UNAVAILABLE or SERVICE_UNAVAILABLE; retry. - PERMISSION_DENIED: SUBACCOUNT_KEY_REFUSED. - UNAUTHENTICATED: missing or invalid credentials.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/alerts.v1.PriceAlertService/UpdateAlert' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"alertId": "1",
"expectedRevision": "1",
"idempotencyKey": "idem_01J5EXAMPLE0000000000000",
"update": {
"channels": [
"IN_APP"
],
"direction": "ABOVE",
"priceTicks": "61000250000000"
},
"updateMask": {
"paths": [
"value"
]
}
}'Responses
{
"alert": {
"alertId": "1",
"armed": false,
"channels": [
"IN_APP"
],
"createdAt": "2025-01-01T00:00:00Z",
"direction": "ABOVE",
"priceSource": "LAST_PRICE",
"priceTicks": "61000250000000",
"referencePriceTicks": "61000250000000",
"revision": "1",
"status": "ACTIVE",
"symbolId": 1,
"triggeredAt": "2025-01-01T00:00:00Z",
"triggeredPriceTicks": "61000250000000",
"updatedAt": "2025-01-01T00:00:00Z"
},
"outcome": "APPLIED"
}alerts.v1.UpdateAlertRequestalerts.v1.UpdateAlertResponsePublic alert ID.
New price crossing to wait for.
New alert price in quote units scaled by 1e9.
New delivery channels: one to two distinct channels. Replaces the whole list.
The set of field mask paths.
The alert's current revision, from the last read.
Optional client-chosen key, unique per caller, that makes the update idempotent: the same key and request (alert, update and update_mask; expected_revision aside) return the alert in its current state and apply nothing again, even after it fired or changed since; another request with the same key is IDEMPOTENCY_CONFLICT. A key is kept as long as its alert, so a repeat is recognized however late it comes. An alert keeps at most 1,000 keys: an update with a new key beyond that is ALERT_UPDATE_LIMIT_REACHED.
Public alert ID.
Numeric spot market identifier; resolve its symbol with GetSpotConfig.
Price crossing the alert waits for.
Price the alert watches.
Alert price in quote units scaled by 1e9.
Price of price_source when the alert was created or last set again, in quote units scaled by 1e9.
True once the price has been seen on the far side of the alert price, so the next crossing fires the alert. False while an alert created past its alert price waits for the price to move back.
Current state of the alert.
Where the alert is delivered when it fires, in ascending enum order.
Revision of the alert, starting at 1. It increases with every change the caller makes; pass it as expected_revision to UpdateAlert.
When the alert was created.
When the caller last changed the alert.
When the alert fired. Omitted unless status is TRIGGERED.
Price that fired the alert, in quote units scaled by 1e9. Zero unless status is TRIGGERED.
What this call did.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |