Skip to main content
Version: 1.0

Error Codes Reference

All API responses follow a standard format. When an error occurs, the response includes an error code and message.

Response Format

Success Response

{
"code": 0,
"msg": "success",
"data": { }
}

Error Response

{
"code": -1001,
"msg": "Disconnected from server"
}

General Errors (1xxx)

CodeMessageDescriptionSolution
-1000Unknown errorAn unexpected error occurredRetry the request. If persistent, contact support
-1001DisconnectedInternal error; connection droppedRetry the request
-1002UnauthorizedInvalid or expired tokenRefresh your JWT token
-1003Rate limit exceededToo many requestsImplement rate limiting and exponential backoff
-1004Endpoint not foundInvalid API endpointCheck the endpoint URL
-1005Invalid content typeWrong Content-Type headerUse application/json
-1006Unexpected responseServer returned invalid dataRetry; contact support if persistent
-1007TimeoutRequest timed outRetry with longer timeout
-1008Server busyServer temporarily overloadedWait and retry
-1010Error message receivedGeneric errorCheck the msg field for details

Request Errors (11xx)

CodeMessageDescriptionSolution
-1100Illegal charactersRequest contains invalid charactersRemove special characters from parameters
-1101Too many parametersRequest exceeds parameter limitReduce number of parameters
-1102Mandatory parameter missingRequired field not providedInclude all required parameters
-1103Unknown parameterUnrecognized parameter sentRemove invalid parameters
-1104Unread parametersParameters not processedCheck parameter format
-1105Parameter emptyRequired parameter is emptyProvide a value for the parameter
-1106Parameter not requiredSent unnecessary parameterRemove the parameter
-1111Invalid precisionToo many decimal placesReduce decimal precision
-1112No open ordersNo orders exist for the symbolVerify you have open orders
-1114Invalid time in forceUnknown timeInForce valueUse GTC, IOC, FOK, or GTX
-1115Invalid order typeUnknown order typeUse MARKET, LIMIT, STOP, etc.
-1116Invalid sideUnknown order sideUse BUY or SELL
-1117Empty new client order idnewClientOrderId cannot be emptyProvide a valid client order ID
-1118Empty original client order idorigClientOrderId cannot be emptyProvide a valid original order ID
-1119Invalid intervalUnknown kline intervalUse valid intervals (1m, 5m, 1h, etc.)
-1120Invalid symbolUnknown trading symbolCheck available symbols via exchangeinfo
-1121Invalid symbol statusSymbol is not tradingSymbol may be in break or maintenance
-1125Invalid listen keyWebSocket listen key invalidGenerate a new listen key
-1127Lookup interval too largeTime range exceeds limitReduce the time range
-1128Invalid combinationParameter combination invalidCheck parameter requirements
-1130Invalid dataData format invalidVerify data format

Signature Errors (12xx)

CodeMessageDescriptionSolution
-1021Timestamp outside recv windowRequest timestamp too old/newSync your system clock
-1022Invalid signatureSignature verification failedCheck your signing logic

Fixing Signature Errors

  1. Verify timestamp: Must be within 5000ms of server time

    curl http://119.8.50.236:8088/api/gateway/time
  2. Check signature algorithm: Use HMAC-SHA256

  3. Verify parameter order: Parameters must be sorted alphabetically

  4. Check encoding: URL-encode all parameter values


Order Errors (20xx)

CodeMessageDescriptionSolution
-2010Insufficient balanceNot enough marginDeposit funds or reduce order size
-2011Order not foundOrder ID doesn't existVerify the order ID
-2012Order cancelledOrder was already cancelledNo action needed
-2013Order filledOrder was already filledNo action needed
-2014Invalid API key formatAPI key malformedCheck your API key
-2015Invalid order sideSide must be BUY or SELLCorrect the side parameter
-2016No trading windowTrading not allowedMarket may be closed
-2017Order archivedOrder moved to historyQuery history endpoint
-2018Invalid quantityQuantity out of boundsCheck min/max quantity
-2019Invalid pricePrice out of boundsCheck price limits
-2020Invalid stop priceStop price invalidVerify stop price logic
-2021Order would trigger immediatelyStop order price too closeAdjust stop price
-2022Quantity too lowBelow minimum quantityIncrease order quantity
-2023Reduce only rejectedCannot reduce positionCheck position exists
-2024Position side mismatchPosition side doesn't matchCheck hedge mode settings
-2025Position side not matchWrong position sideUse correct position side
-2026Insufficient positionCannot close more than heldReduce close quantity
-2027Order being processedOrder is still processingWait and check status
-2028Order cancel rejectedCannot cancel orderOrder may be filled/cancelled

Position Errors (21xx)

CodeMessageDescriptionSolution
-2100Position mode already setMode already configuredNo change needed
-2101Position mode change failedCannot change position modeClose all positions first
-2102Invalid position sidePosition side invalidUse LONG, SHORT, or BOTH
-2103Position not foundNo position existsVerify symbol and position
-2104Leverage too highExceeds maximum leverageReduce leverage
-2105Leverage too lowBelow minimum leverageIncrease leverage

Margin Errors (22xx)

CodeMessageDescriptionSolution
-2200Margin type already setAlready using this margin typeNo change needed
-2201Cannot change margin typeHas open positionsClose positions first
-2202Insufficient marginNot enough marginAdd more margin
-2203Cannot add marginPosition doesn't existOpen a position first
-2204Cannot remove marginWould cause liquidationRemove less margin

WebSocket Errors (30xx)

CodeMessageDescriptionSolution
-3000WebSocket errorGeneral WebSocket errorReconnect
-3001Invalid messageMalformed messageCheck message format
-3002Invalid methodUnknown methodUse valid methods (SUBSCRIBE, etc.)
-3003Invalid paramsInvalid parametersCheck parameter format
-3004Too many subscriptionsExceeded subscription limitReduce subscriptions
-3005Listen key expiredUser data stream key expiredGenerate new listen key
-3006Connection limitToo many connectionsClose unused connections

HTTP Status Codes

In addition to API error codes, standard HTTP status codes indicate request outcomes:

StatusMeaningDescription
200OKRequest successful
400Bad RequestInvalid request parameters
401UnauthorizedAuthentication failed
403ForbiddenNo permission for this action
404Not FoundEndpoint doesn't exist
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
502Bad GatewayUpstream error
503Service UnavailableService temporarily unavailable
504Gateway TimeoutRequest timeout

Best Practices

Error Handling

import requests

def api_request(endpoint, params=None):
response = requests.get(f"http://119.8.50.236:8088{endpoint}", params=params)
data = response.json()

if data.get("code") != 0:
error_code = data.get("code")
error_msg = data.get("msg")

if error_code == -1003:
# Rate limited - implement backoff
time.sleep(60)
return api_request(endpoint, params)
elif error_code == -1002:
# Token expired - refresh and retry
refresh_token()
return api_request(endpoint, params)
else:
raise Exception(f"API Error {error_code}: {error_msg}")

return data["data"]

Retry Strategy

For transient errors (-1001, -1007, -1008), implement exponential backoff:

import time

def retry_with_backoff(func, max_retries=3):
for attempt in range(max_retries):
try:
return func()
except Exception as e:
if attempt == max_retries - 1:
raise
wait_time = (2 ** attempt) + random.random()
time.sleep(wait_time)