Webhooks keys
A webhook is a mechanism that allows one system to automatically send data or requests to another system via HTTP when a specific event occurs. Webhooks are commonly used for integrating different services and enabling real-time communication between systems without the need for manual actions or periodic requests. Using webhooks, external systems can trigger actions automatically. This approach simplifies system integration, enables automation of workflows, and allows operations to be executed when required. Below in the article you will find the examples of webhooks usage.
The Webhooks keys panel allows the user to generate and manage secret keys used to place trading orders from external systems. Using webhook requests with generated keys allows sending order requests to the TE system without using the User’s login and password.
To open the panel, go to the Accounts -> Webhooks section of the terminal. The panel contains tools for creating webhook keys, viewing existing keys, and deleting them if necessary and has the following view:

The panel contains following elements:
Key name (optional) – text field for specifying a custom name for the webhook key. This field is optional and if left empty the random name will be generated for the key;
Create key – button used to generate a new webhook key. After clicking this button, the system creates a new API key and secret key for webhook trading;
Below there is a table displaying all webhook keys created by the user. It contains the following columns:
Webhook name – displays the name assigned to the webhook key;
Creation date – displays the date when the webhook key was created;
Expiration date – displays the date when the webhook key will expire. If no expiration date is defined then the key will be valid without expiration;
Delete – removes the selected webhook key.
Below the table, the panel also contains the Code snippet section. This section provides example snippets of webhook requests that should be used when configuring external trading systems or automation tools.
The section includes several tabs corresponding to different trading actions, such as Placing, Modifying or Canceling orders. The View API docs link allows users to access more detailed documentation.
By clicking the
button the keys will be generated and the confirmation pop-up containing the newly created webhook credentials will be displayed:

It consists of the following fields:
Name – the name assigned to the webhook key;
API key – the public identifier used for webhook authentication;
Secret key – the private key used together with the API key to authenticate requests;
Webhook URL – the URL that external systems should use to send webhook requests. This URL includes the API key and secret key required for authentication.
The pop-up also provides standard controls:
Show/Hide
– allows temporarily displaying or hiding the key value;
Copy – copies the value to the clipboard.
It’s important to note that after closing this window, the generated keys will no longer be displayed in the terminal!
Webhook trading
To use webhook trading, you need to configure your external system so that it sends an HTTP request to the Webhook URL mentioned in the Webhooks panel. This request must contain a JSON body describing the trading action to be performed. See more detailed instructions below.
Please note that the user must be subscribed to the Trading Webhooks product to use the webhook mechanism.
1. Generate the Webhook keys
Open the “Webhooks keys” panel in the Accounts section and click “Create key” button to generate new API and secret keys:

2. Copy the generated Webhook URL
Use the generated URL in your external system as the destination for webhook requests:

The Webhook URL has the following format:
https://<server-address>/webhook/{apiKey}/{secretKey}
Where:
apiKey – the public identifier;
secretKey – the private key used to authenticate the request.
3. Configure the webhook sending in external system
Let’s consider an example of configuring an alert in TradingView for a specific instrument and condition.
Once the alert is created, enable the option that allows sending a webhook request to the URL when the alert is triggered and specify the Webhook URL mentioned in the Webhooks keys panel. Please note that requests must use the POST method:

4. Configuring the request message
The next step is to configure the request message, which defines the trading action that will be performed when the alert is triggered and the request is sent.
For example, in TradingView, this is done in the “Message” section when creating or editing an alert, where you can insert a JSON-formatted request:

The webhook can perform different operations such as:
Place order;
Modify order;
Cancel order.
Examples of all 3 actions messages and their parameters are below:
Place order
action*
string/body
Action type. Must be "place".
accountName*
string/body
Identifier of the account for which the order is submitted.
symbol*
string/body
Instrument name (uppercase).
symbolType
string/body
Instrument type. Possible values: CRYPTO, EQUITY, EQUITY_CFD, ETF, FIXED_INCOME, FOREX, FUTURES, FUTURES_CFD, OPTIONS, SPREADBET
contractMonth
string/body
Final delivery date. Required for FUTURES, FUTURES_CFD, OPTIONS.
strikePrice
number/body
Strike price. Required for OPTIONS.
strikeType
string/body
Put or Call. Required for OPTIONS.
isin
string/body
ISIN identifier.
type*
string/body
Order type: Market, Stop, Limit, Stop limit, Trailing stop, Care.
price
float/body
Price at which the order should be placed.
stopPrice
float/body
Stop price for the order.
qty*
float/body
Quantity of the order.
side*
string/body
Order side: buy / sell.
cashOrderQty
float/body
Cash quantity of the order.
validity
string/body
Validity type (DAY, GTC, IOC, GTD, FOK, GTS).
expireDate
integer/body
Expiration timestamp in milliseconds (used with GTD).
stopLoss
float/body
Stop loss price.
stopLossType
string/body
Stop loss type (absolute, offset in ticks, tr. offset, offset in %).
takeProfit
float/body
Take profit price.
takeProfitType
string/body
Take profit type (absolute, offset in ticks, offset in %).
trStopOffset
float/body
Trailing stop offset.
userComment
string/body
Additional order comment (Care orders only).
Request body
Response
Modify order
action*
string/body
Action type. Must be "modify".
accountName*
string/body
Identifier of the account for which the order modification is submitted.
orderId*
integer/body
Identifier of the order to be modified.
price
float/body
New price of the order.
stopPrice
float/body
Updated stop price for the order.
qty
float/body
Updated quantity of the order.
validity
string/body
Validity of the order (e.g., DAY, GTC, IOC, GTD, FOK, GTS).
expireDate
integer/body
Expiration timestamp in milliseconds. Used only when the validity type is GTD.
stopLoss
float/body
Updated stop loss price.
stopLossType
string/body
Type of the stop loss (absolute, offset in ticks, tr. offset, offset in %).
takeProfit
float/body
Updated take profit price.
takeProfitType
string/body
Type of the take profit (absolute, offset in ticks, offset in %).
trStopOffset
float/body
Updated trailing stop offset.
userComment
string/body
Additional order comment (Care orders only).
Request body
Response
Cancel order
action*
string/body
Action type. Must be "cancel".
accountName*
string/body
Identifier of the account for which the order is submitted.
orderId*
integer/body
Identifier of the order to cancel.
Request body
Response
As a result, you will receive a status indicating the outcome of the request. The status will be ok if the operation was successful, and error if there was an issue. If an error occurs, a description of the error will be provided in the errmsg field.
5. Order execution
When the alert condition is met, the external system automatically sends the HTTP request to the webhook URL with specified body message.
If the request is valid and the authentication keys are correct, the server processes the request and executes the specified trading action (for example, placing an order):

Last updated