Skip to content

API Methods

Igor Sazonov edited this page Jan 31, 2026 · 1 revision

API Methods

The bybit-php library provides a universal request() method for making API calls, as well as a number of convenient wrapper methods for common endpoints.

Universal Request Method

The request() method allows you to make any GET or POST request to the Bybit V5 API.

$response = $client->request(string $method, string $path, array $params = []): array;

Example: Get K-line Data

$klines = $client->request("GET", "/v5/market/kline", [
    "category" => "linear",
    "symbol" => "BTCUSDT",
    "interval" => "60",
    "limit" => 200
]);

Wrapper Methods

The library also includes a number of wrapper methods for the most commonly used API endpoints. These methods provide a more convenient and readable way to make API calls.

Market Data

  • getServerTime(): Get the server time.
  • getTickers(array $params): Get the latest tickers.
  • getKline(array $params): Get k-line (candlestick) data.
  • getOrderbook(array $params): Get the order book.
  • getRecentTrades(array $params): Get recent public trades.

Order Management

  • createOrder(array $params): Create a new order.
  • amendOrder(array $params): Amend an existing order.
  • cancelOrder(array $params): Cancel an existing order.
  • cancelAllOrders(array $params): Cancel all open orders for a symbol.
  • getOpenOrders(array $params): Get your open orders.
  • getHistoryOrders(array $params): Get your order history.

Position Management

  • getPositions(array $params): Get your open positions.
  • setLeverage(string $category, string $symbol, int $leverage): Set the leverage for a symbol.
  • switchPositionMode(array $params): Switch between One-Way and Hedge mode.
  • setTradingStop(array $params): Set a take profit or stop loss for a position.

Account & Wallet

  • getWalletBalance(array $params): Get your wallet balance.
  • getTransactionLog(array $params): Get your transaction log.
  • getAccountInfo(): Get your account information.

Clone this wiki locally