Documentation Index Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/kucoin-api/llms.txt
Use this file to discover all available pages before exploring further.
The SpotClient margin methods provide access to KuCoin’s cross-margin and isolated-margin trading systems. The High-Frequency Margin Order interface (submitHFMarginOrder) is the recommended path for all margin order placement — it operates on the same low-latency engine as HF spot orders and supports both cross-margin and isolated-margin modes via the isIsolated flag. Additional methods cover mark-price feeds, borrowing and repaying funds (V3 API), isolated-margin account queries, risk-limit configuration, and advanced order types including margin stop orders and margin OCO orders. All endpoints require authentication.
Set isIsolated: true on margin order and borrow/repay requests to operate in isolated-margin mode; false (or omitting the flag) uses cross-margin.
HF Margin Orders
submitHFMarginOrder(params)
Places a margin order (cross or isolated) on the HF matching engine. Supports limit and market order types with auto-borrow and auto-repay options. Endpoint: POST api/v3/hf/margin/order — 🔒 Auth requiredsubmitHFMarginOrder ( params : SubmitHFMarginOrderRequest ): Promise < APISuccessResponse < MarginSubmitOrderV3Response >>
Unique client-assigned order ID.
Trading pair, e.g. "BTC-USDT".
"limit" (default) or "market".
true for isolated margin; false (default) for cross margin.
Automatically borrow funds if balance is insufficient.
Automatically repay borrowed funds when the order fills.
Order price (required for limit orders).
Quote funds (for market buy orders).
"GTC", "GTT", "IOC", or "FOK".
Seconds until auto-cancel (GTT strategy only).
Maker-only flag — rejects if order would immediately match.
Hidden order (not visible in the order book).
Iceberg order — only visibleSize is displayed.
Visible quantity for iceberg orders.
Self-trade prevention: "CN", "CO", "CB", or "DC".
import { SpotClient } from 'kucoin-api' ;
const client = new SpotClient ({
apiKey: 'apiKeyHere' ,
apiSecret: 'apiSecretHere' ,
apiPassphrase: 'apiPassPhraseHere' ,
});
const order = await client . submitHFMarginOrder ({
clientOid: 'my-margin-order-001' ,
side: 'buy' ,
symbol: 'BTC-USDT' ,
type: 'limit' ,
price: '60000' ,
size: '0.001' ,
isIsolated: false ,
autoBorrow: true ,
autoRepay: true ,
});
console . log ( 'Margin order ID:' , order . data . orderId );
cancelHFMarginOrder(params)
Cancels a margin HF order by its exchange order ID. Endpoint: DELETE api/v3/hf/margin/orders/{orderId} — 🔒 Auth requiredcancelHFMarginOrder ( params : { orderId: string ; symbol : string }): Promise < APISuccessResponse < { orderId : string } >>
The exchange-assigned order ID to cancel.
The trading pair the order belongs to.
getHFActiveMarginOrders(params?)
Returns all active (unfilled) HF margin orders for a symbol. Filtered by tradeType to distinguish cross vs. isolated margin. Endpoint: GET api/v3/hf/margin/orders/active — 🔒 Auth requiredgetHFActiveMarginOrders ( params : HFMarginRequestOrder ): Promise < APISuccessResponse < HFMarginOrder [] >>
"MARGIN_TRADE" (cross) or "MARGIN_ISOLATED_TRADE" (isolated).
Mark Prices
getMarginMarkPrice(params)
Returns the current mark price for a specific margin trading pair. Endpoint: GET api/v1/mark-price/{symbol}/current — PublicgetMarginMarkPrice ( params : { symbol: string }): Promise < APISuccessResponse < MarginMarkPrice >>
Trading pair, e.g. "BTC-USDT".
const markPrice = await client . getMarginMarkPrice ({ symbol: 'BTC-USDT' });
console . log ( 'Mark price:' , markPrice . data . value );
Returns the current mark prices for all margin trading pairs in a single call. Endpoint: GET api/v3/mark-price/all-symbols — PublicgetMarginMarkPrices (): Promise < APISuccessResponse < MarginMarkPrice [] >>
Margin Config & Risk
Returns global cross-margin configuration: supported currencies, maximum leverage, and enabled features. Endpoint: GET api/v1/margin/config — PublicgetMarginConfigInfo (): Promise < APISuccessResponse < MarginConfigInfo >>
getMarginRiskLimitConfig(params?)
Returns the risk limit and currency configuration for cross or isolated margin accounts. Endpoint: GET api/v3/margin/currencies — 🔒 Auth requiredgetMarginRiskLimitConfig ( params : MarginRiskLimitRequest ): Promise < APISuccessResponse < MarginRiskLimit [] >>
true for isolated margin; false for cross margin.
Filter by isolated-margin symbol (only relevant when isIsolated: true).
Margin Collateral & Inventory
getMarginCollateralRatio(params?)
Returns the collateral ratio for margin currencies. If currencyList is not specified, all currencies are returned. Endpoint: GET api/v3/margin/collateralRatio — PublicgetMarginCollateralRatio ( params ?: GetMarginCollateralRatioRequest ): Promise < APISuccessResponse < MarginCollateralRatioData [] >>
Comma-separated list of currencies to query (e.g. "BTC,ETH"). Returns all currencies if omitted.
getMarketAvailableInventory(params?)
Returns the platform’s available inventory for margin lending, optionally filtered by currency. Endpoint: GET api/v3/margin/available-inventory — PublicgetMarketAvailableInventory ( params ?: { currency? : string }): Promise < APISuccessResponse < MarketAvailableInventoryItem [] >>
Filter by currency ticker (e.g. "USDT").
Borrow & Repay (V3)
getBorrowInterestRate(params?)
Returns the borrowing interest rate for margin currencies at the specified VIP level. Endpoint: GET api/v3/margin/borrowRate — 🔒 Auth requiredgetBorrowInterestRate ( params ?: GetBorrowInterestRateRequest ): Promise < APISuccessResponse < BorrowInterestRate >>
VIP level (0–12). Defaults to the current user’s VIP level if omitted.
Comma-separated list of currencies to query (up to 50).
Initiates a borrow order for cross or isolated margin accounts. Endpoint: POST api/v3/margin/borrow — 🔒 Auth requiredmarginBorrowV3 ( params : MarginBorrowV3Request ): Promise < APISuccessResponse < MarginOrderV3 >>
Currency to borrow, e.g. "USDT".
"IOC" (immediate-or-cancel) or "FOK" (fill-or-kill).
true to use the HF account; false for the standard margin account.
true for isolated margin; false (default) for cross margin.
Isolated-margin symbol (required when isIsolated: true).
TypeScript
JavaScript (CommonJS)
import { SpotClient } from 'kucoin-api' ;
const client = new SpotClient ({
apiKey: 'apiKeyHere' ,
apiSecret: 'apiSecretHere' ,
apiPassphrase: 'apiPassPhraseHere' ,
});
const borrow = await client . marginBorrowV3 ({
currency: 'USDT' ,
size: 100 ,
timeInForce: 'IOC' ,
isHf: false ,
isIsolated: false ,
});
console . log ( 'Borrow order:' , borrow . data . orderNo );
Initiates a repayment for cross or isolated margin borrowed funds. Endpoint: POST api/v3/margin/repay — 🔒 Auth requiredmarginRepayV3 ( params : MarginRepayV3Request ): Promise < APISuccessResponse < MarginOrderV3 >>
true for HF margin account; false for standard margin account.
true for isolated margin; false for cross margin.
Required when isIsolated: true.
getMarginBorrowHistoryV3(params?)
Returns paginated borrow order history for cross and isolated margin accounts. Endpoint: GET api/v3/margin/borrow — 🔒 Auth requiredgetMarginBorrowHistoryV3 ( params : MarginHistoryV3Request ): Promise < APISuccessResponse < MarginBorrowHistoryV3 [] >>
true for isolated; false for cross.
Isolated-margin symbol filter.
Filter by a specific borrow order number.
Start timestamp in milliseconds.
End timestamp in milliseconds.
Items per page (max: 100).
getMarginRepayHistoryV3(params?)
Returns paginated repayment history for cross and isolated margin accounts. Endpoint: GET api/v3/margin/repay — 🔒 Auth requiredgetMarginRepayHistoryV3 ( params : MarginHistoryV3Request ): Promise < APISuccessResponse < MarginRepayHistoryV3 [] >>
Accepts the same query parameters as getMarginBorrowHistoryV3.
getMarginInterestRecordsV3(params?)
Returns paginated interest charge records for cross and isolated margin lending positions. Endpoint: GET api/v3/margin/interest — 🔒 Auth requiredgetMarginInterestRecordsV3 ( params ?: MarginInterestRecordsRequest ): Promise < APISuccessResponse < MarginInterestRecords >>
true for isolated margin; false for cross margin.
Filter by isolated-margin symbol.
Start timestamp in milliseconds.
End timestamp in milliseconds.
Items per page (max: 100).
updateMarginLeverageV3(params)
Updates the leverage multiplier for a cross or isolated margin account. Endpoint: POST api/v3/position/update-user-leverage — 🔒 Auth requiredupdateMarginLeverageV3 ( params : { leverage: string ; symbol ?: string ; isIsolated ?: boolean }): Promise < APISuccessResponse < any >>
New leverage multiplier as a string (e.g. "5").
Trading pair for isolated-margin accounts (e.g. "BTC-USDT").
true for isolated margin; false (default) for cross margin.
Isolated Margin
getIsolatedMarginAccounts(params?)
Returns isolated-margin account details using the legacy V1 endpoint. Deprecated — use getIsolatedMarginBalance() from the Balances section instead. Endpoint: GET api/v1/isolated/accounts — 🔒 Auth requiredgetIsolatedMarginAccounts ( params ?: { balanceCurrency? : 'USDT' | 'KCS' | 'BTC' }): Promise < APISuccessResponse < IsolatedMarginAccountInfo >>
Express balances in this currency: "USDT", "KCS", or "BTC".
Deprecated — use getIsolatedMarginBalance() instead.
getIsolatedMarginAccount(params)
Returns isolated-margin account detail for a specific trading pair using the legacy V1 endpoint. Endpoint: GET api/v1/isolated/account/{symbol} — 🔒 Auth requiredgetIsolatedMarginAccount ( params : { symbol: string }): Promise < APISuccessResponse < SingleIsolatedMarginAccountInfo >>
Trading pair, e.g. "BTC-USDT".
Deprecated — use getIsolatedMarginBalance({ symbol }) instead.
getIsolatedMarginSymbolsConfig(params?)
Returns the symbol configuration for all enabled isolated-margin pairs: leverage, quote currency, and trading status. Endpoint: GET api/v1/isolated/symbols — 🔒 Auth requiredgetIsolatedMarginSymbolsConfig (): Promise < APISuccessResponse < IsolatedMarginSymbolsConfig [] >>
Cross-Margin Active Pairs
getMarginActivePairsV3(params?)
Returns the configuration for cross-margin trading pairs. Optionally filter by symbol. Endpoint: GET api/v3/margin/symbols — 🔒 Auth requiredgetMarginActivePairsV3 ( params ?: { symbol? : string }): Promise < APISuccessResponse < { timestamp : number ; items : MarginActivePairsV3 [] } >>
Filter by trading pair, e.g. "BTC-USDT".
Lending Market (V3)
The lending market endpoints allow you to lend idle funds to margin traders in exchange for interest. Funds must be in the main (funding) account before subscribing.
getLendingCurrencyV3(params?)
Returns information about the currencies available for lending on the margin lending market. Endpoint: GET api/v3/project/list — PublicgetLendingCurrencyV3 ( params ?: { currency? : string }): Promise < APISuccessResponse < LendingCurrencyV3 >>
Filter by currency ticker (e.g. "USDT").
getLendingInterestRateV3(params)
Returns the lending market interest rates for a currency over the past 7 days. Endpoint: GET api/v3/project/marketInterestRate — PublicgetLendingInterestRateV3 ( params : { currency: string }): Promise < APISuccessResponse < { time : string ; marketInterestRate : string }[] >>
Currency ticker (e.g. "USDT").
submitLendingSubscriptionV3(params)
Invests credit in the lending market to earn interest. Funds must be in the main (funding) account. Endpoint: POST api/v3/purchase — 🔒 Auth requiredsubmitLendingSubscriptionV3 ( params : InitiateLendingSubscriptionV3Request ): Promise < APISuccessResponse < { orderNo : string }[] >>
Currency to lend (e.g. "USDT").
Daily interest rate to offer.
updateLendingSubscriptionOrdersV3(params)
Updates the interest rate on an existing lending subscription order. Takes effect at the beginning of the next hour. Endpoint: POST api/v3/lend/purchase/update — 🔒 Auth requiredupdateLendingSubscriptionOrdersV3 ( params : ModifyLendingSubscriptionOrdersV3Request ): Promise < any >
Currency of the subscription order.
Order number of the subscription to modify.
getLendingSubscriptionOrdersV3(params)
Returns paginated lending subscription (purchase) orders. Endpoint: GET api/v3/purchase/orders — 🔒 Auth requiredgetLendingSubscriptionOrdersV3 ( params : GetLendingSubscriptionOrdersV3Request ): Promise < APISuccessResponse < LendingRedemption >>
"DONE" (completed) or "PENDING" (in progress).
Filter by a specific order number.
submitLendingRedemptionV3(params)
Redeems (withdraws) a lending subscription order. Endpoint: POST api/v3/redeem — 🔒 Auth requiredsubmitLendingRedemptionV3 ( params : InitiateLendingRedemptionV3Request ): Promise < APISuccessResponse < { orderNo : string }[] >>
Order number of the subscription to redeem.
getLendingRedemptionOrdersV3(params)
Returns paginated lending redemption orders. Endpoint: GET api/v3/redeem/orders — 🔒 Auth requiredgetLendingRedemptionOrdersV3 ( params : GetLendingRedemptionOrdersV3Request ): Promise < APISuccessResponse < LendingRedemption >>
"DONE" (completed) or "PENDING" (in progress).
Filter by a specific redemption order number.
Margin OCO & Stop Orders
addMarginOcoOrder(params)
Places an OCO (One-Cancels-the-Other) order on the margin trading system (cross or isolated). Endpoint: POST api/v3/hf/margin/oco-order — 🔒 Auth requiredaddMarginOcoOrder ( params : SubmitMarginOcoOrderRequest ): Promise < APISuccessResponse < MarginOcoOrderResponse >>
Trading pair, e.g. "BTC-USDT".
Trigger price for the stop leg.
Limit price after the stop triggers.
Client-assigned order ID.
true for isolated margin; false for cross margin.
Auto-borrow on insufficient balance.
addMarginStopOrder(params)
Places a stop order on the margin trading system. Endpoint: POST api/v3/hf/margin/stop-order — 🔒 Auth requiredaddMarginStopOrder ( params : SubmitMarginStopOrderRequest ): Promise < APISuccessResponse < MarginStopOrderResponse >>
Client-assigned order ID.
true for isolated margin; false for cross margin.
Auto-borrow on insufficient balance.
"limit" (default) or "market".
Limit price (required for limit orders).
"GTC", "GTT", "IOC", or "FOK".
Order note (max 100 characters).
Quote funds for market orders.