---
title: "Bitget REST Public Spot JavaScript SDK Example | Siebly"
description: "Bitget V2 Classic REST public spot JavaScript example for the Siebly Bitget SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Bitget/V2%20-%20Classic/Rest/rest-public-spot"
robots: "index,follow"
---

# Bitget REST Public Spot JavaScript SDK Example

Bitget V2 Classic REST public spot JavaScript example for the Siebly Bitget SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Bitget](/examples/Bitget) / [V2 - Classic](/examples/Bitget/V2%20-%20Classic) / [Rest](/examples/Bitget/V2%20-%20Classic/Rest) / [rest-public-spot.ts](/examples/Bitget/V2%20-%20Classic/Rest/rest-public-spot)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bitget/V2%20-%20Classic/Rest/rest-public-spot.ts)

[Open the Bitget JavaScript SDK guide](/sdk/bitget/javascript)

## rest-public-spot.ts

```typescript
import { RestClientV2 } from 'bitget-api';

const restClient = new RestClientV2();

(async () => {
  try {
    const response = await restClient.getSpotCandles({
      symbol: 'BTCUSDT',
      granularity: '1min',
      limit: '1000',
    });

    console.table(response.data);
    console.log('getCandles: ', response.data.length);
  } catch (e) {
    console.error('request failed: ', e);
  }
})();
```
