Bybit

Bybit

Bybit API Information

Bybit API Link: https://bybit-exchange.github.io/docs/v5/guide

Basic Endpoints

  • Primary Endpoint: https://api.bybit.com, https://api.bytick.com

Important

  • Netherlands users: use https://api.bybit.nl for mainnet
  • Hong Kong users: use https://api.byhkbit.com for mainnet
  • Turkey users: use https://api.bybit-tr.com for mainnet
  • Kazakhstan users: use https://api.bybit.kz for mainnet
  • Bybit cannot guarantee stability or performance for users in these countries/regions if you use api.bybit.com, due to the possibility of this domain being inaccessible at any time.

Parameters for Endpoints Requiring Authentication

Bybit API Link: https://bybit-exchange.github.io/docs/v3/intro

The following HTTP header keys should be used for authentication:

  • X-BAPI-API-KEY - API key
  • X-BAPI-TIMESTAMP - UTC timestamp (in milliseconds)
  • X-BAPI-SIGN - signature derived from the request parameters
  • X-Referer or Referer - header for broker users only

Additionally, X-BAPI-RECV-WINDOW (unit: milliseconds, default: 5,000) is provided to specify how long an HTTP request is valid. This is also used to prevent replay attacks. A smaller X-BAPI-RECV-WINDOW is more secure, but if the transmission time exceeds your X-BAPI-RECV-WINDOW value, your request may fail.

HTTP Error Codes

Bybit API Link: https://bybit-exchange.github.io/docs/v5/error

  • 400 Bad Request – You must send the request with GET / POST (uppercase required)
  • 401 Invalid Request – 1. Use the correct key for access; 2. Include authentication parameters in the request header
  • 403 Forbidden Request – Possible reasons: 1. IP rate limit violation; 2. Sending a GET request with an empty JSON body; 3. Using a U.S. IP
  • 404 Cannot Find Path – Possible reasons: 1. Incorrect path; 2. Category value does not match the account mode
  • 429 System Level Frequency Protection – Please retry when encountered

LIMITS

Bybit API Link: https://bybit-exchange.github.io/docs/v5/rate-limit

  • GET/POST method (shared):
    • No more than 600 requests are allowed within any 5-second time window.

The API rate limit is based on per second and per UID sliding window. In other words, it is a limit per second per UID. For each request to the API, the response includes the following headers:

  • X-Bapi-Limit-Status – your remaining requests for the current endpoint
  • X-Bapi-Limit – your current limit for the current endpoint
  • X-Bapi-Limit-Reset-Timestamp – if you exceeded the rate_limit, shows when your request limit will reset; otherwise, this is just the current timestamp (may not exactly match timeNow).

If you receive an HTTP 403 (Access Denied) response, your IP address has been temporarily or permanently blocked. You should immediately review the guidelines below to ensure your application is not continuing to violate limits. If still blocked after 30 minutes, you have likely received a permanent ban.

RCXT Bybit API Information

Bybit exchange has 1 Base Endpoint:

  • apiUrl: api.bybit-tr.com

Rate Limits

The rate limits for each endpoint on the Bybit exchange are as follows:

Limit (1 saniye) Spot Margin Deposit Withdrawal Ticker
Fetch Balances 5 Request Weight 5 Request Weight
Fetch Orders 20 Request Weight
Fetch Trades 20 Request Weight
Fetch DepositWithdrawals 20 Request Weight 20 Request Weight
Fetch Ticker 20 Request Weight
Limit (1 dakika) TransferIn TransferOut
Fetch DepositWithdrawals 100 Request Weight 300 Request Weight

Fetch Balances

Spot Balance
  • Base Endpoint olarak apiUrl(api.bybit-tr.com) kullanır.
  • Endpoint olarak /v5/asset/transfer/query-account-coins-balance kullanılır.
  • RCXT Endpoint olarak api/v1/bybit/balances kullanılır.

The user sends a GET request to query Bybit wallet balances. This request must include the required header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has a specific Request Weight value assigned. For Spot Balance, the Request Weight value is 5.
Margin Balance
  • Uses apiUrl (api.bybit-tr.com) as the Base Endpoint.
  • Uses /v5/asset/transfer/query-account-coins-balance as the Endpoint.
  • Uses api/v1/bybit/balances as the RCXT Endpoint.

