TradingView webhooks
An account's alert URL, receiving alerts, and the delivery log.
How to set alerts up is in TradingView alerts. These are the
endpoints behind it. Managing a webhook needs a trade key or a member who can trade.
GET /v1/accounts/:id/webhook
The account's webhook: { "webhook": { "enabled": true, "url": "https://api.orderfill.trade/v1/hooks/tv/of_wh_…", "example": { … } } }.
{ "enabled": false, "url": null } until it is turned on.
POST /v1/accounts/:id/webhook/rotate
Turn the webhook on, or replace its URL. The old URL stops working at once.
DELETE /v1/accounts/:id/webhook
Turn it off. Alerts sent to the old URL answer 404.
POST /v1/hooks/tv/:token
Where TradingView sends the alert. No key: the token in the URL is the credential. The body is the alert message, as JSON:
{ "id": "{{ticker}}-{{timenow}}", "action": "buy", "symbol": "XAUUSD", "volume": 0.1, "sl": 2395 }
action is buy, sell, buy_limit, sell_limit, buy_stop, sell_stop, modify,
close or close_all. It answers 202 at once and places the order straight after. The
same id twice trades once.
| Answer | Means |
|---|---|
202 | Received; the order is being placed. |
400 | The message could not be read. It is still logged, with why. |
403 | Not from TradingView's addresses, or the webhook is off. |
404 | No such webhook. |
429 | Too many orders on this account right now. |
GET /v1/accounts/:id/webhook/deliveries
The last alerts this account received, newest first, each with what the broker said:
status (received, executing, filled, failed, rejected), the order result,
any error, and latencyMs from receipt to the broker's answer.
GET /v1/webhooks/deliveries
The same log across every account in your team.