Skip to main content

Error Codes


HTTP Status Codes​

All API responses return a standard HTTP status code. Treat any non-200 response as an error.

CodeMeaningWhat to do
200SuccessParse the response body for your data
400Bad Request β€” invalid or missing parametersCheck request params against the endpoint spec
401Unauthorized β€” missing or invalid credentialsVerify API key, nonce freshness, and signature
403Forbidden β€” insufficient permissionCheck your API key has the required permission level
404Not Found β€” resource does not existVerify the endpoint path and any IDs
405Method Not Allowed β€” wrong HTTP methodUse the correct method (GET/POST/PUT/DELETE)
408Request Timeout β€” exceeded 30 secondsRetry once; if persistent, check server status
429Too Many Requests β€” rate limit exceededBack off and retry after Retry-After header value
451Unavailable For Legal Reasons β€” account bannedContact support
500Internal Server ErrorRetry with backoff; report if persistent

Error Response Format​

Non-200 responses return a JSON body:

{
"status": 400,
"error": "Bad Request",
"code": 301,
"message": "Invalid order size"
}
FieldDescription
statusHTTP status code
errorHTTP status text
codeInternal error code (see API Status Enum below)
messageHuman-readable error description

Handling 429 (Rate Limit)​

When rate-limited, the response includes a Retry-After header indicating the number of seconds to wait before retrying (RFC 7231 Β§7.1.3):

HTTP/1.1 429 Too Many Requests
Retry-After: 60

Strategy: Parse the Retry-After value as an integer number of seconds, wait that long, then resume. Standard HTTP client libraries (urllib3.Retry, axios-retry, OkHttp) handle this automatically. Do not retry immediately β€” repeated violations trigger escalating blocks (1s β†’ 5min β†’ 15min). See Authentication β†’ Rate Limits.

Handling 401 (Unauthorized)​

Common causes:

  • Wrong nonce β€” the nonce must be the current UTC time in milliseconds. Clock drift > a few seconds causes rejection.
  • Wrong signature β€” the signing input is path + nonce + body with no separators. Verify the concatenation.
  • Body mismatch β€” the body you sign must be identical to the body you send. Watch for JSON key ordering if your language reorders keys.

Common Error Strings β†’ Likely Cause​

The error message field is often opaque on its own. Use this table to map the literal string the API returned to the most common root cause, ordered by frequency.

