Skip to main content

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

NameTypeRequiredNotes
algoTypestringnoOnly CONDITIONAL (default). Anything else → -1130.
symbolstringyes
sidestringyesBUY / SELL
typestringyesSTOP (alias STOP_LIMIT), STOP_MARKET, TAKE_PROFIT (alias TAKE_PROFIT_LIMIT), TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET
triggerPricestringyesAlias stopPrice accepted. Must be > 0.
pricestringSTOP / TAKE_PROFITLimit price after trigger.
quantitystringunless closePositionBase quantity; converted to USD size using triggerPrice (or activatePrice for trailing).
closePositionboolnoClose the whole position on trigger. Only with STOP_MARKET / TAKE_PROFIT_MARKET; mutually exclusive with quantity and reduceOnly (-1106).
reduceOnlyboolno
positionSidestringnoMust be BOTH if sent (-1130 otherwise).
callbackRatestringTRAILING_STOP_MARKETPercent, 0.110.
activatePricestringnoTrailing activation price; defaults to current mark price.
timeInForcestringnoGTC (default) or GTD with goodTillDate.
goodTillDatelongwith GTDms; must be ≥ 600 s in the future.
workingTypestringnoEchoed; triggers always use mark price.
clientAlgoIdstringnoClient 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
}

algoStatusNEW (active), TRIGGERED, FINISHED (executed), CANCELED, EXPIRED, FAILED.

Errors

HTTPcodemsg
400-1100Bad numeric field, callbackRate out of range, goodTillDate too soon, or engine rejection.
400-1102Missing triggerPrice / price / quantity / callbackRate / goodTillDate.
400-1106closePosition conflicts with quantity / reduceOnly / order type.
400-1121Symbol not tradeable.
400-1130Bad algoType, side, type or positionSide.
400-2010Maximum number of trigger orders reached.
400-2021Would 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.