Skip to main content

Documentation Index

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

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

The @siebly/kraken-api SDK gives you a single, production-tested JavaScript and TypeScript interface to all of Kraken’s REST APIs and WebSocket streams. Whether you’re building a trading bot, a market data dashboard, or a portfolio monitor, you get dedicated clients for every Kraken product group — all with full TypeScript definitions, automatic WebSocket reconnection, and both ESM and CJS module support.

Quickstart

Make your first Kraken API call in under 5 minutes

Authentication

Set up API keys for Spot and Derivatives trading

Spot Client

REST API for spot trading, account management, and funding

Derivatives Client

REST API for futures and perpetual contract trading

WebSocket Streams

Real-time market data and account updates via WebSockets

API Reference

Full method signatures, parameters, and return types

What’s in the SDK

The SDK ships five client classes, each covering a distinct segment of Kraken’s API surface:

SpotClient

Spot trading, staking/earn, deposits, withdrawals, and subaccount management

DerivativesClient

Futures and perpetual contracts — market data, order management, and account state

WebsocketClient

Unified WebSocket client for all Kraken markets — public and private streams

WebsocketAPIClient

REST-like Spot trading over a persistent WebSocket connection for lower latency

InstitutionalClient

OTC trading desk and custody APIs for institutional accounts

PartnerClient

Embedded finance and ramp APIs for partner integrations

Get started

1

Install the package

npm install @siebly/kraken-api
2

Create your first client

import { SpotClient } from '@siebly/kraken-api';

const client = new SpotClient();
const ticker = await client.getTicker({ pair: 'XBTUSD' });
console.log(ticker);
3

Add credentials for private endpoints

const client = new SpotClient({
  apiKey: process.env.API_SPOT_KEY,
  apiSecret: process.env.API_SPOT_SECRET,
});

const balance = await client.getAccountBalance();
4

Subscribe to real-time data

import { WebsocketClient, WS_KEY_MAP } from '@siebly/kraken-api';

const ws = new WebsocketClient();
ws.on('message', (data) => console.log(data));

ws.subscribe(
  { topic: 'ticker', payload: { symbol: ['BTC/USD'] } },
  WS_KEY_MAP.spotPublicV2,
);

Key features

  • Complete API coverage — dedicated REST clients for Spot, Derivatives, Institutional, and Partner operations
  • Unified WebSocket client — one WebsocketClient for all Kraken markets, public and private
  • WebSocket API tradingWebsocketAPIClient wraps Spot order management in awaitable promises over a persistent connection
  • TypeScript-first — strongly typed request and response shapes for every method
  • Automatic reconnection — heartbeat monitoring, reconnect, and resubscribe handled for you
  • Dual module support — works in ESM and CJS projects without configuration
  • Browser compatible — HMAC signing uses the Web Crypto API for frontend use
  • Testnet support — route Derivatives calls to Kraken’s demo environment with testnet: true
Public market data endpoints (tickers, order books, candles, recent trades) do not require API keys. Only private endpoints — account balances, order management, deposits, and withdrawals — need authentication.

Build docs developers (and LLMs) love