The user sends a GET request to query Bybit wallet balances. This request must include the required header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has a specific Request Weight value assigned. For Margin Balance, the Request Weight value is 5.

Response Example:

{
  "spot": [
    {
      "coin": "BTTC",
      "total": "208850.4"
    }
  ],
  "margin": [
    {
      "coin": "DOGE",
      "total": "0.00399992"
    }
  ],
  "isolatedMargin": null,
  "futures": null,
  "earnings": null
}

Fetch Trades

Spot Trades
  • Uses apiUrl (api.bybit-tr.com) as the Base Endpoint.

  • Uses /v5/execution/list as the Endpoint.

  • Uses api/v1/bybit/trades as the RCXT Endpoint.

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, symbol, cursor, and type:

    • startTime: The date from which to start fetching data.
    • symbol: The trading pair to fetch trades for (e.g., BTCUSDT).
    • cursor: Used for pagination, specifies which page to fetch.
    • type: Options include spot. For Spot Trades, set to spot.
  • Limiter:

    • Each API endpoint has a specific Request Weight value assigned.
    • For Spot Trades, the Request Weight value is 20.
    • A maximum of 100 records can be fetched per page.

Response Example:

{
  "trades": [
    {
      "orderId": "226664511",
      "tradeId": "27082209",
      "isBuyer": false,
      "isMaker": false,
      "price": "0.07610000",
      "quantity": "199.90000000",
      "symbol": "ACAUSDT",
      "time": 1737552748284,
      "commission": "0.01521239",
      "commissionCurrency": "USDT"
    }
  ],
  "cursor": "eyJtaW5JRCI6MTQyNjA4Mzc5LCJtYXhJRCI6MTQyNjA4Mzc5fQ=="
}

Fetch Orders

Spot Orders
  • Uses apiUrl(api.bybit-tr.com) as the Base Endpoint.

  • Uses /v5/order/history as the Endpoint.

  • Uses api/v1/bybit/orders as the RCXT Endpoint.

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, symbol, cursor, singleOrderId, type, and orderStatus:

    • startTime: The date from which to fetch data.
    • symbol: Specifies the trading pair for which orders should be fetched (e.g. BTCUSDT).
    • cursor: Used for pagination, specifies which page to fetch.
    • singleOrderId: Used to filter by a single order ID.
    • type: spot option is available. For Spot Orders, spot should be selected.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders. If “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint has a specific Request Weight value assigned. For Spot Orders, the Request Weight value is 20.
    • A maximum of 50 records can be fetched per page.
Spot Open Orders
  • Uses apiUrl(api.bybit-tr.com) as the Base Endpoint.

  • Uses /v5/order/history as the Endpoint.

  • Uses api/v1/bybit/orders as the RCXT Endpoint.

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, symbol, cursor, singleOrderId, type, and orderStatus:

    • startTime: The date from which to fetch data.
    • symbol: Specifies the trading pair for which orders should be fetched (e.g. BTCUSDT).
    • cursor: Used for pagination, specifies which page to fetch.
    • singleOrderId: Used to filter by a single order ID.
    • type: spot option is available. For Spot Open Orders, spot should be selected.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders. If “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint has a specific Request Weight value assigned. For Spot Open Orders, the Request Weight value is 20.
    • A maximum of 50 records can be fetched per page.

Response Example:

{
  "orders": [
    {
      "orderId": "1881364520706670592",
      "symbol": "XRPUSDT",
      "type": "MARKET",
      "price": "3.335",
      "side": "SELL",
      "time": 1737387230537,
      "status": "CLOSED",
      "executedQuantity": "2.7",
      "quantity": "2.7"
    }
  ],
  "cursor": "eyJtaW5JRCI6MTQyNjA4Mzc5LCJtYXhJRCI6MTQyNjA4Mzc5fQ=="
}

Fetch DepositWithdrawals

