Skip to main content

Payload reference

POST /strategy/:strategy_id

Product path (preferred):

POST /strategy/:strategy_id/eq|fut|opt
  • Content-Type: application/json (JSON sent as text/plain is also accepted)
  • URL: copy from Strategy → Config → Webhook URL (includes ?key=…)

Request fields​

FieldTypeRequiredDescription
actionstringyesBUY · SELL · EXIT · EXIT_BUY · EXIT_SELL · MODIFY · FORCE_EXIT · EXIT_ALL
symbolstringyes except flattenRequired for entry, exit, and modify. Optional filter on flatten.
pricenumberyes on entryNumber or numeric string
slnumbernoStop-loss; omit or 0 = none. On MODIFY: new stop
targetnumbernoTarget; omit or 0 = none. On MODIFY: new target
exchangestringnoNSE / BSE / MCX
exchange_segmentstringnoe.g. NSE_EQ, NSE_FNO
security_idnumbernoDhan security id — preferred for F&O
qty / quantitynumbernoAbsolute quantity (overrides Settings)
lotsnumbernoWhole lots (F&O)
is_intradaybooleannoDefault from Settings. false → CNC for equity only
trail_slnumbernoTrailing jump in price points (₹), not percent (Dhan trailingJump). Needs an sl. 0 / omit = off
order_modestringnoLIMIT · MARKET · AUTO
keystringnoNot needed for TradingView. Use ?key= on the URL. Optional for Postman.
order_idstringnoOn MODIFY only: pin a specific Dhan order

Not supported: legs[] (HTTP 400). One contract per request.

Minimal entry​

{
"action": "BUY",
"symbol": "RELIANCE",
"price": 2950.5
}

Entry with SL + target​

{
"action": "BUY",
"symbol": "RELIANCE",
"price": 2950.5,
"sl": 2920,
"target": 3010,
"trail_sl": 0
}

sl / target of 0 means none. Omit qty / lots to use Settings.

Exit​

{
"action": "EXIT",
"symbol": "RELIANCE",
"price": 2980
}

Modify SL / target​

{
"action": "MODIFY",
"symbol": "RELIANCE",
"sl": 2910,
"target": 3050
}

Flatten​

{
"action": "FORCE_EXIT"
}

Optional: "symbol": "RELIANCE". Alias: EXIT_ALL.

Identical buy/sell and exit payloads for the same strategy are deduped for about 1 hour. MODIFY and FORCE_EXIT are not.

Settings that affect webhooks​

SettingEffect
Auto-ExecuteOff = signal only. On = send to Dhan
Capital / lotsSize when JSON omits qty / lots
Order modeWhen JSON omits order_mode
Trade only in market hoursRejects BUY / SELL outside 09:15–15:30 IST Mon–Fri
Square-off timeFlatten open lots at that IST time once per day
Daily profit / lossStops automatic trading for this strategy only

See Force exit & timings. Auth: Authentication.

Errors​

StatusMeaning
400Invalid JSON / missing price on entry / legs[] / target or trail without sl / plain-text not recognized
401Missing or invalid API key — see Authentication
403TradingView off, strategy disabled, outside market hours, or max trades per day
404Strategy or symbol not found / no open position to exit
200 + duplicate: trueSame buy/sell or exit already processed within ~1 hour