TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/kucoin-api/llms.txt
Use this file to discover all available pages before exploring further.
kucoin-api package is a professional, production-grade SDK for integrating with KuCoin’s full suite of REST APIs and WebSocket streams. It provides strongly-typed interfaces for every endpoint, an event-driven WebSocket client with automatic reconnection, and a convenient WebSocket API client that lets you trade over WebSocket as if you were calling a regular REST endpoint. Whether you are building spot bots, futures strategies, broker tooling, or real-time dashboards, this SDK removes all the low-level HTTP and WebSocket plumbing so you can focus on your logic.
Key Features
- Complete API coverage — Dedicated REST clients for Spot, Futures, Broker, and Unified API operations, plus a unified WebSocket client for all markets.
- Full TypeScript support — Strongly typed request parameters and response objects for every endpoint, with auto-generated type declarations.
- Robust WebSocket handling — Configurable heartbeats, automatic reconnect-then-resubscribe workflows, and an
reconnectedevent so your code stays in sync after any network hiccup. - WebSocket API client — Trade via WebSocket using a REST-like promise interface with
WebsocketAPIClient, no raw WebSocket management required. - Browser-friendly signing — The default HMAC signature mechanism uses the Web Crypto API, making the SDK compatible with both Node.js and browser/bundler environments.
- ESM + CJS — Ships with both module formats so it works out of the box in TypeScript ESM projects and CommonJS Node.js scripts alike.
- Regional support — Built-in
apiRegionoption to route requests to KuCoin Global (kucoin.com), KuCoin EU (kucoin.eu), or KuCoin AU. - Proxy support — Axios-based HTTP layer with full proxy configuration.
REST API Clients
The SDK exposes four specialised REST clients, each targeting a distinct part of the KuCoin platform:SpotClient
Spot trading, margin trading, account management, deposits, withdrawals, sub-accounts, and all spot market data endpoints.
FuturesClient
Futures order placement and management, positions, funding rates, risk limits, and futures market data.
BrokerClient
Broker and sub-account lifecycle management, rebate queries, and broker-specific transfer operations.
UnifiedAPIClient
KuCoin’s new-generation unified endpoints for cross-product market data across Spot, Futures, and Margin in one interface.
WebSocket Clients
WebsocketClient
A single unified WebSocket client for all public and private streams across Spot and Futures markets. Event-driven, with automatic connection management.
WebsocketAPIClient
A REST-like wrapper around KuCoin’s WebSocket API. Submit orders, cancel orders, and query state over an auto-managed WebSocket connection using
async/await.Installation
Install the package from npm using your preferred package manager:Project Structure
The
examples/ directory on GitHub contains dozens of runnable TypeScript files covering every major use case. These are the canonical reference for real-world usage patterns.Key Exports
The package re-exports everything you need from a single entry point. The most commonly used names are:| Export | Kind | Description |
|---|---|---|
SpotClient | Class | Spot & margin REST client |
FuturesClient | Class | Futures REST client |
BrokerClient | Class | Broker REST client |
UnifiedAPIClient | Class | Unified Trading Account REST client |
WebsocketClient | Class | Unified WebSocket client for all streams |
WebsocketAPIClient | Class | REST-like WebSocket API client |
DefaultLogger | Constant / Type | Default logger used internally; spread and override to customise log output |
WS_KEY_MAP | Constant | Map of all valid WebSocket connection keys (e.g. spotPublicV1, futuresPrivateV1) |
WsTopicRequest | Interface | Typed topic-subscription object with optional payload used by WebsocketClient.subscribe() |
RestClientOptions | Interface | Full options object accepted by every REST client constructor |
WSClientConfigurableOptions | Interface | Options accepted by WebsocketClient and WebsocketAPIClient constructors |
Next Steps
Quickstart
Make your first public and private API call in under 5 minutes.
Authentication
Learn how to configure API keys, regions, access tokens, and custom signing.