SDK guide
JavaScript
REST API + WebSocket

Bybit JavaScript SDK

Build with the Bybit REST API & WebSockets with our JavaScript SDK, TypeScript-first package declarations, and Node.js-compatible runtime patterns. Discover installation, common examples, a detailed endpoint-to-function map, and the REST API/WebSocket patterns shared across our Siebly SDK family.

Use the same TypeScript-first REST API and WebSocket clients from plain JavaScript or TypeScript in Node.js-compatible runtimes.

Package surfaces

Explore the following API capabilities are covered by our Bybit SDK:

  • Spot
  • Futures
  • Options
  • WebSockets
  • WebSocket API
  • WebSocket clients with:
    • Built-in heartbeats.
    • Automatic reconnection.
    • Automatic reauthentication and resubscribe where the exchange supports it.
  • Promise-wrapped WebSocket API commands you can await like a REST API.
  • Typed requests and responses for Node.js, JavaScript, and TypeScript IDEs.
  • Framework-neutral JavaScript snippets that stay approachable in Node.js-compatible runtimes.
  • TypeScript-first package declarations for stricter services, shared libraries, and editor-assisted integrations.

Install Bybit SDK

# Via your favourite package manager, e.g. npm:
npm install bybit-api
# or pnpm:
pnpm install bybit-api
# or yarn:
yarn add bybit-api

Quickstart Examples with the Bybit JavaScript SDK

Get started with just a few lines of JavaScript. TypeScript, while not required, is absolutely recommended. TypeScript declarations are included with all our SDKs and provide convenient definitions on request & response fields, WebSocket payloads, and generally safer integrations.

REST walkthrough

