API Reference
These docs are for v2.0. Click to read the latest docs for v2.0.1.

API Errors and Reversion Reasons

CodeMessage
1000"Invalid authentication token"
1001"Authentication token is missing"
1002"Authentication token is expired"
1003"Authentication token mismatch"
1015This error code is sent by Cloudflare or AWS WAF when API rate limits are exceeded
2000"Firefly is unavailable in your region"
2001"MANDATORY_PARAM_EMPTY_OR_MALFORMED"
2002"Bad request"
2003"Unauthorized"
2004"Forbidden"
2005"Not found"
2006"Internal Server Error"
2007"Conflict"
2008"Service Unavailable"
2009"This address has not been authorized for access to restricted launch"
2010"Too many requests"
3001"Invalid account address"
3002"Incorrect symbol"
3003"Invalid leverage"
3004"Email already associated with different address."
3005"Faucet unavailable; user already has sufficient balance."
3006"Market(s) not found"
3007"Invalid signature"
3008"Some of auxiliary contract addresses are not valid"
3009"Failed to submit Feedback, due to an invalid email: {email}"
3010"Failed to submit Feedback, due to empty message"
3011"Funding rate not set"
3012"Leverage should be discrete number"
3013"Please conform the asset size to {baseAssetPrecision} and try again"
3014"Expiration time must be in the future."
3016"Incorrect date range"
3017"provide at least one of following value networkId , notificationUrl , rpcUrl , auxiliaryContractsAddresses"
3018"Expiration must be under {days} days."
3019"Quote Asset Precision Invalid. Allowed Precision is {quoteAssetPrecision}"
3020"Market order price should be set to 0."
3021"Max position value allowed at current leverage is {maxAllowedForSelectedLeverage} {quoteSymbol}."
3022"No symbol provided"
3023"No status provided"
3024"config not found"
3025"User does not have margin."
3026"Email or account address is invalid"
3027"Unauthorized email address"
3028"Email address is already linked with an account"
3029"Account is already linked with an email addres"
3030"Account not linked with any of authorized emails"
3031"Referral link already generated"
3032"Account does not exists"
3033"Failed to add Emails, due to an invalid email"
3034"This route is not available on mainnet"
3035"Market {symbol} not found."
3036"Max limit order size allowed is {maxLimitOrderSize} {baseAssetSymbol}"
3037"Max market order size allowed is {maxMarketOrderSize} {baseAssetSymbol}"
3038"Min order size allowed is {minOrderSize} {baseAssetSymbol}"
3039"Max limit order price allowed is {maxOrderPrice}"
3040"Min limit order price allowed is {minOrderPrice}"
3041"Maximum allowed leverage is {maxLeverageAllowed}"
3042"Minimum allowed leverage is 1"
3043"Order Leverage doesn't match with selected leverage"
3044"Maximum open order limit reached."
3045"Order leverage not in bounds."
3046"Something went wrong"
3047"Order Leverage doesn't match with position leverage"
3048"Unknown security name: {security_name}"
3049"Invalid Order Signature"
3050"User not allowed with auth token"
3051"limit {limit} is greater than allowed {allowed}"
3052"limit {limit} is not in range ({min},{max})"
3054"Order already placed."
3055"User does not have sufficient balance."
3056"Order(s) not found."
3057"Order already filled."
3058"Order already cancelled."
3059"Order already in cancelling state."
3060"Invalid order hash {orderHash}"
3061"Maximum reducible quantity exceeded. If you have existing reducing orders, please cancel them first."
3062"The user is not a trader alliance member"
3063"The user is not a trader alliance partner"
3064"Position would be undercollateralized"
3065"The user is not allowed to update leverage due to failed verification"
3066"The user is not allowed to create order due to failed verification"
3067"Please provide market symbol to get parent account's orders, trades or positions"
3068"User is not subaccount for this parent account"
3069"The user is not allowed to update leverage due to open position"
3070"More than 7 days between startTime and endTime."
3071"Invalid interval"
3072"Stop Price not provided or is zero"
3074"Account Value should be > 0 to place stop orders"
3075"Max trigger price allowed is {maxOrderPrice}"
3076"Min trigger price allowed is {minOrderPrice}"
3077"Maximum stop order limit reached."
3078"User is not Affiliate"
3079"Invalid API token"
3080"Orders with orderbookOnly as false are not allowed"
3081"Provided limit parameter is malformed"
3082"startTime must be less than endTime"
3083"There were no userAddresses passed to whitelist as Affiliate"
3084"{market} is delisted"
3085"FOK Orders are not currently supported on Sui"
3086"Market Orders cannot be post only"
3087"Affiliate cannot participate in Open Referral Program"
4000"{exceptionMsg}"
9000"{exceptionMsg}"

