> For the complete documentation index, see [llms.txt](https://guide.traderevolution.com/traderevolution-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.traderevolution.com/traderevolution-api/traderevolution-apis/client-api/alerts.md).

# Alerts

This API part grants access to alert management

This section includes endpoints for retrieving, creating, modifying, deleting, and managing price alerts across all user accounts.

## Get alerts

<mark style="color:blue;">`GET`</mark>`/traderevolution/v1/alerts`

This method returns active alerts created for the authenticated user. The response may include alerts from all user accounts or can be filtered by the specified account, instrument, or alert identifier. If no filters are provided, all active alerts available to the authenticated user are returned.&#x20;

No pagination is used for this request. All matching active alerts are returned in a single response.

**Query**

**Path/Body**

| Name                   | Type    | Description                                          |
| ---------------------- | ------- | ---------------------------------------------------- |
| `accountId`            | integer | Allows to filter alerts by specific trading Account. |
| `tradableInstrumentId` | integer | Allows to filter alerts by specific Instrument.      |
| `alertId`              | integer | Allows retrieving specific Alerts by ID.             |

**CURL**

{% code overflow="wrap" %}

```json
curl -X GET "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts?accountId=3243563&tradableInstrumentId=922" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mYTNlLTRmYjAtOWQyYy1kYzBhNgE3ZjZjZmEiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJpcnluYW0iLC…JsHYjPIj5PAuFXlzyiFJmw3IPkVU9vZozv5l_KVkEUpTDhfgARcghbgStPXkB1Ij81CN5b0twVV
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok",
  "d": {
    "alerts": [
      {
        "alertId": 1001,
        "accountId": 3243563,
        "tradableInstrumentId": 922,
        "instrumentName": "EUR/USD",
        "alertType": "bid",
        "condition": "greater_or_equal",
        "value": 1.105,
        "importance": "high",
        "afterExecute": "remove",
        "action": "notify",
        "notificationType": [
          3,
          4
        ],
        "alertMessage": "EUR/USD reached target price",
        "expiration": 1735689600000,
        "orderParameters": {
          "side": "buy",
          "type": "market",
          "qty": 1,
          "cashOrderQty": 0,
          "validity": "DAY",
          "expireDate": 0,
          "price": 0,
          "stopPrice": 0,
          "stopLoss": 1.1,
          "stopLossType": "absolute",
          "takeProfit": 1.11,
          "takeProfitType": "absolute",
          "trStopOffset": 0,
          "userComment": "Price alert",
          "overnightExecution": true
        }
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

As a result, you will get a data object containing the **alerts** array. Each object contains complete information about an alert, including its identifier, account and instrument information, trigger conditions, notification settings, expiration time, and order parameters if the alert is configured to place an order after being triggered.

The *notificationType* field contains an array of notification type constants. Values **1** and **2** represent client-side custom actions that can be implemented by third-party applications, while values **3** and **4** correspond to email and push notifications sent from server.

{% hint style="warning" %}
All time parameters are presented as Unix timestamps in milliseconds. Standard errors can be received as well. If no alerts match the specified filters, an empty **alerts** array will be returned.
{% endhint %}

## Create alert

<mark style="color:green;">`POST`</mark>`/traderevolution/v1/alerts`

This method is used to create a new alert for the specified trading account. Note that the request includes a body in the JSON format. The table below describes the parameters available for alert creation. The request body example is included as well.

**Body**

<table><thead><tr><th width="249">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>accountId*</code></td><td>integer</td><td>This parameter specifies the identifier of the account for which the alert is created.</td></tr><tr><td><code>tradableInstrumentId*</code></td><td>integer</td><td>This parameter specifies the identifier of the Instrument for which the alert is created.</td></tr><tr><td><code>alertType*</code></td><td>string</td><td>Allows specifying the type of the alert. Possible values are:  <em>bid</em>, <em>ask</em>, <em>last</em>, <em>change_percent</em>, <em>volume</em>. </td></tr><tr><td><code>condition*</code></td><td>string</td><td>Allows specifying the condition type for the alert. Possible values are:  <em>greater</em>, less, <em>greater_or_equal</em>, <em>less_or_equal.</em></td></tr><tr><td><code>value*</code></td><td>float</td><td>Price value where the alert wil be set.</td></tr><tr><td><code>importance</code></td><td>string</td><td>Allows specifying the importance of the alert. Possible values are: <em>high</em>, <em>medium</em>, <em>low</em>. Medium by default.</td></tr><tr><td><code>afterExecute</code></td><td>string</td><td>Allows specifying the behaviour after the execution. Possible values are: <em>stop</em>, <em>remove</em>. Remove by default.</td></tr><tr><td><code>action*</code></td><td>string</td><td>Allows specifying the action that will be done after the alert execution. Possible values are: <em>notify</em>, <em>place_order_and_notify</em>.</td></tr><tr><td><code>notificationType*</code></td><td>array/integer</td><td>Notification types for the alert. Possible values: <br>1 - custom 1;<br>2 - custom 2;<br>3 - email;<br>4 - push.</td></tr><tr><td><code>alertMessage</code></td><td>string</td><td>Custom alert message. If not specified, it will be generated automatically.</td></tr><tr><td><code>expiration</code></td><td>integer</td><td>Alert expiration time in Unix timestamp format (milliseconds).</td></tr><tr><td><code>orderParameters</code></td><td>object</td><td>Order parameters used for orders creation when <code>action</code> is set to <em>place_order_and_notify</em>. The parameters available to specify can be found <a href="https://guide.traderevolution.com/traderevolution-api/traderevolution-apis/client-api/trading#submit-order">here</a>.</td></tr></tbody></table>

**Request body example**

```json
{
  "accountId": 3243563,
  "tradableInstrumentId": 922,
  "alertType": "bid",
  "condition": "greater_or_equal",
  "value": 1.105,
  "importance": "high",
  "afterExecute": "remove",
  "action": "notify",
  "notificationType": [
    3,
    4
  ],
  "alertMessage": "EUR/USD reached target price",
  "expiration": 1735689600000
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X POST "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mYTNlLTRmYjAt...ANvtqQ92fTM_1EIGdm2fr4ZrL5omdKvojmrf2eR9fWSz6eZwllr-P1QvhwlG62LECoFL1kCm2gH5x_EcHV5Ff6ZwX5NDXgXL1t8MQUemeysdwIkxcM5i4YERR8s16UQ" \
-H "Content-Type: application/json" \
-d "{ \"accountId\": 3243563, \"tradableInstrumentId\": 922, \"alertType\": \"bid\", \"condition\": \"greater_or_equal\", \"value\": 1.105, \"importance\": \"high\", \"afterExecute\": \"remove\", \"action\": \"notify\", \"notificationType\": [3,4], \"alertMessage\": \"EUR/USD reached target price\", \"expiration\": 1735689600000 }"
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok",
  "d": {
    "alertId": 1001,
    "accountId": 3243563,
    "tradableInstrumentId": 922,
    "instrumentName": "EUR/USD",
    "alertType": "bid",
    "condition": "greater_or_equal",
    "value": 1.105,
    "importance": "high",
    "afterExecute": "remove",
    "action": "notify",
    "notificationType": [
      3,
      4
    ],
    "alertMessage": "EUR/USD reached target price",
    "expiration": 1735689600000,
    "orderParameters": {}
  }
}
```

{% endtab %}
{% endtabs %}

The response returns the created alert with all of its parameters, including the generated *alertId* that should be used for subsequent alert operations such as modification or deletion.

{% hint style="warning" %}
If the *alertMessage* parameter is omitted, it will be generated automatically by the server using the following format:

`Alert: {instrumentName} {alertType} {condition} {value}`
{% endhint %}

Also note that if the alert `action` is set to *place\_order\_and\_notify*, the `orderParameters` object is required and must contain valid order parameters according to the same validation rules as the <mark style="color:green;">`POST`</mark>`/traderevolution/v1/accounts/{accountId}/orders` request. Standard errors can be received as well.

## Modify alert

<mark style="color:yellow;">`PATCH`</mark>`/traderevolution/v1/alerts/{alertId}`

This method is used to modify an existing alert. The request includes a body in the JSON format. The table below describes the parameters that can be updated. All request body parameters are optional, and only the provided fields will be modified.

**Path/Body**

<table><thead><tr><th width="263">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>alertId*</code></td><td>integer/path</td><td>This parameter specifies the identifier of the alert to be modified.</td></tr><tr><td><code>tradableInstrumentId</code></td><td>integer</td><td>This parameter specifies the identifier of the Instrument for which the alert is modified.</td></tr><tr><td><code>alertType</code></td><td>string</td><td>Allows specifying the condition type for the alert. Possible values are:  <em>greater</em>, less, <em>greater_or_equal</em>, <em>less_or_equal.</em></td></tr><tr><td><code>condition</code></td><td>string</td><td>Quantity of the order. </td></tr><tr><td><code>value</code></td><td>float</td><td>Price value where the alert wil be set.</td></tr><tr><td><code>importance</code></td><td>string</td><td>Allows specifying the importance of the alert. Possible values are: <em>high</em>, <em>medium</em>, <em>low</em>. Medium by default.</td></tr><tr><td><code>afterExecute</code></td><td>string</td><td>Allows specifying the behaviour after the execution. Possible values are: <em>stop</em>, <em>remove</em>. Remove by default.</td></tr><tr><td><code>action</code></td><td>string</td><td>Allows specifying the action that will be done after the alert execution. Possible values are: <em>notify</em>, <em>place_order_and_notify</em>.</td></tr><tr><td><code>notificationType</code></td><td>array/integer</td><td>Notification types for the alert. Possible values: <br>1 - custom 1;<br>2 - custom 2;<br>3 - email;<br>4 - push.</td></tr><tr><td><code>alertMessage</code></td><td>string</td><td>Custom alert message. If not specified, it will be generated automatically.</td></tr><tr><td><code>expiration</code></td><td>integer</td><td>Alert expiration time in Unix timestamp format (milliseconds).</td></tr><tr><td><code>orderParameters</code></td><td>object</td><td>Order parameters used for orders creation when <code>action</code> is set to <em>place_order_and_notify</em>. The parameters available to specify can be found <a href="https://guide.traderevolution.com/traderevolution-api/traderevolution-apis/client-api/trading#submit-order">here</a>.</td></tr></tbody></table>

**Request body example**

```json
{
  "condition": "greater_or_equal",
  "value": 1.11,
  "importance": "medium",
  "notificationType": [
    3,
    4
  ],
  "alertMessage": "EUR/USD reached updated target price",
  "expiration": 1738281600000
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X PATCH "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts/1001" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mYTNlLTRmYjAt...ANvtqQ92fTM_1EIGdm2fr4ZrL5omdKvojmrf2eR9fWSz6eZwllr-P1QvhwlG62LECoFL1kCm2gH5x_EcHV5Ff6ZwX5NDXgXL1t8MQUemeysdwIkxcM5i4YERR8s16UQ" \
-H "Content-Type: application/json" \
-d "{ \"condition\": \"greater_or_equal\", \"value\": 1.11, \"importance\": \"medium\", \"notificationType\": [3,4], \"alertMessage\": \"EUR/USD reached updated target price\", \"expiration\": 1738281600000 }"
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok",
  "d": {
    "alertId": 1001,
    "accountId": 3243563,
    "tradableInstrumentId": 922,
    "instrumentName": "EUR/USD",
    "alertType": "bid",
    "condition": "greater_or_equal",
    "value": 1.11,
    "importance": "medium",
    "afterExecute": "remove",
    "action": "notify",
    "notificationType": [
      3,
      4
    ],
    "alertMessage": "EUR/USD reached updated target price",
    "expiration": 1738281600000,
    "orderParameters": {}
  }
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive the updated alert object containing all current alert parameters.

Only the fields specified in the request body will be updated and all other alert properties remain unchanged. Standard errors can be received as well.

## Delete alert

<mark style="color:red;">`DELETE`</mark>`/traderevolution/v1/alerts/{alertId}`

This method is used to delete an existing alert. Note that this method requires only one parameter - *alertId*.

**Path**

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| `alertId*` | integer | This parameter specifies the identifier of the alert that should be deleted. |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts/1001" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1lMDM4LTRlNmYtOT..."
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful. Standart errors can be recieved as well.

## Start alert

<mark style="color:green;">`POST`</mark>`/traderevolution/v1/alerts/{alertId}/start`

This method is used to activate (start) an existing alert. Note that this method requires only one parameter - alertId.

**Path**

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| `alertId*` | integer | This parameter specifies the identifier of the alert that should be started. |

**CURL**

{% code overflow="wrap" %}

```json
curl -X POST "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts/1001/start" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1lMDM4LTRlNmYtOT..."
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok",
  "d": {
    "alertId": 1001,
    "status": "active"
  }
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive the updated alert status. The *status* field will be *active* if the alert has been started successfully. Standard errors can be received as well.

## Stop alert

<mark style="color:green;">`POST`</mark>`/traderevolution/v1/alerts/{alertId}/stop`

This method is used to deactivate (stop) an existing alert. Note that this method requires only one parameter - alertId.

**Path**

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| `alertId*` | integer | This parameter specifies the identifier of the alert that should be stopped. |

**CURL**

{% code overflow="wrap" %}

```json
curl -X POST "https://sandbox-api.traderevolution.com/traderevolution/v1/alerts/1001/stop" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1lMDM4LTRlNmYtOT..."
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "s": "ok",
  "d": {
    "alertId": 1001,
    "status": "not_active"
  }
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive the updated alert status. The *status* field will be *not\_active* if the alert has been stopped successfully. Standard errors can be received as well.