Deposit
  • Uses Base Endpoint as apiUrl(api.bybit-tr.com).

  • Uses Endpoint /v5/asset/deposit/query-internal-record.

  • Uses RCXT Endpoint api/v1/bybit/deposit-withdraw-history.

  • apiKey and secretKey values are taken from the Header.

  • Query parameters include startTime, cursor, and type:

    • startTime: The date from which data should be fetched.
    • cursor: Used for pagination, indicates which page to fetch.
    • type: Possible values are deposit, withdrawal, transferIn, and transferOut. For deposit, use deposit.
  • Limiter:

    • Each API endpoint has an assigned Request Weight value. The Request Weight for Deposit is 20.
Withdrawal
  • Uses Base Endpoint as apiUrl(api.bybit-tr.com).

  • Uses Endpoint /v5/asset/withdraw/query-record.

  • Uses RCXT Endpoint api/v1/bybit/deposit-withdraw-history.

  • apiKey and secretKey values are taken from the Header.

  • Query parameters include startTime, cursor, and type:

    • startTime: The date from which data should be fetched.
    • cursor: Used for pagination, indicates which page to fetch.
    • type: Possible values are deposit, withdrawal, transferIn, and transferOut. For withdrawal, use withdrawal.
  • Limiter:

    • Each API endpoint has an assigned Request Weight value. The Request Weight for Withdrawal is 20.
    • A maximum of 50 records can be fetched per page.
Transfer In
  • Uses Base Endpoint as apiUrl(api.bybit-tr.com).

  • Uses Endpoint /v5/asset/deposit/query-record.

  • Uses RCXT Endpoint api/v1/bybit/deposit-withdraw-history.

  • apiKey and secretKey values are taken from the Header.

  • Query parameters include startTime, cursor, and type:

    • startTime: The date from which data should be fetched.
    • cursor: Used for pagination, indicates which page to fetch.
    • type: Possible values are deposit, withdrawal, transferIn, and transferOut. For Transfer In, use transferIn.
  • Limiter:

    • Each API endpoint has an assigned Request Weight value. The Request Weight for Transfer In is 100.
    • A maximum of 50 records can be fetched per page.
Transfer Out
  • Uses Base Endpoint as apiUrl(api.bybit-tr.com).

  • Uses Endpoint /v5/asset/withdraw/query-record.

  • Uses RCXT Endpoint api/v1/bybit/deposit-withdraw-history.

  • apiKey and secretKey values are taken from the Header.

  • Query parameters include startTime, cursor, and type:

    • startTime: The date from which data should be fetched.
    • cursor: Used for pagination, indicates which page to fetch.
    • type: Possible values are deposit, withdrawal, transferIn, and transferOut. For Transfer Out, use transferOut.
  • Limiter:

    • Each API endpoint has an assigned Request Weight value. The Request Weight for Transfer Out is 300.
    • A maximum of 50 records can be fetched per page.

Response Example:

{
  "depositWithdrawals": [
    {
      "fiatCurrency": "",
      "cryptoCurrency": "SOL",
      "fiatAmount": "",
      "cryptoAmount": "0.030022",
      "price": "",
      "address": "GzBGq84kJScXuAswzURKuEtYbZS667KBRwX8mp5D2BrC",
      "orderId": "",
      "transactionId": "2pgAknJDt7K9LMgGpsf2xunM9gqzP7PGek8Q1bFVskC55SerxJuJTWFFWEz2RgqYvsPsNUAbFEvUgt698NLU12jB",
      "fee": "",
      "network": "SOL",
      "status": "Success",
      "time": 1737380916000
    }
  ],
  "cursor": "eyJtaW5JRCI6MTQyNjA4Mzc5LCJtYXhJRCI6MTQyNjA4Mzc5fQ=="
}

Fetch Ticker

Ticker
  • Uses Base Endpoint as apiUrl(api.bybit-tr.com).

  • Uses Endpoint /v5/market/tickers.

  • Uses RCXT Endpoint api/v1/bybit/ticker.

  • Only the symbol query parameter is required (e.g. BTCUSDT):

    • symbol: Specifies the trading pair symbol.
  • Limiter:

    • Each API endpoint has an assigned Request Weight value. The Request Weight for Ticker is 20.

Response Example:

{
  "symbol": "BTCUSDT",
  "price": "104562.53000000"
}