Your Bybit wallet shows 1 ETH. You send a withdrawal for it and Bybit refuses, or the app says you can withdraw 0. Nothing is broken: part of your balance can be held back from withdrawal for a while, and Bybit’s API tells you how much. This post shows how to read that number in Node.js and TypeScript with bybit-api (v4.8.7), and how to send a withdrawal that cannot go out twice when you retry.
Balance is not the same as withdrawable
Bybit’s Get Withdrawable Amount docs (GET /v5/asset/withdraw/withdrawable-amount) give two reasons part of your funds can be subject to delayed withdrawal:
- On-chain deposits. If the number of confirmations has not reached a risk-controlled level, a portion of the funds is frozen for a period of time until it is unfrozen.
- Buying crypto. If there is a risk, the funds are frozen for a certain period and cannot be withdrawn.
The response has a top-level limitAmountUsd, described as “the frozen amount due to risk, in USD”. Under withdrawableAmount there is one object per wallet, each with coin, withdrawableAmount and availableBalance. The wallets are FUND (Funding), UTA (Unified), EARN (only when the coin can be withdrawn from Earn) and SPOT (not returned if the Spot wallet has been removed). This is Bybit’s example response:
{
"retCode": 0,
"retMsg": "success",
"result": {
"limitAmountUsd": "595051.7",
"withdrawableAmount": {
"FUND": {
"coin": "USDT",
"withdrawableAmount": "155805.847",
"availableBalance": "155805.847"
},
"UTA": {
"coin": "USDT",
"withdrawableAmount": "498751.0882",
"availableBalance": "498751.0882"
}
}
},
"retExtInfo": {},
"time": 1754009688289
}
What Bybit’s API Telegram group said
This came up in Bybit’s Chinese API Telegram group between 30 November and 1 December 2026. The replies are useful context, but they are chat answers, not documentation.
- Asked whether
withdrawableAmountalready deducts the delayed-withdrawal amount, a reply said yes: if there are limits related to recent deposits, or other temporary withdrawal limits,withdrawableAmountis reduced to match (message). - Asked how a single
limitAmountUsdapplies across coins, a reply said the delayed amount is valued in USD, and Bybit makes sure your wallet equity does not fall below that value. Its example: with a 100 USD delayed amount and 1 BTC plus 1 ETH, you can withdraw 1 ETH plus 1 BTC minus 100 USD worth of BTC, or the other way round. If you hold only 50 USD of BTC and 50 USD of ETH, neither can be withdrawn (message). - A later message gave a simpler example: an account holds 100 USDT and deposits 1 ETH on T0. On T1 the ETH is not fully unlocked, so the withdrawable amounts are 100 USDT and 0 ETH. Selling the ETH for 1500 USDT still leaves 100 USDT withdrawable. Once the ETH is fully unlocked on T2, the full 1600 USDT is withdrawable (message).
Those examples describe one account’s situation. The exact rules and timing depend on Bybit’s risk checks, so do not build your own estimate from them. Read withdrawableAmount from the API right before you withdraw.
Read it, then withdraw once
The example below reads the withdrawable amount for a coin, picks a wallet that can cover the withdrawal on its own, stores the request with a requestId, and sends it. If the request times out, it retries with the same requestId.
import { randomUUID } from 'node:crypto';
import { readFileSync, writeFileSync } from 'node:fs';
import { RestClientV5, WithdrawParamsV5 } from 'bybit-api';
// Master UID API key with withdrawal permission.
const client = new RestClientV5({
key: process.env.BYBIT_API_KEY,
secret: process.env.BYBIT_API_SECRET,
});
// 1. What can actually leave, per wallet, for one coin?
async function readWithdrawable(coin: string) {
const res = await client.getWithdrawableAmount({ coin });
if (res.retCode !== 0) {
throw new Error(`withdrawable-amount: ${res.retMsg}`);
}
const { limitAmountUsd, withdrawableAmount } = res.result;
console.log('frozen due to risk (USD):', limitAmountUsd);
for (const [wallet, slice] of Object.entries(withdrawableAmount)) {
if (!slice) continue;
console.log(
wallet,
'available',
slice.availableBalance,
'withdrawable',
slice.withdrawableAmount,
);
}
return withdrawableAmount;
}
// 2. Pick a wallet that covers the amount on its own.
async function pickWallet(coin: string, amount: string) {
const slices = await readWithdrawable(coin);
const want = Number(amount);
if (Number(slices.FUND?.withdrawableAmount ?? 0) >= want) {
return 'FUND';
}
if (Number(slices.UTA?.withdrawableAmount ?? 0) >= want) {
return 'UTA';
}
throw new Error(`no single wallet can withdraw ${amount} ${coin}`);
}
// 3. Persist the request (and its requestId) before sending.
const storeFile = './pending-withdrawals.json';
type Pending = Omit<WithdrawParamsV5, 'timestamp'> & {
requestId: string;
};
function loadPending(): Record<string, Pending> {
try {
return JSON.parse(readFileSync(storeFile, 'utf8'));
} catch {
return {};
}
}
function savePending(p: Pending) {
const all = loadPending();
all[p.requestId] = p;
writeFileSync(storeFile, JSON.stringify(all, null, 2));
}
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
async function send(p: Pending) {
// Same requestId on every attempt. Fresh timestamp each time.
return client.submitWithdrawal({ ...p, timestamp: Date.now() });
}
export async function withdraw(
coin: string,
chain: string,
address: string,
amount: string,
) {
const accountType = await pickWallet(coin, amount);
const pending: Pending = {
coin,
chain,
address,
amount,
accountType,
// Letters and numbers only, 1 to 32 characters.
requestId: randomUUID().replace(/-/g, ''),
};
savePending(pending);
let res;
try {
res = await send(pending);
} catch (e) {
// Timeout or network error: the withdrawal may exist.
// Retry once with the SAME requestId, never a new one.
console.warn('no response, retrying', pending.requestId, e);
await sleep(11_000); // one withdrawal per 10s per chain/coin
res = await send(pending);
}
if (res.retCode !== 0) {
// Refused: do not loop. Read retMsg and the records first.
throw new Error(`withdraw refused: ${res.retCode} ${res.retMsg}`);
}
console.log('withdrawal id', res.result.id, pending.requestId);
return res.result.id;
}
How it works
- Reading.
getWithdrawableAmount({ coin })returnslimitAmountUsdand the per-wallet slices. Only the wallets that apply are present, so every slice is optional in the SDK’sWithdrawableAmountV5type. All amounts are strings. The code converts them withNumber()only to compare them, and sendsamountas a string. - Choosing
accountType. Bybit documentsFUND,UTA(the system moves the funds to the Funding wallet to withdraw),EARN, and the combinationFUND,UTA,EARN, which takes from Funding first and the rest from the UTA wallet and Earn. The example uses one wallet that covers the whole amount. If you want a combination, the documented one isFUND,UTA,EARN, and that can draw on Earn too. requestId. Bybit describes it as a globally unique custom ID used for idempotent verification: letters (case sensitive) and numbers only, 1 to 32 characters. A UUID with the dashes removed is 32 hex characters, which fits. Save it before you send, so a crash or a timeout cannot lose it.- Retrying. A thrown error (timeout, connection reset) means you do not know whether the withdrawal was created, so the retry reuses the same
requestId. It waits 11 seconds first, because Bybit only allows one withdrawal every 10 seconds per chain and coin. A non-zeroretCodemeans Bybit answered and refused, so the code stops and reportsretMsg. bybit-api returns non-zeroretCoderesponses instead of throwing, unless you enablethrowExceptions. timestamp. It is required, and Bybit uses it to prevent withdrawal replay. The code sets a fresh one on each attempt and relies onrequestIdfor idempotency.
Checking what happened
getWithdrawalRecords() (GET /v5/asset/withdraw/query-record) lists withdrawals for the last 30 days by default. You can filter by withdrawID, txID, coin and time, but not by requestId. Store the id returned by submitWithdrawal() next to your requestId, and use it to look the withdrawal up later.
Checklist
| Symptom | Likely cause | Fix |
|---|---|---|
Balance shows the coin, but withdrawableAmount is lower or 0 |
Recent deposit or crypto purchase held by risk controls | Read getWithdrawableAmount() and withdraw at most withdrawableAmount from that wallet |
| Other coins are also less withdrawable than expected | limitAmountUsd is valued across the account, according to the Telegram replies |
Check limitAmountUsd and each slice. Do not compute it yourself |
| Two withdrawals after a timeout | Retried with a new requestId, or without one |
Store one requestId per withdrawal and reuse it on every retry |
| Retry refused straight away | One withdrawal per 10 seconds per chain and coin | Wait more than 10 seconds before retrying |
| Withdrawal refused for a sub-account key | The endpoint needs the master UID’s API key | Use a master account key with withdrawal permission |
- Read
withdrawableAmount, not your balance, before you withdraw. - Pick
accountTypefrom documented values. - Use one stored
requestIdper withdrawal. - Whitelist the address in your Bybit address book first.
Further reading
- Bybit JavaScript SDK: install, clients and examples
- Bybit API JavaScript tutorial: REST and WebSocket clients in more detail
- bybit-api docs
- SDK examples: get-withdrawable-amount.js and withdraw.js
- Bybit API docs: Get Withdrawable Amount, Withdraw and Get Withdrawal Records
- Related: Bybit post-only order said retCode 0, then vanished and API key security best practices
- How to find SDK functions that match API docs endpoints
