Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/bitget-api/llms.txt

Use this file to discover all available pages before exploring further.

The Bitget API SDK gives Node.js and TypeScript developers a complete, production-ready interface to Bitget’s trading platform. Whether you’re building trading bots, portfolio trackers, or real-time dashboards, the SDK wraps every REST endpoint and WebSocket stream in a strongly-typed, promise-based API.

Quickstart

Install the SDK and make your first API call in under five minutes.

Authentication

Configure API keys, HMAC or RSA signing, and demo trading credentials.

REST Client V3

Use the V3/UTA client for the latest Unified Trading Account REST APIs.

WebSocket Clients

Subscribe to real-time market data and account events via WebSocket.

What’s Included

The bitget-api package exports five main clients covering every Bitget API generation:
ClientPurpose
RestClientV3V3/UTA REST APIs — recommended for new projects
RestClientV2V2 Classic REST APIs
WebsocketClientV3V3/UTA real-time data streams
WebsocketClientV2V2 real-time data streams
WebsocketAPIClientREST-like order placement over WebSocket

Key Features

Full TypeScript Support

Strongly-typed request and response objects for every endpoint, generated from source.

Auto-Reconnect WebSockets

Smart persistence with configurable heartbeats, automatic reconnect, and resubscription.

HMAC & RSA Auth

Supports both HMAC and RSA authentication methods with optional custom signing functions.

Browser Compatible

Ships a webpack bundle for use in browser environments alongside the Node.js package.

Getting Started

1

Install the package

npm install bitget-api
2

Create an API client

import { RestClientV3 } from 'bitget-api';

const client = new RestClientV3({
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
  apiPass: process.env.API_PASS,
});
3

Make your first call

const balances = await client.getBalances();
console.log(balances);
4

Subscribe to WebSocket data

import { WebsocketClientV3, WS_KEY_MAP } from 'bitget-api';

const ws = new WebsocketClientV3({ apiKey: '...', apiSecret: '...', apiPass: '...' });
ws.on('update', (data) => console.log(data));
ws.subscribe({ topic: 'ticker', payload: { instType: 'spot', symbol: 'BTCUSDT' } }, WS_KEY_MAP.v3Public);
If your Bitget account has been upgraded to the Unified Trading Account, use RestClientV3 and WebsocketClientV3. Otherwise, use the V2 clients.

Resources

REST Client V2

Classic V2 REST endpoints for spot, futures, margin, and more.

WebSocket API Client

Place orders over a persistent WebSocket connection.

Error Handling

Handle API errors and error codes gracefully.

Logging

Customise or silence SDK log output.

Browser Usage

Bundle the SDK for use in frontend applications.

Demo Trading

Connect to Bitget’s simulated trading environment.

Build docs developers (and LLMs) love