Order Cancel Reasons: Rejected by Orderbook

EXPIRED: Order was expired

MARKET_TAKE_BOUND_EXCEEDED: The order was completely cancelled, as none of the maker order it matched against were inside the market take bound requirement

MARKET_TAKE_BOUND_PARTIALLY_EXCEEDED: The order was partially filled, the remainder was cancelled as it was outside of market take bound

ORDER_SIZE_OUT_OF_BOUNDS: Order size was greater or less than the allowed limit

TIF_FAILED: The order was cancelled since it failed the TIF condition

IOC_PARTIAL_CANCEL: The IOC order was partially filled and rest was cancelled since the remainder failed the IOC condition

COULD_NOT_FILL: The market order could not be partially or completely filled

POST_ONLY_FAIL: Post only condition failed

ORDERBOOK_RESET: Order book is being reset

Order Cancel Reasons: On-Chain Reversions

UNDERCOLLATERALIZED: This covers various cases as mentioned below - Can not flip or open new position - Position size can only be reduced - Add margin to avoid liquidation - Trade reduces your Margin Ratio further, when your margin ratio is already below IMR

INVALID_FILL_PRICE: An order did not have the correct fill price

REDUCE_ONLY_FAILED: An order that is marked as Reduce Only does not decrease the user’s position size

MAX_TRADE_PRICE_EXCEEDED: This is caused when the trade price exceeds the maximum trade price allowed for a particular market.

MIN_TRADE_PRICE_CHECK_FAILED: This is caused when the trade price is less than the minimum allowed trade price for a particular market.

MIN_TRADE_QTY_CHECK_FAILED: This is caused when the trade quantity is less than the minimum allowed trade quantity for a particular market.

MARKET_TAKE_BOUND_CHECK_FAILED: This is caused when the trade price is not within market take bounds - Trade price is > Market Take Bound for long side - Trade price is < Market Take Bound for short side

MAKER_QTY_OVERFILL: This is caused when trade quantity is more than that of orders

INVALID_LEVERAGE: This is caused when an order has invalid leverage

TRADING_NOT_STARTED: Occurs when trading has not yet started after deployment of the contracts

NOT_ENOGUH_MARGIN_FOR_FUNDING: Occurs when a trade has an order with an address whose has not enough margin to clear off funding payments due. Add margin before closing

INSUFFICIENT_BALANCE: An account did not have enough balance to execute the order

LOSS_EXCEEDS_MARGIN: Occurs when a trade has an order with an address whose loss exceeds the margin

INVALID_SIGNATURE: This is caused when either the maker or taker order does not have a valid signature.

ORDER_ALREADY_CANCELLED: This is caused when one of the orders involved in trade has been cancelled on the chain

TRADING_NOT_ALLOWED: Occurs guardian has stopped trading on contracts maker does not match trade maker

EXPIRATION_CHECK_FAILED: This is caused when either the maker or taker order is expired

OI_OPEN_EXCEEDS_MAX_ALLOWED_VALUE: This is caused when OI open for an order is greater than max allowed oi open at selected leverage

MAX_QTY_LIMIT_EXCEEDED: This is caused when a limit trade quantity is more than the maximum allowed LIMIT trade quantity for a particular market

MAX_QTY_MARKET_EXCEEDED: This is caused when a market trade quantity is more than the maximum allowed MARKET trade quantity for a particular market

LEVERAGE_CANNOT_BE_ZERO: Occurs when an order in trade has zero leverage

ORDER_QTY_OVERFILL: Occurs when an order in trade has zero leverage

LOSS_EXCEEDS_MARGIN: When the loss on a position exceeds the available margin in that position (includes funding payments as well as position PNL)

SAME_SIDE_ORDERS:Occurs when the order in the trade are both of the same side

TAKER_CAN_NOT_BE_PO: Taker trades cannot be post-only

NOT_ENOUGH_MARGIN_FOR_FUNDING: Occurs when the user does not have enough margin for funding payment

TRADING_NOT_STARTED:Occurs when trades are sent for execution for trade start time for a new market

MAKER_CAN_NOT_BE_IOC:Occurs when the maker order is specified as IOC

UNAUTHORIZED_SENDER:Occurs when the settlement engine is not whitelisted to perform trades

TRIGGER_PRICE_NOT_REACHED: Occurs when the Trigger price has not been reached for the order

TRADE_MAKER_NO_MATCHED: Occurs when an order maker does not match the trade maker

NETWORK_DOWN: There are multiple reasons to receive this error - When the chain is unavailable - The chain did not respond in time - When too many calls are being made to the RPC endpoint

CALL_EXCEPTION: Occurs when there is an unexpected issue with the on-chain transaction