Webhook Request Format Reference
The complete Webhook Remote Control request format: every command, parameter, and response code the endpoint accepts, with ready-to-paste examples. For the setup walkthrough, start with Control Bots Remotely with Webhooks.
Webhook Remote Control lets an outside service control your bots and account by sending requests to tradeSteward. One popular source of webhook alerts is TradingView, a technical analysis and charting platform. To use this feature, enable Bot Webhook Controls in Account Settings.
Security
Your Bot Webhook Control Token is a secret key that should be kept confidential. Any application you share it with can open and close trades on your account. To change it, go to Account Settings and click next to your Bot Webhook Control Token.
Do not share your Bot Webhook Control Token with anyone. If you suspect that your token has been compromised, generate a new one immediately.
Commands
Bot commands
The following commands are available for controlling your bots remotely:
- open: opens a new trade for the specified bot
- close_botQuantity: closes a portion of all open trades for the specified bot
- close_botAll: closes all open trades for the specified bot
- close_botAll_disable: closes all open trades for the specified bot and disables the bot
Account commands
The following commands are available for controlling your account remotely:
- close_all: closes all open trades
- trading_pause: pauses opening new automated trades
- webhook_pause: pauses opening new automated trades and webhook entries
- trading_status: gets the current automated trading status
- webhook_status: gets the current automated and webhook trading status
- trading_resume: resumes opening new automated trades
Parameters
The following parameters are used when sending a request to the Webhook Remote Control endpoint:
uId: your account's unique identifiertoken: your Bot Webhook Control Tokencommand: the command to sendbotId: the bot's unique identifierquantity: the quantity of the trade to open, or the portion of the original opened amount to close in percent (0.0-1.0) as a decimal, if required by the command
All of these values are provided under the Webhook Remote Control section of the Bot Settings page.
Usage
The webhook URL is https://api.tradesteward.com/webhook/remote
JSON webhook
Webhook Remote Control accepts JSON documents via POST requests. To send a webhook request, use the following JSON format, replacing the placeholders with your own values; the action field should be one of the commands listed above.
{
"uId":{{YOUR_uId}},
"botId":{{THE_botId}},
"token":{{WEBHOOK_TOKEN}},
"action":{{ACTION}},
"quantity":{{QUANTITY}}
}
Here is an example of a JSON document that closes all open trades for botId abcdefg123Z for uId testUser13:
{
"uId":"testUser13",
"botId":"abcdefg123Z",
"token":"your_random_token_here",
"action":"close_botAll"
}
GET request
Webhook Remote Control also accepts GET requests with the parameters appended to the URL. Here is an example URL:
https://api.tradesteward.com/webhook/remote?uId=testUser13&botId=abcdefg123Z&token=your_random_token_here&action=close_botAll
Responses
Webhook Remote Control responds with different HTTP status codes based on the action and outcome of the request:
Bot commands
- 'open' action:
- Success (201 OK): sent when the bot is successfully launched with the specified quantity.
- Bad Request (400): if the quantity provided is invalid or missing.
- Unauthorized (401): sent if the bot does not have webhook controls enabled or the bot is disabled.
- Bot Parameters Exceeded (402): sent if the bot has reached its maximum concurrent trades, maximum profit targets today, maximum trades today, or maximum stops today.
- Too Many Requests (429): sent if the frequency of 'open' requests exceeds the allowed limit, or one per 300 seconds.
- Internal Server Error (500): if there's an unexpected error while processing the request.
Note: for the protection of your account, bots are limited to one webhook open request per bot every 5 minutes. - 'close_botQuantity' action:
- Success (200 OK): sent when the specified trade quantity is successfully marked to be closed.
- Bad Request (400): if the quantity provided is invalid or missing.
- Unauthorized (401): sent if the bot does not have webhook controls enabled.
- Too Many Requests (429): sent if the frequency of 'close_botQuantity' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'close_botAll' action:
- Success (200 OK): sent when all trades associated with the specified bot are successfully marked to be closed.
- Unauthorized (401): sent if the bot does not have webhook controls enabled.
- Too Many Requests (429): sent if the frequency of 'close_botAll' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'close_botAll_disable' action:
- Success (200 OK): sent when all trades associated with the specified bot are successfully marked to be closed and the bot is disabled.
- Unauthorized (401): sent if the bot does not have webhook controls enabled.
- Too Many Requests (429): sent if the frequency of 'close_botAll_disable' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
Account commands
- 'close_all' action:
- Success (200 OK): sent when all bots associated with the user have been marked to close.
- Bad Request (400): sent if the market is closed.
- Too Many Requests (429): sent if the frequency of 'close_all' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'trading_pause' action:
- Success (200 OK): sent when opening new trades is successfully paused for the user's bots. Does not pause webhook entries.
- Bad Request (400): if the user's bots are already paused.
- Unauthorized (401): if the bots are administratively halted.
- Too Many Requests (429): sent if the frequency of 'trading_pause' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'webhook_pause' action:
- Success (200 OK): sent when opening new trades is successfully paused for the user's bots and webhook entries.
- Bad Request (400): if the user's bots and webhook entries are already paused.
- Unauthorized (401): if the bots are administratively halted.
- Too Many Requests (429): sent if the frequency of 'webhook_pause' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'trading_status' action:
- Success (200 OK): sent along with the current trading status ('true' for running, 'false' for paused, 'HALTED' for administratively halted).
- Too Many Requests (429): sent if the frequency of 'trading_status' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'webhook_status' action:
- Success (200 OK): sent along with the current webhook trading status ('true' for enabled, 'false' for disabled).
- Too Many Requests (429): sent if the frequency of 'webhook_status' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
- 'trading_resume' action:
- Success (200 OK): sent when opening new trades is successfully resumed for the user's bots.
- Bad Request (400): if the bots are already running.
- Unauthorized (401): if the bots are administratively halted.
- Too Many Requests (429): sent if the frequency of 'trading_resume' requests exceeds the allowed limit.
- Internal Server Error (500): if there's an unexpected error while processing the request.
Malformed requests will return a 400 Bad Request status code. Missing or mismatching uId or token will return 403 Forbidden.
Complete HTTP status code reference
The following is a complete list of all HTTP status codes that the Webhook Remote Control endpoint may return:
| Code | Meaning |
|---|---|
| 200 OK | Request was successful (for close operations, status checks, and control commands) |
| 201 OK | Request was successful and a new trade was opened |
| 400 Bad Request | Invalid request parameters, invalid quantity, bot already running, market closed, bots already paused/running, or malformed requests |
| 401 Unauthorized | Bot disabled, webhook controls disabled on bot, or bots administratively halted |
| 402 Bot Parameters Exceeded | Bot has reached maximum concurrent trades, maximum trades today, maximum stops today, or maximum profit targets today |
| 403 Forbidden | Invalid uId or token, or HTTPS not used |
| 404 Not Found | Invalid or non-existent botId |
| 406 Not Acceptable | Invalid or missing required parameters, including uId, token and action |
| 422 Unprocessable Entity | Market is closed (specific bot operations) |
| 429 Too Many Requests | Rate limit exceeded for the specific action |
| 500 Internal Server Error | Unexpected server error while processing the request |