---
title: "Bybit REST V5 Private JavaScript SDK Example | Siebly"
description: "Bybit REST V5 private JavaScript example for the Siebly Bybit SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Bybit/Rest/rest-v5-private"
robots: "index,follow"
---

# Bybit REST V5 Private JavaScript SDK Example

Bybit REST V5 private JavaScript example for the Siebly Bybit SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Bybit](/examples/Bybit) / [Rest](/examples/Bybit/Rest) / [rest-v5-private.ts](/examples/Bybit/Rest/rest-v5-private)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bybit/Rest/rest-v5-private.ts)

[Open the Bybit JavaScript SDK guide](/sdk/bybit/javascript)

## rest-v5-private.ts

```typescript
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);
  }
})();
```
