Skip to main content

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.

BrokerClient is the dedicated REST client for KuCoin’s Non-Disclosure (ND) Broker API. It lets broker partners programmatically create and manage sub-accounts under their broker umbrella, issue and rotate API keys for those sub-accounts, move funds between the broker master account and its sub-accounts, track deposit and withdrawal activity, download rebate reports, and submit fast API withdrawals. All endpoints sit under the broker-specific path prefix and require broker-grade API credentials.
The Broker API requires a dedicated broker API key issued by KuCoin. Standard account API keys will not work. Contact KuCoin to apply for broker access. All requests are routed to https://api.kucoin.com with the /api/v1/broker/nd/ path prefix.

Installation

npm install kucoin-api

Initialization

import { BrokerClient } from 'kucoin-api';

const client = new BrokerClient({
  apiKey: process.env.KUCOIN_BROKER_API_KEY,
  apiSecret: process.env.KUCOIN_BROKER_API_SECRET,
  apiPassphrase: process.env.KUCOIN_BROKER_API_PASSPHRASE,
});
Every BrokerClient method is authenticated. There are no public endpoints in the Broker API — always initialise the client with your broker credentials.

Feature Overview

Broker Info

Query the basic profile of your broker account, including name, status, and any attached metadata returned by KuCoin.

Sub-Account Management

Create uniquely named sub-accounts under your broker umbrella and retrieve the full paginated list of all existing sub-accounts.

Sub-Account API Keys

Issue, query, update, and revoke API keys for individual sub-accounts. Each key can have up to 20 IP whitelist entries and scoped permissions.

Transfers

Move funds between the broker master account and any sub-account (or vice versa), and retrieve the status of any historical transfer by its order ID.

Deposits & Withdrawals

List deposit records for all sub-accounts, look up a single deposit by currency and transaction hash, retrieve a withdrawal record by its ID, and submit fast API withdrawals.

Rebate Reports

Download broker rebate data as a CSV file. The API returns a time-limited URL valid for 24 hours; the maximum date range per query is 6 months.

Usage Examples

Broker Account Info

import { BrokerClient } from 'kucoin-api';

const client = new BrokerClient({
  apiKey: process.env.KUCOIN_BROKER_API_KEY,
  apiSecret: process.env.KUCOIN_BROKER_API_SECRET,
  apiPassphrase: process.env.KUCOIN_BROKER_API_PASSPHRASE,
});

// Retrieve basic broker account information
const brokerInfo = await client.getBrokerInfo({
  begin: '20240101',
  end: '20240630',
  tradeType: '1',
});
console.log('Broker info:', JSON.stringify(brokerInfo, null, 2));

Sub-Account Management

// Create a new sub-account
// Note: account names are globally unique — use a prefix to avoid collisions
const newSub = await client.createSubAccount({
  accountName: 'mybroker_trader_001',
});
console.log('Created sub-account UID:', newSub.data.uid);

// List all sub-accounts for a UID (paginated, default page size = 20, max = 100)
const subAccounts = await client.getSubAccounts({
  uid: 'your_sub_uid',
  pageSize: 50,
  currentPage: 1,
});
console.log(`Total sub-accounts: ${subAccounts.data.items.length}`);

Sub-Account API Keys

// Create an API key for a sub-account
// Permissions: General, Spot, Margin, Futures, InnerTransfer, Transfer, Earn
// Label must be 4–32 characters; up to 20 IP whitelist entries
const newKey = await client.createSubAccountApi({
  uid: 'your_sub_uid',
  passphrase: 'SubKeyPassphrase!',
  label: 'Trading bot key',
  permissions: ['Spot', 'Futures'],
  ipWhitelist: ['203.0.113.1', '198.51.100.4'],
});
console.log('New API key:', newKey.data.apiKey);

Transfers

// Transfer USDT from broker master (MAIN) to sub-account (TRADE)
// direction: 'OUT' = broker → sub, 'IN' = sub → broker
const transferOut = await client.submitTransfer({
  currency: 'USDT',
  amount: '100',
  direction: 'OUT',
  accountType: 'MAIN',            // broker master account type
  specialUid: 'your_sub_uid',     // the sub-account UID
  specialAccountType: 'TRADE',    // sub-account destination type
  clientOid: 'unique_transfer_id_001',
});
console.log('Transfer order ID:', transferOut.data.orderId);