Easily start calling Bybit's V5 REST APIs in JavaScript.

  • Install the Bybit JavaScript SDK via NPM: npm install bybit-api.
  • Import the RestClientV5 class (REST API wrapper for Bybit's V5 REST APIs).
  • Create an instance with your API credentials (different key types are automatically detected & handled).
  • Call the desired REST API methods as functions and await the promise containing the response.

In this example, we:

  • Call the endpoint to query a list of linear perpetual futures positions on your Bybit account, and log the response to console.
  • Submit a basic linear futures market buy order, and log the result to console.
  • Submit a basic linear futurse market sell order, and log the results to console.
  • Note: the example assumes one-way position mode. For hedge-mode, you will need to indicate the position side with your order (via positionIdx:1 for the long side or positionIdx:2 for the short side).

For a full map of available REST API methods, check out the endpoint reference below.

import { RestClientV5 } from 'bybit-api'; const key = process.env.API_KEY_COM;const secret = process.env.API_SECRET_COM; const client = new RestClientV5({  key: key,  secret: secret,}); (async () => {  try {    /** Simple examples for private REST API calls with bybit's V5 REST APIs */    const response = await client.getPositionInfo({      category: 'linear',      symbol: 'BTCUSDT',    });     console.log('response:', response);     // Trade USDT linear perps    const buyOrderResult = await client.submitOrder({      category: 'linear',      symbol: 'BTCUSDT',      orderType: 'Market',      qty: '1',      side: 'Buy',    });    console.log('buyOrderResult:', buyOrderResult);     const sellOrderResult = await client.submitOrder({      category: 'linear',      symbol: 'BTCUSDT',      orderType: 'Market',      qty: '1',      side: 'Sell',    });    console.log('sellOrderResult:', sellOrderResult);  } catch (e) {    console.error('request failed: ', e);  }})();
Full Bybit course

Bybit API JavaScript Tutorial

A practical JavaScript guide to using bybit-api across the Bybit REST API, category-based Spot and derivatives routing, public and private streams, demo trading, testnet, regional routing, WebSocket streams and WebSocket API commands.

Complete REST API coverage
Public and private WebSocket streams
Demo trading, testnet, and regional routing
WebSocket API command flow
REST API
WebSocket Streams
WebSocket API
Examples

Your app / service

bot, dashboard, worker

bybit-api

RestClientV5, WebsocketClient, WebsocketAPIClient

Bybit API

REST API, market data streams, account streams, WebSocket API

Common Bybit implementation tasks

Start from the behavior you need, not just from REST or WebSocket as a transport. Market-data driven systems should be event driven. Backfill via the REST API once and let WebSockets passively stream new data to you, as it becomes available.

Endpoint Function Reference

Endpoint maps

Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering.

The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to.

This can be used to easily find which method to call, once you have found which endpoint you're looking to use.

All REST clients are in the src folder. For usage examples, make sure to check the examples folder.

List of clients:

If anything is missing or wrong, please open an issue or let us know in our Node.js Traders telegram group!

How to use table

Table consists of 4 parts:

  • Function name
  • AUTH
  • HTTP Method
  • Endpoint

Function name is the name of the function that can be called through the SDK. Check examples folder in the repo for more help on how to use them!

AUTH is a boolean value that indicates if the function requires authentication - which means you need to pass your API key and secret to the SDK.

HTTP Method shows HTTP method that the function uses to call the endpoint. Sometimes endpoints can have same URL, but different HTTP method so you can use this column to differentiate between them.

Endpoint is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name.

rest-client-v5.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in rest-client-v5.ts.

FunctionAUTHHTTP MethodEndpoint
getSystemStatus()🔐GET/v5/system/status
getServerTime()GET/v5/market/time
requestDemoTradingFunds()🔐POST/v5/account/demo-apply-money
createDemoAccount()🔐POST/v5/user/create-demo-member
getSpreadInstrumentsInfo()GET/v5/spread/instrument
getSpreadOrderbook()GET/v5/spread/orderbook
getSpreadTickers()GET/v5/spread/tickers
getSpreadRecentTrades()GET/v5/spread/recent-trade
getSpreadMaxQty()🔐GET/v5/spread/max-qty
submitSpreadOrder()🔐POST/v5/spread/order/create
amendSpreadOrder()🔐POST/v5/spread/order/amend
cancelSpreadOrder()🔐POST/v5/spread/order/cancel
cancelAllSpreadOrders()🔐POST/v5/spread/order/cancel-all
getSpreadOpenOrders()🔐GET/v5/spread/order/realtime
getSpreadOrderHistory()🔐GET/v5/spread/order/history
getSpreadTradeHistory()🔐GET/v5/spread/execution/list
getKline()GET/v5/market/kline
getMarkPriceKline()GET/v5/market/mark-price-kline
getIndexPriceKline()GET/v5/market/index-price-kline
getPremiumIndexPriceKline()GET/v5/market/premium-index-price-kline
getInstrumentsInfo()GET/v5/market/instruments-info
getOrderbook()GET/v5/market/orderbook
getRPIOrderbook()GET/v5/market/rpi_orderbook
getTickers()GET/v5/market/tickers
getFundingRateHistory()GET/v5/market/funding/history
getPublicTradingHistory()GET/v5/market/recent-trade
getOpenInterest()GET/v5/market/open-interest
getHistoricalVolatility()GET/v5/market/historical-volatility
getInsurance()GET/v5/market/insurance
getRiskLimit()GET/v5/market/risk-limit
getOptionDeliveryPrice()GET/v5/market/delivery-price
getDeliveryPrice()GET/v5/market/delivery-price
getNewDeliveryPrice()GET/v5/market/new-delivery-price
getLongShortRatio()GET/v5/market/account-ratio
getIndexPriceComponents()GET/v5/market/index-price-components
getOrderPriceLimit()GET/v5/market/price-limit
getADLAlert()GET/v5/market/adlAlert
getFeeGroupStructure()GET/v5/market/fee-group-info
submitOrder()🔐POST/v5/order/create
amendOrder()🔐POST/v5/order/amend
cancelOrder()🔐POST/v5/order/cancel
getActiveOrders()🔐GET/v5/order/realtime
cancelAllOrders()🔐POST/v5/order/cancel-all
getHistoricOrders()🔐GET/v5/order/history
getExecutionList()🔐GET/v5/execution/list
batchSubmitOrders()🔐POST/v5/order/create-batch
batchAmendOrders()🔐POST/v5/order/amend-batch
batchCancelOrders()🔐POST/v5/order/cancel-batch
getSpotBorrowCheck()🔐GET/v5/order/spot-borrow-check
setDisconnectCancelAllWindow()🔐POST/v5/order/disconnected-cancel-all
setDisconnectCancelAllWindowV2()🔐POST/v5/order/disconnected-cancel-all
preCheckOrder()🔐POST/v5/order/pre-check
createStrategyOrder()🔐POST/v5/strategy/create
getStrategyList()🔐GET/v5/strategy/list
getStrategyOrderList()🔐GET/v5/strategy/order-list
stopStrategy()🔐POST/v5/strategy/stop
getPositionInfo()🔐GET/v5/position/list
getFuturesLeverage()🔐GET/v5/position/symbol-info
setLeverage()🔐POST/v5/position/set-leverage
switchIsolatedMargin()🔐POST/v5/position/switch-isolated
setTPSLMode()🔐POST/v5/position/set-tpsl-mode
switchPositionMode()🔐POST/v5/position/switch-mode
setRiskLimit()🔐POST/v5/position/set-risk-limit
setTradingStop()🔐POST/v5/position/trading-stop
setAutoAddMargin()🔐POST/v5/position/set-auto-add-margin
addOrReduceMargin()🔐POST/v5/position/add-margin
getClosedPnL()🔐GET/v5/position/closed-pnl
getClosedOptionsPositions()🔐GET/v5/position/get-closed-positions
movePosition()🔐POST/v5/position/move-positions
getMovePositionHistory()🔐GET/v5/position/move-history
confirmNewRiskLimit()🔐POST/v5/position/confirm-pending-mmr
getPreUpgradeOrderHistory()🔐GET/v5/pre-upgrade/order/history
getPreUpgradeTradeHistory()🔐GET/v5/pre-upgrade/execution/list
getPreUpgradeClosedPnl()🔐GET/v5/pre-upgrade/position/closed-pnl
getPreUpgradeTransactions()🔐GET/v5/pre-upgrade/account/transaction-log
getPreUpgradeOptionDeliveryRecord()🔐GET/v5/pre-upgrade/asset/delivery-record
getPreUpgradeUSDCSessionSettlements()🔐GET/v5/pre-upgrade/asset/settlement-record
getWalletBalance()🔐GET/v5/account/wallet-balance
getTransferableAmount()🔐GET/v5/account/withdrawal
getAccountInstrumentsInfo()🔐GET/v5/account/instruments-info
upgradeToUnifiedAccount()🔐POST/v5/account/upgrade-to-uta
getBorrowHistory()🔐GET/v5/account/borrow-history
repayLiability()🔐POST/v5/account/quick-repayment
manualRepay()🔐POST/v5/account/repay
setCollateralCoin()🔐POST/v5/account/set-collateral-switch
batchSetCollateralCoin()🔐POST/v5/account/set-collateral-switch-batch
getCollateralInfo()🔐GET/v5/account/collateral-info
getCoinGreeks()🔐GET/v5/asset/coin-greeks
getFeeRate()🔐GET/v5/account/fee-rate
getAccountInfo()🔐GET/v5/account/info
getDCPInfo()🔐GET/v5/account/query-dcp-info
getTransactionLog()🔐GET/v5/account/transaction-log
getClassicTransactionLogs()🔐GET/v5/account/contract-transaction-log
getSMPGroup()🔐GET/v5/account/smp-group
setMarginMode()🔐POST/v5/account/set-margin-mode
setSpotHedging()🔐POST/v5/account/set-hedging-mode
setLimitPriceAction()🔐POST/v5/account/set-limit-px-action
getLimitPriceAction()🔐GET/v5/account/user-setting-config
setDeltaNeutralMode()🔐POST/v5/account/set-delta-mode
setMMP()🔐POST/v5/account/mmp-modify
resetMMP()🔐POST/v5/account/mmp-reset
getMMPState()🔐GET/v5/account/mmp-state
getOptionAssetInfo()🔐GET/v5/account/option-asset-info
getPayInfo()🔐GET/v5/account/pay-info
getTradeInfoForAnalysis()🔐GET/v5/account/trade-info-for-analysis
getAssetOverview()🔐GET/v5/asset/asset-overview
getPortfolioMarginInfo()🔐GET/v5/asset/portfolio-margin
getTotalMembersAssets()🔐GET/v5/asset/total-members-assets
getFundingAccountTransactionHistory()🔐GET/v5/asset/fundinghistory
getDeliveryRecord()🔐GET/v5/asset/delivery-record
getSettlementRecords()🔐GET/v5/asset/settlement-record
getCoinExchangeRecords()🔐GET/v5/asset/exchange/order-record
getCoinInfo()🔐GET/v5/asset/coin/query-info
getSubUID()🔐GET/v5/asset/transfer/query-sub-member-list
getAssetInfo()🔐GET/v5/asset/transfer/query-asset-info
getAllCoinsBalance()🔐GET/v5/asset/transfer/query-account-coins-balance
getCoinBalance()🔐GET/v5/asset/transfer/query-account-coin-balance
getWithdrawableAmount()🔐GET/v5/asset/withdraw/withdrawable-amount
getTransferableCoinList()🔐GET/v5/asset/transfer/query-transfer-coin-list
createInternalTransfer()🔐POST/v5/asset/transfer/inter-transfer
getInternalTransferRecords()🔐GET/v5/asset/transfer/query-inter-transfer-list
enableUniversalTransferForSubUIDs()🔐POST/v5/asset/transfer/save-transfer-sub-member
createUniversalTransfer()🔐POST/v5/asset/transfer/universal-transfer
getUniversalTransferRecords()🔐GET/v5/asset/transfer/query-universal-transfer-list
getAllowedDepositCoinInfo()🔐GET/v5/asset/deposit/query-allowed-list
setDepositAccount()🔐POST/v5/asset/deposit/deposit-to-account
getDepositRecords()🔐GET/v5/asset/deposit/query-record
getSubAccountDepositRecords()🔐GET/v5/asset/deposit/query-sub-member-record
getInternalDepositRecords()🔐GET/v5/asset/deposit/query-internal-record
getMasterDepositAddress()🔐GET/v5/asset/deposit/query-address
getSubDepositAddress()🔐GET/v5/asset/deposit/query-sub-member-address
querySubMemberAddress()🔐GET/v5/asset/deposit/query-sub-member-address
getWithdrawalRecords()🔐GET/v5/asset/withdraw/query-record
getWithdrawalAddressList()🔐GET/v5/asset/withdraw/query-address
getExchangeEntities()🔐GET/v5/asset/withdraw/vasp/list
submitDepositOriginatorInfo()🔐POST/v5/asset/travel-rule/deposit/submit
submitWithdrawal()🔐POST/v5/asset/withdraw/create
cancelWithdrawal()🔐POST/v5/asset/withdraw/cancel
getConvertCoins()🔐GET/v5/asset/exchange/query-coin-list
requestConvertQuote()🔐POST/v5/asset/exchange/quote-apply
confirmConvertQuote()🔐POST/v5/asset/exchange/convert-execute
getConvertStatus()🔐GET/v5/asset/exchange/convert-result-query
getConvertHistory()🔐GET/v5/asset/exchange/query-convert-history
getSmallBalanceList()🔐GET/v5/asset/covert/small-balance-list
getFiatTradingPairList()🔐GET/v5/fiat/query-coin-list
createSubMember()🔐POST/v5/user/create-sub-member
createSubUIDAPIKey()🔐POST/v5/user/create-sub-api
getSubUIDList()🔐GET/v5/user/query-sub-members
getSubUIDListUnlimited()🔐GET/v5/user/submembers
setSubUIDFrozenState()🔐POST/v5/user/frozen-sub-member
getQueryApiKey()🔐GET/v5/user/query-api
getSubAccountAllApiKeys()🔐GET/v5/user/sub-apikeys
getUIDWalletType()🔐GET/v5/user/get-member-type
updateMasterApiKey()🔐POST/v5/user/update-api
updateSubApiKey()🔐POST/v5/user/update-sub-api
deleteSubMember()🔐POST/v5/user/del-submember
deleteMasterApiKey()🔐POST/v5/user/delete-api
deleteSubApiKey()🔐POST/v5/user/delete-sub-api
getAffiliateUserList()🔐GET/v5/affiliate/aff-user-list
getAffiliateSubAffiliateList()🔐GET/v5/affiliate/affiliate-sub-list
getAffiliateUserInfo()🔐GET/v5/user/aff-customer-info
getFriendReferrals()🔐GET/v5/user/invitation/referrals
signAgreement()🔐POST/v5/user/agreement
getAlphaTradeQuote()🔐POST/v5/alpha/trade/quote
executeAlphaTradePurchase()🔐POST/v5/alpha/trade/purchase
executeAlphaTradeRedeem()🔐POST/v5/alpha/trade/redeem
getAlphaPayTokenList()🔐POST/v5/alpha/trade/pay-token-list
getAlphaTradeOrderList()🔐POST/v5/alpha/trade/order-list
getAlphaBizTokenList()🔐POST/v5/alpha/trade/biz-token-list
getAlphaBizTokenPriceList()🔐POST/v5/alpha/trade/biz-token-price-list
getAlphaBizTokenDetails()🔐POST/v5/alpha/trade/biz-token-details
getAlphaAssetList()🔐POST/v5/alpha/trade/asset-list
getAlphaAssetDetail()🔐POST/v5/alpha/trade/asset-detail
getAlphaPredictionEngineStatus()🔐GET/v5/alpha/prediction/engine-status
getAlphaPredictionPayTokenList()🔐GET/v5/alpha/prediction/pay-token-list
getAlphaPredictionEventDetail()🔐POST/v5/alpha/prediction/event-detail
getAlphaPredictionOrderEstimate()🔐POST/v5/alpha/prediction/order-estimate
executeAlphaPredictionBuy()🔐POST/v5/alpha/prediction/buy
executeAlphaPredictionSell()🔐POST/v5/alpha/prediction/sell
getAlphaPredictionOrderList()🔐POST/v5/alpha/prediction/order-list
getAlphaPredictionOrderBook()🔐POST/v5/alpha/prediction/order-book
getAlphaPredictionTokenPrice()🔐POST/v5/alpha/prediction/token-price
getAlphaPredictionPriceHistory()🔐POST/v5/alpha/prediction/price-history
getAlphaPredictionPositionList()🔐POST/v5/alpha/prediction/position-list
getAlphaPredictionPositionHistory()🔐POST/v5/alpha/prediction/position-history
getAlphaPredictionPortfolioSummary()🔐POST/v5/alpha/prediction/portfolio-summary
getAlphaPredictionSideMarketList()🔐POST/v5/alpha/prediction/side-market-list
getAlphaPredictionSportsMatchList()🔐POST/v5/alpha/prediction/sports/match-list
getAlphaPredictionSportsTimelineStages()🔐GET/v5/alpha/prediction/sports/timeline-stages
getAlphaPredictionSportsGroupStageDetail()🔐POST/v5/alpha/prediction/sports/group-stage-detail
getAlphaLPPoolList()🔐POST/v5/alpha/lp/pool-list
getAlphaLPPoolInfo()🔐POST/v5/alpha/lp/pool-info
executeAlphaLPStake()🔐POST/v5/alpha/lp/stake
executeAlphaLPRedeem()🔐POST/v5/alpha/lp/redeem
getAlphaLPOrderList()🔐POST/v5/alpha/lp/order-list
getAlphaLPPayTokenList()🔐POST/v5/alpha/lp/pay-token-list
getAlphaLPPayTokenPrice()🔐POST/v5/alpha/lp/pay-token-price
getAlphaLPPositionList()🔐POST/v5/alpha/lp/position-list
getVIPMarginData()GET/v5/spot-margin-trade/data
getHistoricalInterestRate()🔐GET/v5/spot-margin-trade/interest-rate-history
getSpotMarginCurrencyData()🔐GET/v5/spot-margin-trade/currency-data
toggleSpotMarginTrade()🔐POST/v5/spot-margin-trade/switch-mode
setSpotMarginLeverage()🔐POST/v5/spot-margin-trade/set-leverage
setSpotMarginLeverageV2()🔐POST/v5/spot-margin-trade/set-leverage
getSpotMarginState()🔐GET/v5/spot-margin-trade/state
manualBorrow()🔐POST/v5/account/borrow
getMaxBorrowableAmount()🔐GET/v5/spot-margin-trade/max-borrowable
getPositionTiers()🔐GET/v5/spot-margin-trade/position-tiers
getCoinState()🔐GET/v5/spot-margin-trade/coinstate
getAvailableAmountToRepay()🔐GET/v5/spot-margin-trade/repayment-available-amount
manualRepayWithoutConversion()🔐POST/v5/account/no-convert-repay
getAutoRepayMode()🔐GET/v5/spot-margin-trade/get-auto-repay-mode
setAutoRepayMode()🔐POST/v5/spot-margin-trade/set-auto-repay-mode
getSpotMarginLiability()🔐GET/v5/spot-margin-trade/liability
submitFixedRateBorrow()🔐POST/v5/spot-margin-trade/fixedborrow
getFixedRateBorrowOrderInfo()🔐GET/v5/spot-margin-trade/fixedborrow-order-info
getFixedRateBorrowContractInfo()🔐GET/v5/spot-margin-trade/fixedborrow-contract-info
getFixedRateBorrowOrderQuote()🔐GET/v5/spot-margin-trade/fixedborrow-order-quote
renewFixedRateBorrow()🔐POST/v5/spot-margin-trade/fixedborrow-renew
getSpotMarginCoinInfo()🔐GET/v5/spot-cross-margin-trade/pledge-token
getSpotMarginBorrowableCoinInfo()🔐GET/v5/spot-cross-margin-trade/borrow-token
getSpotMarginInterestAndQuota()🔐GET/v5/spot-cross-margin-trade/loan-info
getSpotMarginLoanAccountInfo()🔐GET/v5/spot-cross-margin-trade/account
spotMarginBorrow()🔐POST/v5/spot-cross-margin-trade/loan
spotMarginRepay()🔐POST/v5/spot-cross-margin-trade/repay
getSpotMarginBorrowOrderDetail()🔐GET/v5/spot-cross-margin-trade/orders
getSpotMarginRepaymentOrderDetail()🔐GET/v5/spot-cross-margin-trade/repay-history
toggleSpotCrossMarginTrade()🔐POST/v5/spot-cross-margin-trade/switch
getCollateralCoins()GET/v5/crypto-loan/collateral-data
getBorrowableCoins()GET/v5/crypto-loan/loanable-data
getAccountBorrowCollateralLimit()🔐GET/v5/crypto-loan/borrowable-collateralisable-number
borrowCryptoLoan()🔐POST/v5/crypto-loan/borrow
repayCryptoLoan()🔐POST/v5/crypto-loan/repay
getUnpaidLoanOrders()🔐GET/v5/crypto-loan/ongoing-orders
getRepaymentHistory()🔐GET/v5/crypto-loan/repayment-history
getCompletedLoanOrderHistory()🔐GET/v5/crypto-loan/borrow-history
getMaxAllowedReductionCollateralAmount()🔐GET/v5/crypto-loan/max-collateral-amount
adjustCollateralAmount()🔐POST/v5/crypto-loan/adjust-ltv
getLoanLTVAdjustmentHistory()🔐GET/v5/crypto-loan/adjustment-history
getLoanBorrowableCoins()GET/v5/crypto-loan-common/loanable-data
getLoanCollateralCoins()GET/v5/crypto-loan-common/collateral-data
getMaxCollateralAmount()🔐GET/v5/crypto-loan-common/max-collateral-amount
getMaxLoanAmount()🔐POST/v5/crypto-loan-common/max-loan
updateCollateralAmount()🔐POST/v5/crypto-loan-common/adjust-ltv
getCollateralAdjustmentHistory()🔐GET/v5/crypto-loan-common/adjustment-history
getCryptoLoanPosition()🔐GET/v5/crypto-loan-common/position
borrowFlexible()🔐POST/v5/crypto-loan-flexible/borrow
repayFlexible()🔐POST/v5/crypto-loan-flexible/repay
repayCollateralFlexible()🔐POST/v5/crypto-loan-flexible/repay-collateral
getOngoingFlexibleLoans()🔐GET/v5/crypto-loan-flexible/ongoing-coin
getBorrowHistoryFlexible()🔐GET/v5/crypto-loan-flexible/borrow-history
getRepaymentHistoryFlexible()🔐GET/v5/crypto-loan-flexible/repayment-history
getSupplyOrderQuoteFixed()GET/v5/crypto-loan-fixed/supply-order-quote
getBorrowOrderQuoteFixed()GET/v5/crypto-loan-fixed/borrow-order-quote
createBorrowOrderFixed()🔐POST/v5/crypto-loan-fixed/borrow
createSupplyOrderFixed()🔐POST/v5/crypto-loan-fixed/supply
cancelBorrowOrderFixed()🔐POST/v5/crypto-loan-fixed/borrow-order-cancel
cancelSupplyOrderFixed()🔐POST/v5/crypto-loan-fixed/supply-order-cancel
getBorrowContractInfoFixed()🔐GET/v5/crypto-loan-fixed/borrow-contract-info
getSupplyContractInfoFixed()🔐GET/v5/crypto-loan-fixed/supply-contract-info
getBorrowOrderInfoFixed()🔐GET/v5/crypto-loan-fixed/borrow-order-info
getSupplyOrderInfoFixed()🔐GET/v5/crypto-loan-fixed/supply-order-info
repayFixed()🔐POST/v5/crypto-loan-fixed/fully-repay
repayCollateralFixed()🔐POST/v5/crypto-loan-flexible/repay-collateral
getRepaymentHistoryFixed()🔐GET/v5/crypto-loan-fixed/repayment-history
renewBorrowOrderFixed()🔐POST/v5/crypto-loan-fixed/renew
getRenewOrderInfoFixed()🔐GET/v5/crypto-loan-fixed/renew-info
getInstitutionalLendingProductInfo()GET/v5/ins-loan/product-infos
getInstitutionalLendingCoinDeltaAmount()🔐GET/v5/ins-loan/coin-delta-amount
getInstitutionalLendingMarginCoinInfo()GET/v5/ins-loan/ensure-tokens
getInstitutionalLendingMarginCoinInfoWithConversionRate()GET/v5/ins-loan/ensure-tokens-convert
getInstitutionalLendingLoanOrders()🔐GET/v5/ins-loan/loan-order
getInstitutionalLendingRepayOrders()🔐GET/v5/ins-loan/repaid-history
getInstitutionalLendingLTV()🔐GET/v5/ins-loan/ltv
getInstitutionalLendingLTVWithLadderConversionRate()🔐GET/v5/ins-loan/ltv-convert
bindOrUnbindUID()🔐POST/v5/ins-loan/association-uid
repayInstitutionalLoan()🔐POST/v5/ins-loan/repay-loan
getExchangeBrokerEarnings()🔐GET/v5/broker/earnings-info
getExchangeBrokerAccountInfo()🔐GET/v5/broker/account-info
getBrokerSubAccountDeposits()🔐GET/v5/broker/asset/query-sub-member-deposit-record
getBrokerVoucherSpec()🔐POST/v5/broker/award/info
issueBrokerVoucher()🔐POST/v5/broker/award/distribute-award
getBrokerIssuedVoucher()🔐POST/v5/broker/award/distribution-record
setBrokerRateLimit()🔐POST/v5/broker/apilimit/set
getBrokerRateLimitCap()🔐GET/v5/broker/apilimit/query-cap
getAllBrokerRateLimits()🔐GET/v5/broker/apilimit/query-all
getEarnProduct()GET/v5/earn/product
getEarnCouponList()🔐GET/v5/earn/coupons
getRWAProductList()GET/v5/earn/rwa/product
placeRWAOrder()🔐POST/v5/earn/rwa/place-order
getRWAPositionList()🔐GET/v5/earn/rwa/position
getRWAOrderList()🔐GET/v5/earn/rwa/order
getRWANavChart()GET/v5/earn/rwa/nav-chart
getHoldToEarnAirdropProducts()GET/v5/earn/hold-to-earn/product
getAdvanceEarnProduct()GET/v5/earn/advance/product
getLiquidityMiningProduct()GET/v5/earn/liquidity-mining/product
getFixedTermEarnProduct()GET/v5/earn/fixed-term/product
getAdvanceEarnProductExtraInfo()GET/v5/earn/advance/product-extra-info
submitAdvanceEarnPlaceOrder()🔐POST/v5/earn/advance/place-order
getAdvanceEarnPosition()🔐GET/v5/earn/advance/position
getAdvanceEarnOrder()🔐GET/v5/earn/advance/order
submitFixedTermEarnOrder()🔐POST/v5/earn/fixed-term/place-order
redeemFixedTermEarn()🔐POST/v5/earn/fixed-term/redeem
getFixedTermEarnPosition()🔐GET/v5/earn/fixed-term/position
getFixedTermEarnOrder()🔐GET/v5/earn/fixed-term/order
setFixedTermEarnAutoInvest()🔐POST/v5/earn/fixed-term/position/auto-invest
submitStakeRedeem()🔐POST/v5/earn/place-order
getEarnOrderHistory()🔐GET/v5/earn/order
getEarnPosition()🔐GET/v5/earn/position
modifyEarnPosition()🔐POST/v5/earn/position/modify
getEarnYieldHistory()🔐GET/v5/earn/yield
getHoldToEarnAirdropYieldHistory()🔐GET/v5/earn/hold-to-earn/yield-history
getEarnHourlyYieldHistory()🔐GET/v5/earn/hourly-yield
getEarnAprHistory()GET/v5/earn/apr-history
getEarnTokenProduct()GET/v5/earn/token/product
submitEarnTokenOrder()🔐POST/v5/earn/token/place-order
getEarnTokenOrders()🔐GET/v5/earn/token/order
getEarnTokenPosition()🔐GET/v5/earn/token/position
getEarnTokenDailyYield()🔐GET/v5/earn/token/yield
getEarnTokenHourlyYield()🔐GET/v5/earn/token/hourly-yield
getEarnTokenHistoryApr()GET/v5/earn/token/history-apr
getPwmInvestmentPlanList()🔐GET/v5/earn/pwm/investment-plan/list
getPwmInvestmentPlanDetail()🔐GET/v5/earn/pwm/investment-plan/detail
getPwmPendingInvestmentPlanDetail()🔐GET/v5/earn/pwm/investment-plan/new-plan
claimPwmWithdrawableFunds()🔐POST/v5/earn/pwm/investment-plan/claim
getPwmInvestmentPlanAssetTrend()🔐GET/v5/earn/pwm/investment-plan/asset-trend
getPwmFundHistoricalNav()🔐GET/v5/earn/pwm/investment-plan/fund-nav
subscribePwmInvestmentPlan()🔐POST/v5/earn/pwm/investment-plan/subscribe
investMorePwmInvestmentPlan()🔐POST/v5/earn/pwm/investment-plan/invest-more
redeemPwmInvestmentPlan()🔐POST/v5/earn/pwm/investment-plan/redeem
getPwmInvestmentPlanOrders()🔐GET/v5/earn/pwm/investment-plan/order
getPwmSubscribableProductInfo()GET/v5/earn/pwm/customize-plan/product
createPwmCustomizeInvestmentPlan()🔐POST/v5/earn/pwm/customize-plan/create
getPwmAllFunds()🔐GET/v5/earn/pwm/asset-manager/all-funds
settlePwmFundProfit()🔐POST/v5/earn/pwm/asset-manager/settle-profit
createPwmFund()🔐POST/v5/earn/pwm/asset-manager/create-fund
createPwmAssetManagerInvestmentPlan()🔐POST/v5/earn/pwm/asset-manager/create-investment-plan
getPwmAssetManagerInvestmentPlans()🔐GET/v5/earn/pwm/asset-manager/get-investment-plan
managePwmAssetManagerInvestmentPlan()🔐POST/v5/earn/pwm/asset-manager/manage-investment-plan
getPwmAllFundOrders()🔐GET/v5/earn/pwm/asset-manager/all-order
managePwmFundOrder()🔐POST/v5/earn/pwm/asset-manager/manage-order
createPwmFundSubAccount()🔐POST/v5/earn/pwm/asset-manager/create-sub-account
pwmFundTransfer()🔐POST/v5/earn/pwm/fund-transfer
getPwmFundTransferRecords()🔐GET/v5/earn/pwm/query-fund-transfer-result
queryCardAssetRecords()🔐POST/v5/card/transaction/query-asset-records
queryCardPointsBalance()🔐POST/v5/card/reward/points/balance
queryCardPointsRecords()🔐POST/v5/card/reward/points/records
queryCardPointsTier()🔐POST/v5/card/reward/points/tier
queryCardMallItemList()🔐POST/v5/card/reward/mall/item/list
queryCardPointCashbackDetail()🔐POST/v5/card/reward/point/cashback/detail
createRFQ()🔐POST/v5/rfq/create-rfq
getRFQConfig()🔐GET/v5/rfq/config
cancelRFQ()🔐POST/v5/rfq/cancel-rfq
cancelAllRFQ()🔐POST/v5/rfq/cancel-all-rfq
createRFQQuote()🔐POST/v5/rfq/create-quote
executeRFQQuote()🔐POST/v5/rfq/execute-quote
cancelRFQQuote()🔐POST/v5/rfq/cancel-quote
cancelAllRFQQuotes()🔐POST/v5/rfq/cancel-all-quotes
getRFQRealtimeInfo()🔐GET/v5/rfq/rfq-realtime
getRFQHistory()🔐GET/v5/rfq/rfq-list
getRFQRealtimeQuote()🔐GET/v5/rfq/quote-realtime
getRFQHistoryQuote()🔐GET/v5/rfq/quote-list
getRFQTrades()🔐GET/v5/rfq/trade-list
getRFQPublicTrades()🔐GET/v5/rfq/public-trades
acceptNonLPQuote()🔐POST/v5/rfq/accept-other-quote
getP2PAccountCoinsBalance()🔐GET/v5/asset/transfer/query-account-coins-balance
getP2POnlineAds()🔐POST/v5/p2p/item/online
createP2PAd()🔐POST/v5/p2p/item/create
cancelP2PAd()🔐POST/v5/p2p/item/cancel
updateP2PAd()🔐POST/v5/p2p/item/update
getP2PPersonalAds()🔐POST/v5/p2p/item/personal/list
getP2PAdDetail()🔐POST/v5/p2p/item/info
getP2POrders()🔐POST/v5/p2p/order/simplifyList
getP2POrderDetail()🔐POST/v5/p2p/order/info
getP2PPendingOrders()🔐POST/v5/p2p/order/pending/simplifyList
markP2POrderAsPaid()🔐POST/v5/p2p/order/pay
releaseP2POrder()🔐POST/v5/p2p/order/finish
sendP2POrderMessage()🔐POST/v5/p2p/order/message/send
getP2POrderMessages()🔐POST/v5/p2p/order/message/listpage
getP2PUserInfo()🔐POST/v5/p2p/user/personal/info
getP2PCounterpartyUserInfo()🔐POST/v5/p2p/user/order/personal/info
getP2PUserPayments()🔐POST/v5/p2p/user/payment/list
setApiRateLimit()🔐POST/v5/apilimit/set
queryApiRateLimit()🔐GET/v5/apilimit/query
getRateLimitCap()🔐GET/v5/apilimit/query-cap
getAllRateLimits()🔐GET/v5/apilimit/query-all

websocket-api-client.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in websocket-api-client.ts.

This client provides WebSocket API endpoints which allow for faster interactions with the Bybit API via a WebSocket connection.

FunctionAUTHHTTP MethodEndpoint
submitNewOrder()🔐WSorder.create
amendOrder()🔐WSorder.amend
cancelOrder()🔐WSorder.cancel
batchSubmitOrders()🔐WSorder.create-batch
batchAmendOrder()🔐WSorder.amend-batch
batchCancelOrder()🔐WSorder.cancel-batch
View endpoint map sourceShowing the available endpoint reference map.

Bybit JavaScript FAQ

What does the Bybit JavaScript SDK cover?

Bybit supports Spot, Futures, Options, WebSockets, and WebSocket API workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.

How do I authenticate private Bybit API calls in JavaScript?

Install bybit-api from npm & pass API credentials into the SDK client options, as shown in the Bybit JavaScript examples above. The SDK handles the exchange-specific signing requirements for private requests.

Does the Bybit JavaScript SDK help with WebSocket connection management?

Yes. Use the SDK WebSocket client for subscriptions, reconnect handling, and stream lifecycle management instead of building raw socket flows yourself.

When should I use the Bybit WebSocket API instead of REST?

Use REST for standard request and response workflows such as account queries and order management. Use the WebSocket API flow when you want persistent low-latency interactions over a connected session.

Direct Example Files

Open the example files below for JavaScript and TypeScript-compatible request, authentication, WebSocket, and Node.js service patterns.

Continue with implementation resources

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.