Error string in responseStatusMost likely causeWhat to check first
api parameter is mandatory401Wrong header names. The required headers are request-api, request-nonce, request-sign β€” not X-BTSE-APIKEY, BTSE-API-KEY, etc.Header names match the Authentication spec exactly, lowercase, hyphen-separated.
Authentication Failed (code 10002)401Signature payload mismatch. The string you hashed is not what the server reconstructed.The signed urlpath excludes any query string; the body you signed is byte-identical to the body sent. See the Signed Request Walkthrough.
Signature verification failed401Same as above β€” query string included in the signed urlpath, or body re-serialized between signing and sending.Print the exact bytes passed to HMAC, compare with the spec.
Invalid nonce / nonce reuse401Clock drift or reused nonce. Nonce must be current UTC in milliseconds, monotonically increasing per API key.Use time.time() * 1000 (Python) / Date.now() (JS). NTP-sync your machine if drift > a few seconds.
Invalid request parameters (code -2)400Unknown symbol, malformed walletName, missing required param.Diff your request against the endpoint's spec page.
Invalid order size (code 301)400Size below the symbol's minimum or above the maximum.Check minOrderSize / maxOrderSize from /api/v3.3/market_summary (Spot) or the Futures market info endpoint.
Invalid order price (code 302)400Price outside the contract's tick-size grid, or price filter (PRICE_FILTER).Round price to the symbol's tick size before submitting.
Maximum open orders exceeded (code 304)400Per-user or per-symbol open-order limit reached.Cancel stale orders or use cancelAllAfter (dead-man's switch).
Order not found (code 16)404The orderID / clOrderID doesn't match any active or recent order.Verify the ID. After 24h cancelled/filled orders may no longer be queryable by ID β€” use trade-history endpoints instead.
Insufficient balance (code 8)400Wallet balance below required amount including fees.Check available (not total) balance, account for fees and any open orders that already reserve funds.
Rate limit exceeded (code 303)429API rate limit tier triggered.See Authentication β†’ Rate Limits. Back off using Retry-After.
Account is undergoing liquidation (code 64)400Futures account in liquidation β€” new orders blocked.Wait for liquidation to complete; query position status.
Order is undergoing auto-deleveraging (code 1004)400Position selected for ADL β€” cannot amend/cancel.Position will be force-reduced; monitor via WebSocket notifications.

Tip for AI/agent integrations: when you encounter an error string that isn't in this table, paste the literal message field into a search of this file before assuming it's a new bug. Most "weird" BTSE errors are one of the rows above, surfaced with slightly different wording.


API Status Enum​

Internal numeric status codes appear in order and WebSocket response payloads.

CodeConstantDescription
-2INVALID_REQUESTInvalid request parameters (e.g. unknown symbol, malformed walletName)
-1TIMEOUTRequest timed out β€” verify order status separately
1MARKET_UNAVAILABLEFutures market is unavailable
2ORDER_INSERTEDOrder inserted successfully
4ORDER_FULLY_TRANSACTEDOrder fully filled
5ORDER_PARTIALLY_TRANSACTEDOrder partially filled
6ORDER_CANCELLEDOrder cancelled successfully
7ORDER_REFUNDEDOrder refunded
8INSUFFICIENT_BALANCEInsufficient account balance
9TRIGGER_INSERTEDTrigger order inserted successfully
10TRIGGER_ACTIVATEDTrigger order activated
11ERROR_INVALID_CURRENCYInvalid currency specified
12ERROR_UPDATE_RISK_LIMITError updating risk limit
13ERROR_INVALID_LEVERAGEInvalid leverage value
15ORDER_REJECTEDOrder rejected
16ORDER_NOTFOUNDOrder not found by the provided orderID or clOrderID
17REQUEST_FAILEDRequest failed β€” verify order status
20SUCCESSAction completed successfully
21FREEZE_SUCCESSFULFreeze action succeeded
27TRANSFER_SUCCESSFULFunds transferred between futures and spot successfully
28TRANSFER_UNSUCCESSFULTransfer between spot and futures failed
29QUERY_GET_ORDERSResponse to a get-orders query
31QUERY_GET_POSITIONSResponse to a get-positions query
33QUERY_GET_ALL_POSITIONS_ORDERSResponse to a get-all-positions-orders query
34QUERY_WALLETResponse to a wallet query
36QUERY_FUTURES_MARGINResponse to a futures-margin query
41ERROR_INVALID_RISK_LIMITInvalid risk limit specified
51QUERY_GET_ORDERS_WITH_LIMITResponse to a paginated get-orders query (with limit)
64STATUS_LIQUIDATIONAccount is undergoing liquidation
65STATUS_ACTIVEOrder is active
66MODE_BUYBuy side
76ORDER_TYPE_LIMITLimit order
77ORDER_TYPE_MARKETMarket order
80ORDER_TYPE_PEGPeg / Algo order
81ORDER_TYPE_OTCOTC order
83MODE_SELLSell side
85STATUS_PROCESSINGOrder is processing
88STATUS_INACTIVEOrder is inactive
101FUTURES_ORDER_PRICE_OUTSIDE_LIQUIDATION_PRICEFutures order price is outside liquidation price
110FUTURES_FUNDINGFutures funding event
123AMEND_ORDEROrder amended successfully
124UNFREEZE_SUCCESSFULUnfreeze action succeeded
300ERROR_MAX_ORDER_SIZE_EXCEEDEDOrder size exceeds the maximum allowed
301ERROR_INVALID_ORDER_SIZEInvalid order size
302ERROR_INVALID_ORDER_PRICEInvalid order price
303ERROR_RATE_LIMITS_EXCEEDEDRate limit exceeded
304ERROR_MAX_OPEN_ORDER_EXCEEDEDMaximum open orders exceeded
1003ORDER_LIQUIDATIONOrder is undergoing liquidation
1004ORDER_ADLOrder is undergoing auto-deleveraging (ADL)
30410BLOCK_TRADE_COMPLETE_SUCCESSBlock trade completed successfully