// Transfer USDT back from sub-account (TRADE) to broker master (MAIN)
const transferIn = await client.submitTransfer({
  currency: 'USDT',
  amount: '50',
  direction: 'IN',
  accountType: 'MAIN',
  specialUid: 'your_sub_uid',
  specialAccountType: 'TRADE',
  clientOid: 'unique_transfer_id_002',
});

// Check transfer status by order ID
const transferStatus = await client.getTransferHistory({
  orderId: transferOut.data.orderId,
});
console.log('Transfer status:', transferStatus.data.status);
Supported accountType / specialAccountType values are: MAIN (funding) and TRADE (spot trading).

Deposit Tracking

// List all sub-account deposits (defaults to 1000 records, max 1000)
const deposits = await client.getDeposits({
  currency: 'USDT',
  status: 'SUCCESS',
  limit: 100,
});

// Look up a single deposit by currency + on-chain transaction hash
const deposit = await client.getDeposit({
  currency: 'BTC',
  hash: 'on_chain_tx_hash_here',
});
console.log('Deposit status:', deposit.data.status);
Possible deposit statuses returned by the API:
StatusDescription
PROCESSINGTransaction being confirmed
SUCCESSFunds credited
FAILURETransaction failed
PRE_SUCCESSFunds credited ahead of final confirmation
WAIT_TRM_MGTUnder compliance verification
ROLLBACKINGDeposit being reversed
WAIT_RISK_MGTUnder risk verification

Withdrawal Tracking

// Retrieve a sub-account withdrawal record by withdrawal ID
const withdrawal = await client.getWithdrawal({
  withdrawalId: 'your_withdrawal_id',
});
console.log('Withdrawal status:', withdrawal.data.status);

Fast API Withdrawal

// Submit a fast API withdrawal for a sub-account
// An initial call returns 2FA factors; resubmit with validation to complete
const fastWithdrawal = await client.applyFastWithdrawal({
  currency: 'USDT',
  address: '0xRecipientAddress',
  amount: '50',
  chain: 'ERC20',
  uid: 'your_sub_uid',
  // Include 2FA fields on the resubmission step
});

Rebate Download

// Download broker rebate data as a CSV file URL
// tradeType: '1' = Spot, '2' = Futures
// Maximum range: 6 months; URL valid for 24 hours
const rebate = await client.getBrokerRebate({
  begin: '20240101',
  end: '20240630',
  tradeType: '1',
});
console.log('Download URL:', rebate.data.url);

Full Method Reference

MethodHTTPEndpointDescription
getBrokerInfo()GETapi/v1/broker/nd/infoQuery broker account profile
MethodHTTPEndpointDescription
createSubAccount()POSTapi/v1/broker/nd/accountCreate a new sub-account
getSubAccounts()GETapi/v1/broker/nd/accountList paginated sub-accounts
MethodHTTPEndpointDescription
createSubAccountApi()POSTapi/v1/broker/nd/account/apikeyIssue a new sub-account API key
getSubAccountApis()GETapi/v1/broker/nd/account/apikeyList API keys for a sub-account
updateSubAccountApi()POSTapi/v1/broker/nd/account/update-apikeyModify permissions / whitelist
deleteSubAccountApi()DELETEapi/v1/broker/nd/account/apikeyRevoke an API key
MethodHTTPEndpointDescription
submitTransfer()POSTapi/v1/broker/nd/transferTransfer between broker and sub
getTransferHistory()GETapi/v3/broker/nd/transfer/detailTransfer status by order ID
MethodHTTPEndpointDescription
getDeposits()GETapi/v1/asset/ndbroker/deposit/listList sub-account deposits
getDeposit()GETapi/v3/broker/nd/deposit/detailSingle deposit by hash
getWithdrawal()GETapi/v3/broker/nd/withdraw/detailSingle withdrawal by ID
applyFastWithdrawal()POSTapi/v2/broker/withdrawalSubmit fast API withdrawal
MethodHTTPEndpointDescription
getBrokerRebate()GETapi/v1/broker/nd/rebase/downloadDownload rebate CSV (1-day URL)

SpotClient

Standard spot and margin trading, sub-account management for non-broker accounts.

FuturesClient

Futures contracts, positions, funding rates, and account transfers.

UnifiedAPIClient

KuCoin PRO unified account for cross-product trading.

Build docs developers (and LLMs) love