Skip to main content

Error Codes

Three error envelopes exist. Pick the one that matches the surface you are calling.

FAPI business errors (Binance envelope)​

HTTP/1.1 400 Bad Request
content-type: application/json

{ "code": -2019, "msg": "Margin is insufficient." }
CodeHTTPNameWhen
-1000500UNKNOWNUncategorised error (e.g. DB failure on fundingFeeHistory)
-1001500DISCONNECTEDInternal service error / shard forwarding failed
-1003429TOO_MANY_REQUESTSA request-weight or order-count ceiling was exceeded; see Rate limits. Headers carry the current counts
-1013400INVALID_QUANTITYquantity < lot_size, or notional outside [min_order_size_usd, max_order_size_usd]
-1021400INVALID_TIMESTAMPtimestamp outside the ±60 s window
-1100400ILLEGAL_CHARSUnparseable UUID / quantity / price; bad clientOrderId characters; algo window > 7 days
-1102400MANDATORY_PARAM_EMPTY_OR_MALFORMEDMissing required parameter; side mismatch on modify; unsupported timeInForce; bad batchOrders
-1106400PARAMETER_NOT_REQUIREDquantity + quoteOrderQty together; closePosition conflicts
-1120400INVALID_INTERVALBad kline interval / futures-data period
-1121400INVALID_SYMBOLSymbol not in this deployment's market config
-1125404INVALID_LISTEN_KEYNo active listenKey on PUT /fapi/v1/listenKey
-1130400INVALID_DATA_FOR_PARAMETERUnrecognised side / type / algoType / positionSide
-2010400NEW_ORDER_REJECTEDGTX would match immediately; OI cap exceeded; trigger-order limit reached
-2011400UNKNOWN_ORDEREngine does not hold the order on cancel/modify (never faked as CANCELED)
-2013404NO_SUCH_ORDEROrder does not exist / cannot be modified / not open
-2014400API_KEY_FORMAT (reused)Duplicate newClientOrderId among active orders
-2019400MARGIN_INSUFFICIENTNot enough available balance to freeze margin
-2021400ORDER_WOULD_TRIGGER_IMMEDIATELYTrigger condition already satisfied
-2022400REDUCEONLY_REJECTreduceOnly with no opposite-side position
-4028400INVALID_LEVERAGELeverage outside [1, market max]
-4046400NO_NEED_TO_CHANGE_MARGIN_TYPE (reused)marginType=ISOLATED on FAPI
-4059400NO_NEED_TO_CHANGE_POSITION_SIDE (reused)dualSidePosition=true

FAPI authentication errors (Sparky envelope)​

Key and signature failures come from the auth middleware and use Sparky's ApiResponse envelope, not the Binance one. Most clients only need the HTTP status.

HTTP/1.1 401 Unauthorized
content-type: application/json

{ "success": false, "data": null, "error": { "code": "SIGNATURE_INVALID", "message": "..." }, "timestamp": 1714261234 }
error.codeHTTPWhen
INVALID_API_KEY401X-MBX-APIKEY not found on this deployment
API_KEY_DISABLED401Key status != active
IP_NOT_ALLOWED403Client IP not in the key's whitelist
SIGNATURE_INVALID401HMAC mismatch, missing timestamp, or timestamp outside the window

Native API errors (/api/v1/*)​

{ "error": "Insufficient available balance", "code": "INSUFFICIENT_BALANCE" }

Some handlers use the { "success": false, "error": { "code", "message" } } envelope instead; check the status code first.

CodeMeaning
INVALID_ADDRESSWallet address malformed
TIMESTAMP_EXPIREDLogin / EIP-712 timestamp outside ±5 min
USER_NOT_FOUNDCall the nonce endpoint first
SIGNATURE_INVALID, SIGNATURE_FORMAT_INVALIDEIP-712 signature failed / not 0x-prefixed
INVALID_TOKENJWT missing / expired
LIMIT_REACHED, INVALID_IPAPI-key creation limits
INVALID_SYMBOL, INVALID_LEVERAGE, INVALID_AMOUNT, PRICE_REQUIREDOrder validation
SLIPPAGE_EXCEEDEDMarket order simulated slippage above max_slippage
INSUFFICIENT_BALANCEAvailable balance too low
OI_CAP_EXCEEDEDOrder would exceed the market's per-side OI cap (current, cap, requested_delta in the message)
ORDER_NOT_FOUND, ORDER_NOT_OWNED, ORDER_NOT_CANCELLABLEOrder lookup / cancel
HAS_OPEN_ORDERS, HAS_OPEN_POSITIONS, INVALID_MARGIN_MODEMargin-mode switch preconditions
INVALID_MARKET, ERR_INVALID_PERIOD, ERR_NO_DATA, CIRCUIT_OPEN, PRICE_DATA_UNAVAILABLEMarket-data endpoints

Referral error codes are listed on the Referral overview.

Common pitfalls​

  • SIGNATURE_INVALID on POST/PUT only — you signed the query string but did not append the raw JSON body (or you URL-encoded the body). See Signing.
  • -1021 — check GET /fapi/v1/time; the window is 60 s and recvWindow cannot widen it. Timestamps in the future fail too.
  • INVALID_API_KEY on a key that works elsewhere — keys are per chain; you are talking to a different deployment.
  • -2011 on cancel — the order was already filled/cancelled. Treat as done, then reconcile with GET /fapi/v1/order.
  • -1013 from a float tail — quantities that are not lot multiples are floored, but anything below one lot is rejected; round before sending.