Create Alert

View as Markdown
### Create a market-condition alert for the authenticated user. **Available to:** All authenticated users **Environments:** Demo, Live **[Rate Limit](/api/authentication#request-rate-limits-and-time-penalties):** No endpoint-specific limit Creates an `Alert` owned by the calling user. Supply the alert condition in `expression`; the server parses it before the alert is saved. When parsing succeeds, the alert is created with `status` set to `Active` and the server begins watching for the condition. The response returns the created `alert`, including its assigned `id`, which you use for later [`modifyAlert`](/api/rest-api-endpoints/alerts/modify-alert), [`dismissAlert`](/api/rest-api-endpoints/alerts/dismiss-alert), [`resetAlert`](/api/rest-api-endpoints/alerts/reset-alert), and [`deleteAlert`](/api/rest-api-endpoints/alerts/delete-alert) requests. Request fields: - `expression` (required) — the condition the alert watches for, up to 4096 characters. - `validUntil` — optional expiration time; the alert stops watching after this time. - `triggerLimits` — optional maximum number of times the alert may trigger (0–10). Once `triggeredCounter` reaches this value, the alert stops watching until it is reset. - `message` — optional text (up to 256 characters) delivered with the alert when it triggers. When the `expression` cannot be parsed, the alert is not created and the response carries a non-empty `errorText` describing the parse problem, with no `alert`. **Common Failure Scenarios** - The `expression` is malformed or references an unsupported condition, so it fails to parse. - The `expression` exceeds 4096 characters or `triggerLimits` is outside the 0–10 range. A created alert is never removed by a trigger. To stop an alert, [`dismissAlert`](/api/rest-api-endpoints/alerts/dismiss-alert) sets it to `Inactive`; to re-arm a triggered or failed alert, use [`resetAlert`](/api/rest-api-endpoints/alerts/reset-alert); to remove it, use [`deleteAlert`](/api/rest-api-endpoints/alerts/delete-alert). **Error Messages** | `errorText` | Trigger | |-------------|---------| | Non-empty `errorText` | The request failed; the field describes the reason (most commonly an `expression` that could not be parsed). |

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
expressionstringRequired<=4096 characters
validUntildatetimeOptional
triggerLimitsintegerOptional0-10
messagestringOptional<=256 characters

Response

AlertResponse
errorTextstring<=8192 characters

Non-empty if the request failed

alertobject