Skip to Content
EnDocs
Trading API
Error Codes

Error Codes

Scope

Instruction mode, order mode, and other ToB trading endpoints share the same error_code set.

Error Handling Flow

  • All endpoints follow the same error code format. Errors differ only in the error_code and message returned.
  • Implement error handling in the following order:
  1. Check if the HTTP statusCode equals 200. If not, display an error immediately.
  2. Check if status in the response equals 0. If 0, parse data. If 1, the request failed — proceed to the next step.
  3. Match error_code against the list below and handle accordingly. Fall back to 80000 for any unrecognized error_code.

Error Code List

Error CodeDescription
80000Internal error; contact us for troubleshooting or retry.
80001Insufficient token balance.
80002Transaction amount below minimum.
80003Transaction amount above maximum.
80004Order expired.
80005Insufficient liquidity; transaction cannot be completed at this time.
80006Illegal request (invalid format, missing required fields, or value out of range).
80007Partner not found or invalid.
80008Reverse quote calculation did not converge (PayFi Swap minAmountOut mode only).
80009Failed to get token info (token does not exist or service error).
80010Failed to get token price or gas price.
80011Failed to generate transaction calldata (PayFi Swap only).
80012Quote failed (no quote available, all markets failed, etc.).
80013Unsupported chain (chain config missing or no available market).
80014Order not found (Order mode; for checkOrdersFee, any invalid orderId fails the entire request).
80015Order already submitted; do not resubmit (Order mode only).
80016Insufficient native coin balance to pay Gas fees.
80017NoGas feature is not available for this transaction.
80018Invalid fee rate (must be 0 or 0.001–0.02).
80019Market not allowed for this partner.
80020Quote value deviation exceeds threshold (output value is too low relative to input).
80021NoGas minimum threshold not met.
80022Risk check failed.

Error Response Example

{ "status": 1, "error_code": 80000, "data": null, "msg": "system err", "title": "", "timestamp": 1769580545990, "trace": "Root=1-6979a801-6ba8a7696bc0d4256c5b603c" }
Last updated on