If you’re looking for a KuCoin testnet, there isn’t one. KuCoin took its sandbox (web and API) offline on 10 July 2023, according to its announcement, and no replacement has launched since. Old code that still points at openapi-sandbox.kucoin.com won’t work, and there’s no testnet: true switch to flip.
What KuCoin does offer is a pair of order test endpoints on the live API. You send exactly the same request you would send to place an order, KuCoin checks the signature, the permissions and the parameters, and the order never enters the matching engine. With kucoin-api (2.6.9 at the time of writing) those are SpotClient.submitHFOrderTest() and FuturesClient.submitNewOrderTest().
What you can and can’t test without a sandbox
- Can test: API key, secret and passphrase, the request signature, key permissions, symbol names, price and size precision, and required fields. These are the things that usually break first.
- Can’t test: fills, partial fills, order updates on the private WebSocket, or your position and balance logic. A test order is never matched, so nothing comes back on the order stream and it can’t be queried later.
- Public market data needs no keys at all, so you can build and test anything that only reads tickers, candles or order books against the live API.
Spot: validate an order with submitHFOrderTest()
Read the symbol’s rules first, so the test checks the same price and size you would really send. getSymbol() is public and returns the increments and minimums:
import { SpotClient } from 'kucoin-api';
const client = new SpotClient({
apiKey: process.env.KUCOIN_API_KEY,
apiSecret: process.env.KUCOIN_API_SECRET,
apiPassphrase: process.env.KUCOIN_API_PASSPHRASE,
});
// Public: price and size rules for the pair.
const { data: rules } = await client.getSymbol({ symbol: 'BTC-USDT' });
console.log(rules.priceIncrement, rules.baseIncrement, rules.baseMinSize, rules.minFunds);
// e.g. 0.1 0.00000001 0.00001 0.1
try {
// Same parameters as submitHFOrder(), but never matched.
const result = await client.submitHFOrderTest({
clientOid: client.generateNewOrderID(),
symbol: 'BTC-USDT',
side: 'buy',
type: 'limit',
price: '10000',
size: '0.0001',
});
console.log('order request is valid', result);
} catch (e) {
// KuCoin's own error code and message are in e.body.
console.error('rejected:', e.body?.code, e.body?.msg);
}
When the request is good you get the same response shape as a real order. When it isn’t, the error tells you why without any risk. For example, with keys that don’t exist on the site you’re calling, the test endpoint returns 400003 “The API key does not exist or site mismatch.” A bad signature or passphrase shows up as 400005 or 400004, which we covered in fixing KuCoin 400005 in Node.js.
Futures: validate an order with submitNewOrderTest()
Futures orders are sized in lots, not coins. For XBTUSDTM one lot is 0.001 BTC (multiplier), and the tick size is 0.1. Check both with the public getSymbol() call before you build the order:
import { FuturesClient } from 'kucoin-api';
const futures = new FuturesClient({
apiKey: process.env.KUCOIN_API_KEY,
apiSecret: process.env.KUCOIN_API_SECRET,
apiPassphrase: process.env.KUCOIN_API_PASSPHRASE,
});
const { data: contract } = await futures.getSymbol({ symbol: 'XBTUSDTM' });
console.log(contract.multiplier, contract.tickSize, contract.lotSize); // 0.001 0.1 1
try {
const result = await futures.submitNewOrderTest({
clientOid: futures.generateNewOrderID(),
symbol: 'XBTUSDTM',
side: 'buy',
type: 'limit',
price: '10000',
size: 1, // lots
leverage: 2,
marginMode: 'ISOLATED',
});
console.log('futures order request is valid', result);
} catch (e) {
console.error('rejected:', e.body?.code, e.body?.msg);
}
A simple pattern: a dry-run switch
Most bots only need one place that decides whether an order is real. Route every order through a small wrapper and flip it with an environment variable, so the rest of your code doesn’t change between test and live runs:
const DRY_RUN = process.env.DRY_RUN !== 'false';
async function placeSpotOrder(params) {
const order = { clientOid: client.generateNewOrderID(), ...params };
return DRY_RUN ? client.submitHFOrderTest(order) : client.submitHFOrder(order);
}
Keep DRY_RUN on by default, so a missing variable can never send a live order.
Filling the gaps a sandbox would cover
- Use a separate sub-account with a small balance and its own API key for end-to-end checks of fills and WebSocket order updates. Give that key trade permission only, never withdrawal, and set an IP whitelist.
- Test private WebSocket handling by subscribing on that sub-account and placing a small post-only order far from the market, then cancelling it. You’ll see the open and cancel events without a fill.
- Replay recorded data for strategy logic. Record public trades or candles from the live WebSocket and feed them back in tests.
Checklist
- There’s no KuCoin testnet or sandbox. Remove any
openapi-sandbox.kucoin.comURLs. - Use
submitHFOrderTest()(spot) andsubmitNewOrderTest()(futures) to validate signatures, permissions and parameters. - Read
getSymbol()first so tests use real increments and minimums. - Log
e.body.codeande.body.msg, not the whole error object. - Use a small, trade-only sub-account for anything that needs real fills.
The KuCoin API JavaScript tutorial walks through the REST and WebSocket clients, and the Siebly docs cover the other exchange SDKs from the same maintainers.

