Create Alert
Create an alert for the authenticated user.
Available to: Traders (own alerts)
Environments: Demo, Live
Rate Limit: No endpoint-specific limit
Create an alert owned by the calling user. Put the condition to watch for in expression; the server parses it before saving the alert. When the parse succeeds, the alert is created with status set to Active, the server starts watching the condition, and the response returns the new alert, including the id you pass to later alert calls.
Request fields:
expression(required): the condition the alert watches for, up to 4,096 characters.validUntil: an optional time after which the alert stops watching.triggerLimits: an optional maximum number of times the alert can trigger, from 0 to 9. If you omit it, the alert triggers once.message: optional text (up to 256 characters) for the push notification sent when the alert triggers.
Once an alert has used all its allowed triggers, it stops watching until you re-arm it with resetAlert. To stop an alert without removing it, call dismissAlert. To change it, call modifyAlert; to remove it, call deleteAlert.
Common Failure Scenarios
- The
expressioncan’t be parsed. The alert isn’t created, and the response returnsHTTP 200with the parser’s explanation inerrorTextand noalert. - The
expressionparses but refers to a contract that doesn’t exist, or to an account that doesn’t exist or that you can’t access. The alert is still created (HTTP 200with the newalertand noerrorText), but when the server first checks it, the alert’sstatuschanges toFailed, itsfailureis set to"Access denied", and the server stops watching it. If the account and contract exist but there’s no position, the alert instead staysActive, withfailureset to"No data", and the server keeps watching it. expressionis empty or longer than 4,096 characters,triggerLimitsis outside 0 to 9,messageis longer than 256 characters, orexpressionormessagecontains unsupported characters. These returnHTTP 400.- The alert service is temporarily unavailable. This returns
HTTP 503. - The caller’s user type, or the API key’s permissions, don’t include full access to the
Alertsresource. This returnsHTTP 401with"Access is denied". - Saving the alert fails unexpectedly. This returns
HTTP 200with the reason inerrorText.
This endpoint returns HTTP 200 for both successful and rejected requests, so check the errorText field to confirm the result. Other failures, such as denied access or an invalid request, return their own HTTP status.
Error Messages
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
Response
Non-empty if the request failed