New Algo Order
Type: TRADE
Weight: 1
POST /fapi/v1/algoOrder
Place a conditional order (stop, take-profit or trailing stop). Binance-compatible request/response shape.
Algo (conditional) orders are stored as trigger orders and executed by a keeper when the trigger condition is met against mark price. They share the engine with the web app's TP/SL feature. algoId is an integer; clientAlgoId is your optional idempotency key.
Request
POST /fapi/v1/algoOrder?timestamp=<ms>&signature=<hex>
Content-Type: application/json
Body params
| Name | Type | Required | Notes |
|---|---|---|---|
algoType | string | no | Only CONDITIONAL (default). Anything else → -1130. |
symbol | string | yes | |
side | string | yes | BUY / SELL |
type | string | yes | STOP (alias STOP_LIMIT), STOP_MARKET, TAKE_PROFIT (alias TAKE_PROFIT_LIMIT), TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET |
triggerPrice | string | yes | Alias stopPrice accepted. Must be > 0. |
price | string | STOP / TAKE_PROFIT | Limit price after trigger. |
quantity | string | unless closePosition | Base quantity; converted to USD size using triggerPrice (or activatePrice for trailing). |
closePosition | bool | no | Close the whole position on trigger. Only with STOP_MARKET / TAKE_PROFIT_MARKET; mutually exclusive with quantity and reduceOnly (-1106). |
reduceOnly | bool | no | |
positionSide | string | no | Must be BOTH if sent (-1130 otherwise). |
callbackRate | string | TRAILING_STOP_MARKET | Percent, 0.1–10. |
activatePrice | string | no | Trailing activation price; defaults to current mark price. |
timeInForce | string | no | GTC (default) or GTD with goodTillDate. |
goodTillDate | long | with GTD | ms; must be ≥ 600 s in the future. |
workingType | string | no | Echoed; triggers always use mark price. |
clientAlgoId | string | no | Client id. |
Response — 200
{
"algoId": 12345,
"clientAlgoId": "my-stop-1",
"algoType": "CONDITIONAL",
"orderType": "STOP_MARKET",
"symbol": "BTCUSDT",
"side": "SELL",
"positionSide": "BOTH",
"timeInForce": "GTC",
"quantity": "0.010",
"algoStatus": "NEW",
"triggerPrice": "58000.00",
"price": "0",
"closePosition": false,
"priceProtect": false,
"reduceOnly": true,
"activatePrice": null,
"callbackRate": null,
"workingType": "CONTRACT_PRICE",
"createTime": 1714261234567,
"updateTime": 1714261234567,
"triggerTime": 0,
"goodTillDate": 0
}
algoStatus ∈ NEW (active), TRIGGERED, FINISHED (executed), CANCELED, EXPIRED, FAILED.
Errors
| HTTP | code | msg |
|---|---|---|
400 | -1100 | Bad numeric field, callbackRate out of range, goodTillDate too soon, or engine rejection. |
400 | -1102 | Missing triggerPrice / price / quantity / callbackRate / goodTillDate. |
400 | -1106 | closePosition conflicts with quantity / reduceOnly / order type. |
400 | -1121 | Symbol not tradeable. |
400 | -1130 | Bad algoType, side, type or positionSide. |
400 | -2010 | Maximum number of trigger orders reached. |
400 | -2021 | Would trigger immediately. |
Authentication failures (INVALID_API_KEY, API_KEY_DISABLED, IP_NOT_ALLOWED, SIGNATURE_INVALID) apply to every signed endpoint and use Sparky's {"success":false,"error":{...}} envelope; see Error Codes.