Kraken JavaScript SDK
Installation and integration guidance for the Kraken SDK in JavaScript.
JavaScript SDK Usage
Use framework-neutral JavaScript request and event flows across Node.js-compatible runtimes.
In JavaScript, use the package directly from readable examples. TypeScript remains useful for larger integrations, but the same client patterns work in plain JavaScript.
What This SDK Covers
- Complete Kraken REST API integrations for exchange-specific workflows.
- Robust Kraken WebSocket support for market and account stream handling.
- JavaScript-friendly usage patterns for production integration work.
- Adaptable JavaScript examples & guides under /examples for implementation reference.
- Framework-neutral JavaScript snippets that stay approachable in all JavaScript runtimes.
Install Package
npm install @siebly/kraken-api
# or
pnpm install @siebly/kraken-api
yarn add @siebly/kraken-api
Quickstart REST API Walkthrough
Easily start working with Kraken Derivatives REST APIs in JavaScript.
- Install the Kraken JavaScript SDK via NPM:
npm install @siebly/kraken-api. - Import the
DerivativesClientclass for Kraken futures and derivatives REST endpoints. - If spot is preferred, import the
SpotClient, which is the dedicated utility class wrapped around Kraken's Spot REST APIs. - Create an authenticated
DerivativesClientinstance with your API credentials. - Call REST API methods as functions and await their responses.
In this example, we:
- Edit an existing order by updating parameters such as the limit price.
- Cancel a single open order by
order_id. - Cancel all open orders on the account.
- Cancel all open orders for a specific symbol such as
PF_ETHUSD. - Demonstrate batch order management by combining edit and cancel actions in one request.
This script is designed as a practical order management walkthrough for Kraken Derivatives, showing common authenticated API calls in JavaScript and the shapes of the request payloads involved.
For a full map of available REST API methods, check out the endpoint reference below.
Quickstart REST API Example
/* eslint-disable @typescript-eslint/no-unused-vars */
// This example shows how to call Kraken API endpoint with either node.js,
// javascript (js) or typescript (ts) with the npm module "@siebly/kraken-api" for Kraken exchange
// for ORDER MANAGEMENT
import { DerivativesClient } from '@siebly/kraken-api';
// initialise the client
/**
*
* Kraken Futures API uses API Key and API Secret
*
* Example:
* {
* apiKey: 'your-api-key',
* apiSecret: 'your-api-secret',
* }
*/
const client = new DerivativesClient({
apiKey: process.env.API_FUTURES_KEY || 'insertApiKeyHere',
apiSecret: process.env.API_FUTURES_SECRET || 'insertApiSecretHere',
});
async function editOrder() {
try {
// Edit an existing order
const editResult = await client.editOrder({
orderId: 'a04d0f84-36d4-4499-8382-96fcfc3ce7aa', // Or use cliOrdId instead
limitPrice: 1100, // New limit price
// or add some other parameters you want to edit
});
console.log('Edit Order Result: ', JSON.stringify(editResult, null, 2));
// Response includes:
// - status: edited, invalidSize, invalidPrice, etc.
// - orderEvents: Array of order events
} catch (e) {
console.error('Edit order error: ', e);
}
}
async function cancelOrder() {
try {
// Cancel a single order
const cancelResult = await client.cancelOrder({
order_id: 'a04d0f84-36d4-4499-8382-96fcfc3ce7aa', // Or use cliOrdId
});
console.log('Cancel Order Result: ', JSON.stringify(cancelResult, null, 2));
// Response status:
// - cancelled: Successfully cancelled
// - filled: Order was already filled
// - notFound: Order not found
} catch (e) {
console.error('Cancel order error: ', e);
}
}
async function cancelAllOrders() {
try {
// Cancel all open orders
const cancelAllResult = await client.cancelAllOrders();
console.log(
'Cancel All Orders Result: ',
JSON.stringify(cancelAllResult, null, 2),
);
// Response includes:
// - status: cancelled or noOrdersToCancel
// - cancelledOrders: Array of cancelled order IDs
} catch (e) {
console.error('Cancel all orders error: ', e);
}
}
async function cancelAllOrdersBySymbol() {
try {
// Cancel all orders for specific symbol
const cancelBySymbol = await client.cancelAllOrders({
symbol: 'PF_ETHUSD',
});
console.log(
'Cancel Orders by Symbol Result: ',
JSON.stringify(cancelBySymbol, null, 2),
);
} catch (e) {
console.error('Cancel orders by symbol error: ', e);
}
}
async function batchOrderManagement() {
try {
// Send, edit, and cancel orders in a single batch request
const batchResult = await client.batchOrderManagement({
json: {
batchOrder: [
// Edit existing order
{
order: 'edit',
order_id: 'a04d1143-757a-4dba-a0a7-687303b9c62d',
limitPrice: 900,
},
// Cancel existing order
{
order: 'cancel',
order_id: 'a04d116e-fb9c-4bcf-9eaf-ea90254439b3',
},
],
},
});
console.log('Batch Order Result: ', JSON.stringify(batchResult, null, 2));
// Response includes batchStatus array with results for each order
// - status: placed, edited, cancelled, or rejection reason
// - order_tag: Maps back to your request
} catch (e) {
console.error('Batch order management error: ', e);
}
}
// Uncomment the function you want to test:
// editOrder();
// cancelOrder();
// cancelAllOrders();
// cancelAllOrdersBySymbol();
// batchOrderManagement();
Quickstart WebSocket Walkthrough
Connecting to Kraken Derivatives private WebSocket streams is straightforward with the WebsocketClient.
- Install the Kraken JavaScript SDK via NPM:
npm install @siebly/kraken-api. - Import the
WebsocketClient,WS_KEY_MAP, and any typed topic helpers you want to use. - Create an authenticated client instance with your Kraken futures API credentials.
- Configure event handlers for key lifecycle events such as
open,message,response,reconnecting,reconnected,close,exception, andauthenticated. - Subscribe to private topics on the
derivativesPrivateV1connection key for private derivatives topics. - Spot is also available via the dedicated spot connection key.
In this example, we:
- Subscribe to private derivatives topics including
open_orders,open_orders_verbose,fills,balances,open_positions,account_log, andnotifications_auth. - Show both typed topic request objects and simple topic-name subscriptions.
- Rely on the SDK to automatically fetch, cache, and sign the challenge parameters required for private derivatives subscriptions.
- Authentication is completely automatic with the provided API keys.
- If the connection drops or goes stale, the highly resilient WebsocketClient for Kraken will quickly detect any issues, respawn a replacement connection and resubscribe to the topics you were consuming before the drop.
This setup lets you monitor derivatives account activity in real time without polling the REST API for the same information.
Quickstart WebSocket Example
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {
DefaultLogger,
LogParams,
WebsocketClient,
WS_KEY_MAP,
WSTopicRequest,
} from '@siebly/kraken-api';
import { WSDerivativesTopic } from '@siebly/kraken-api';
const customLogger: DefaultLogger = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
trace: (...params: LogParams): void => {
// console.log(new Date(), '--> trace', ...params);
},
info: (...params: LogParams): void => {
console.log(new Date(), '--> info', ...params);
},
error: (...params: LogParams): void => {
console.error(new Date(), '--> error', ...params);
},
};
async function start() {
const account = {
key: process.env.API_FUTURES_KEY || 'keyHere',
secret: process.env.API_FUTURES_SECRET || 'secretHere',
};
/**
* The WebsocketClient is the core class to manage WebSocket subscriptions. Give it the topics you want to subscribe to, and it will handle the rest:
* - Connection management (connect, disconnect, reconnect)
* - Authentication for private topics
* - Subscription management (subscribe, unsubscribe, resubscribe on reconnect)
* - Message handling (dispatch messages to appropriate handlers)
*
* All you need to do is provide the topics you want to subscribe to when calling `subscribe()`, and the client will take care of the rest.
*
* Here we create a WebsocketClient instance with API key/secret for private topic subscriptions.
*
* In terms of product groups such as Spot, Derivatives, etc., the WebsocketClient understand the product group from the WsKey you provide when subscribing. For example, using `WS_KEY_MAP.spotPrivateV2` indicates that the subscription is for Spot private topics, as shown below.
*
* Refer to WS_KEY_MAP in the source code for all available WsKey options.
*/
const client = new WebsocketClient(
{
apiKey: account.key,
apiSecret: account.secret,
},
customLogger,
);
client.on('open', (data) => {
console.log(new Date(), 'connected ', data?.wsKey);
});
// Data received
client.on('message', (data) => {
console.info(new Date(), 'data received: ', JSON.stringify(data));
});
// Something happened, attempting to reconnect
client.on('reconnecting', (data) => {
console.log(new Date(), 'reconnect: ', data?.wsKey);
});
// Reconnect successful
client.on('reconnected', (data) => {
console.log(new Date(), 'reconnected: ', data?.wsKey);
});
// Connection closed. If unexpected, expect reconnect -> reconnected.
client.on('close', (data) => {
console.error(new Date(), 'close: ', data);
});
// Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate"
client.on('response', (data) => {
console.info(new Date(), 'server reply: ', JSON.stringify(data), '\n');
});
client.on('exception', (data) => {
console.error(new Date(), 'exception: ', data);
});
client.on('authenticated', (data) => {
console.error(new Date(), 'authenticated: ', data);
});
/**
* The below examples demonstrate how you can subscribe to private topics.
*
* Note: while the documentation specifies "api_key", "original_challenge" and "signed_challenge" as required parameters, but don't worry about that. The SDK will automatically:
* - Fetch the challenge using your API key,
* - Cache the challenge
* - Include the key, original challenge and signed challenge parameters for you when subscribing to private topics on the derivativesPrivateV1 WebSocket connection.
*
* You do NOT need to manually fetch or provide the "original_challenge" and "signed_challenge" tokens when subscribing to private topics.
*
* Do note that all of these include the "derivativesPrivateV1" WsKey reference. This tells the WebsocketClient to use the private "wss://futures.kraken.com/ws/v1" endpoint for these private subscription requests. It will also automatically authenticate the connection when it is established.
*/
try {
/**
* All of the following parameters require API keys for Derivatives APIs.
*
* Note: your "WsTopicRequest" does not need to include "api_key", "original_challenge" and "signed_challenge". See above for details, or below for examples.
*/
// Open orders: https://docs.kraken.com/api/docs/futures-api/websocket/open_orders
const openOrdersTopicRequest: WSTopicRequest<WSDerivativesTopic> = {
topic: 'open_orders',
};
client.subscribe(openOrdersTopicRequest, WS_KEY_MAP.derivativesPrivateV1);
// Note: if there are no parameters needed, you can also just request the topic by name
// This is the same as openOrdersTopicRequest, since openOrdersTopicRequest contains no parameters
// client.subscribe('open_orders', WS_KEY_MAP.derivativesPrivateV1);
// Open orders (verbose): https://docs.kraken.com/api/docs/futures-api/websocket/open_orders
client.subscribe('open_orders_verbose', WS_KEY_MAP.derivativesPrivateV1);
// Fills: https://docs.kraken.com/api/docs/futures-api/websocket/fills
const accountFillsTopicRequest: WSTopicRequest<WSDerivativesTopic> = {
topic: 'fills',
// Optionally, the product_ids field can be used to subscribe only to specific product.
// payload: {
// product_ids: ['PF_XBTUSD'],
// },
};
client.subscribe(accountFillsTopicRequest, WS_KEY_MAP.derivativesPrivateV1);
// Balances: https://docs.kraken.com/api/docs/futures-api/websocket/balances
client.subscribe('balances', WS_KEY_MAP.derivativesPrivateV1);
// Open Position: https://docs.kraken.com/api/docs/futures-api/websocket/open_position
client.subscribe('open_positions', WS_KEY_MAP.derivativesPrivateV1);
// Account Log: https://docs.kraken.com/api/docs/futures-api/websocket/account_log
client.subscribe('account_log', WS_KEY_MAP.derivativesPrivateV1);
// Notification: https://docs.kraken.com/api/docs/futures-api/websocket/notifications
client.subscribe('notifications_auth', WS_KEY_MAP.derivativesPrivateV1);
} catch (e) {
console.error('Req error: ', e);
}
}
start();
Quickstart WebSocket API Walkthrough
Kraken's Spot WebSocket API (WS-API) lets you send commands & requests over a persistent authenticated WebSocket connection, reducing overhead compared to opening separate REST requests. If you're building a latency sensitive system this is the ideal way to avoid the overhead seen while making REST API calls.
This Kraken JavaScript SDK's WebsocketAPIClient wraps these WS-API requests with promise-based helper methods so each command can be awaited similarly to a REST call. All the power & benefits of WebSocket API integration without the complexity of asynchronous messaging over WebSockets.
To use the WebSocket API:
- Install the Kraken JavaScript SDK via NPM:
npm install @siebly/kraken-api. - Import the dedicated
WebsocketAPIClient. - Create an authenticated
WebsocketAPIClientinstance with your API credentials. - Optionally inject a custom logger for request and connection diagnostics.
- Call the dedicated helper methods and await each response.
In this example, we:
- Submit spot orders including a basic limit order, a conditional order, and a trigger-based stop-loss order.
- Amend existing spot orders using either
cl_ord_idororder_id. - Cancel specific orders, cancel all spot orders, and configure a cancel-all-after timeout.
- Batch submit and batch cancel spot orders.
Note that:
- The SDK automatically fetches, caches, and refreshes the private WS token required for authenticated spot WS-API requests.
- The SDK will automatically handle any connection issues. Any midflight commands during a connection drop will see a rejected promise / throw, allowing you to easily handle and resubmit any failed requests as part of your standard error handling.
- The script includes placeholder order IDs and example order values that should be replaced before live use.
Quickstart WebSocket API Example
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {
DefaultLogger,
LogParams,
WebsocketAPIClient,
} from '@siebly/kraken-api';
const customLogger: DefaultLogger = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
trace: (...params: LogParams): void => {
// console.log('trace', ...params);
},
info: (...params: LogParams): void => {
console.log('info', ...params);
},
error: (...params: LogParams): void => {
console.error('error', ...params);
},
};
async function start() {
const account = {
key: process.env.API_SPOT_KEY || 'keyHere',
secret: process.env.API_SPOT_SECRET || 'secretHere',
};
/**
* The WebsocketClient is the core class to manage WebSocket subscriptions. Give it the topics you want to subscribe to, and it will handle the rest:
* - Connection management (connect, disconnect, reconnect)
* - Authentication for private topics
* - Subscription management (subscribe, unsubscribe, resubscribe on reconnect)
* - Message handling (dispatch messages to appropriate handlers)
*
* All you need to do is provide the topics you want to subscribe to when calling `subscribe()`, and the client will take care of the rest.
*
* Here we create a WebsocketClient instance with API key/secret for private topic subscriptions.
*
* In terms of product groups such as Spot, Derivatives, etc., the WebsocketClient understand the product group from the WsKey you provide when subscribing. For example, using `WS_KEY_MAP.spotPrivateV2` indicates that the subscription is for Spot private topics, as shown below.
*
* Refer to WS_KEY_MAP in the source code for all available WsKey options.
*/
const client = new WebsocketAPIClient(
{
apiKey: account.key,
apiSecret: account.secret,
},
customLogger,
);
/**
* The below examples demonstrate how you can subscribe to private topics.
*
* Note: while the documentation specifies "token" as a required parameter, the SDK will automatically:
* - fetch the token using your API key/secret,
* - manage token caching/refreshing,
* - include the token in the request for you.
*
* So you do NOT need to manually fetch or provide the token when subscribing to private topics.
*
* Do note that all of these include the "spotPrivateV2" WsKey reference. This tells the WebsocketClient to use the private "wss://ws-auth.kraken.com/v2" endpoint for these private subscription requests.
*/
try {
const addOrderResponse = await client.submitSpotOrder({
order_type: 'limit',
side: 'buy',
limit_price: 26500.4,
order_userref: 100054,
order_qty: 1.2,
symbol: 'BTC/USD',
});
console.log('addOrderResponse: ', addOrderResponse);
const addOrderConditionalResponse = await client.submitSpotOrder({
order_type: 'limit',
side: 'buy',
order_qty: 1.2,
symbol: 'BTC/USD',
limit_price: 28440,
conditional: {
order_type: 'stop-loss-limit',
trigger_price: 28410,
limit_price: 28400,
},
});
console.log('addOrderConditionalResponse: ', addOrderConditionalResponse);
const addOrderTriggersResponse = await client.submitSpotOrder({
order_type: 'stop-loss',
side: 'sell',
order_qty: 100,
symbol: 'MATIC/USD',
triggers: {
reference: 'last',
price: 10.0,
price_type: 'pct',
},
});
console.log('addOrderTriggersResponse: ', addOrderTriggersResponse);
const amendOrderResponse = await client.amendSpotOrder({
cl_ord_id: '2c6be801-1f53-4f79-a0bb-4ea1c95dfae9',
limit_price: 10000,
order_qty: 1.2,
});
console.log('amendOrderResponse: ', amendOrderResponse);
const amendOrderPostOnlyResponse = await client.amendSpotOrder({
order_id: 'OAIYAU-LGI3M-PFM5VW',
order_qty: 1.2,
limit_price: 1100.3,
deadline: '2025-11-19T09:53:59.050Z',
post_only: true,
});
console.log('amendOrderPostOnlyResponse: ', amendOrderPostOnlyResponse);
const cancelOrderResponse = await client.cancelSpotOrder({
order_id: ['OM5CRX-N2HAL-GFGWE9', 'OLUMT4-UTEGU-ZYM7E9'],
});
console.log('cancelOrderResponse: ', cancelOrderResponse);
const cancelAllResponse = await client.cancelAllSpotOrders();
console.log('cancelAllResponse: ', cancelAllResponse);
const cancelAllOrdersAfterResponse = await client.cancelAllSpotOrdersAfter({
timeout: 100,
});
console.log('cancelAllOrdersAfterResponse: ', cancelAllOrdersAfterResponse);
const batchAddResponse = await client.batchSubmitSpotOrders({
deadline: '2025-11-19T09:53:59.050Z',
orders: [
{
limit_price: 1010.1,
order_qty: 1.2,
order_type: 'limit',
order_userref: 1,
side: 'buy',
},
{
limit_price: 1100.3,
order_qty: 1.2,
order_type: 'limit',
order_userref: 2,
side: 'sell',
stp_type: 'cancel_both',
},
],
symbol: 'BTC/USD',
validate: false,
});
console.log('batchAddResponse: ', batchAddResponse);
const batchCancelResponse = await client.batchCancelSpotOrders({
orders: ['OM5CRX-N2HAL-GFGWE9', 'OLUMT4-UTEGU-ZYM7E9'],
});
console.log('batchCancelResponse: ', batchCancelResponse);
} catch (e) {
console.error('Req error: ', e);
}
}
start();
Complete Kraken API JavaScript Tutorial
Open the full Kraken API JavaScript tutorial for a guided course covering Spot REST, Futures REST, public and private WebSockets, WebSocket API trading, reconnect handling, and production rollout patterns.
Endpoint Function Reference
Endpoint maps
Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering.
The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to.
This can be used to easily find which method to call, once you have found which endpoint you're looking to use.
All REST clients are in the src folder. For usage examples, make sure to check the examples folder.
List of clients:
If anything is missing or wrong, please open an issue or let us know in our Node.js Traders telegram group!
How to use table
Table consists of 4 parts:
- Function name
- AUTH
- HTTP Method
- Endpoint
Function name is the name of the function that can be called through the SDK. Check examples folder in the repo for more help on how to use them!
AUTH is a boolean value that indicates if the function requires authentication - which means you need to pass your API key and secret to the SDK.
HTTP Method shows HTTP method that the function uses to call the endpoint. Sometimes endpoints can have same URL, but different HTTP method so you can use this column to differentiate between them.
Endpoint is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name.
SpotClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in SpotClient.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| getSystemStatus() | GET | 0/public/SystemStatus | |
| getAssetInfo() | GET | 0/public/Assets | |
| getAssetPairs() | GET | 0/public/AssetPairs | |
| getTicker() | GET | 0/public/Ticker | |
| getCandles() | GET | 0/public/OHLC | |
| getOrderBook() | GET | 0/public/Depth | |
| getRecentTrades() | GET | 0/public/Trades | |
| getRecentSpreads() | GET | 0/public/Spread | |
| getAccountBalance() | 🔐 | POST | 0/private/Balance |
| getExtendedBalance() | 🔐 | POST | 0/private/BalanceEx |
| getCreditLines() | 🔐 | POST | 0/private/CreditLines |
| getTradeBalance() | 🔐 | POST | 0/private/TradeBalance |
| getOpenOrders() | 🔐 | POST | 0/private/OpenOrders |
| getClosedOrders() | 🔐 | POST | 0/private/ClosedOrders |
| getOrders() | 🔐 | POST | 0/private/QueryOrders |
| getOrderAmends() | 🔐 | POST | 0/private/OrderAmends |
| getTradesHistory() | 🔐 | POST | 0/private/TradesHistory |
| getTrades() | 🔐 | POST | 0/private/QueryTrades |
| getOpenPositions() | 🔐 | POST | 0/private/OpenPositions |
| getLedgersInfo() | 🔐 | POST | 0/private/Ledgers |
| getLedgers() | 🔐 | POST | 0/private/QueryLedgers |
| getTradingVolume() | 🔐 | POST | 0/private/TradeVolume |
| requestLedgersExport() | 🔐 | POST | 0/private/AddExport |
| getLedgersExportStatus() | 🔐 | POST | 0/private/ExportStatus |
| getLedgersExport() | 🔐 | POST | 0/private/RetrieveExport |
| deleteLedgersExport() | 🔐 | POST | 0/private/RemoveExport |
| submitOrder() | 🔐 | POST | 0/private/AddOrder |
| amendOrder() | 🔐 | POST | 0/private/AmendOrder |
| cancelOrder() | 🔐 | POST | 0/private/CancelOrder |
| cancelAllOrders() | 🔐 | POST | 0/private/CancelAll |
| cancelAllOrdersAfter() | 🔐 | POST | 0/private/CancelAllOrdersAfter |
| getWebSocketsToken() | 🔐 | POST | 0/private/GetWebSocketsToken |
| submitBatchOrders() | 🔐 | POST | 0/private/AddOrderBatch |
| cancelBatchOrders() | 🔐 | POST | 0/private/CancelOrderBatch |
| getDepositMethods() | 🔐 | POST | 0/private/DepositMethods |
| getDepositAddresses() | 🔐 | POST | 0/private/DepositAddresses |
| getDepositsStatus() | 🔐 | POST | 0/private/DepositStatus |
| getWithdrawalMethods() | 🔐 | POST | 0/private/WithdrawMethods |
| getWithdrawalAddresses() | 🔐 | POST | 0/private/WithdrawAddresses |
| getWithdrawalInfo() | 🔐 | POST | 0/private/WithdrawInfo |
| submitWithdrawal() | 🔐 | POST | 0/private/Withdraw |
| getWithdrawalsStatus() | 🔐 | POST | 0/private/WithdrawStatus |
| cancelWithdrawal() | 🔐 | POST | 0/private/WithdrawCancel |
| submitTransferToFutures() | 🔐 | POST | 0/private/WalletTransfer |
| createSubaccount() | 🔐 | POST | 0/private/CreateSubaccount |
| submitSubaccountTransfer() | 🔐 | POST | 0/private/AccountTransfer |
| allocateEarnFunds() | 🔐 | POST | 0/private/Earn/Allocate |
| deallocateEarnFunds() | 🔐 | POST | 0/private/Earn/Deallocate |
| getEarnAllocationStatus() | 🔐 | POST | 0/private/Earn/AllocateStatus |
| getEarnDeallocationStatus() | 🔐 | POST | 0/private/Earn/DeallocateStatus |
| getEarnStrategies() | 🔐 | POST | 0/private/Earn/Strategies |
| getEarnAllocations() | 🔐 | POST | 0/private/Earn/Allocations |
| getPreTradeData() | GET | 0/public/PreTrade | |
| getPostTradeData() | GET | 0/public/PostTrade | |
| getOAuthAccessToken() | POST | oauth/token | |
| getOAuthUserInfo() | 🔐 | GET | oauth/userinfo |
| createOAuthFastApiKey() | 🔐 | POST | oauth/fast-api-key |
| deleteOAuthFastApiKey() | 🔐 | DELETE | oauth/fast-api-key |
| updateOAuthFastApiKey() | 🔐 | PUT | oauth/fast-api-key |
| listOAuthFastApiKeys() | 🔐 | GET | oauth/fast-api-keys |
DerivativesClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in DerivativesClient.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| getTradeHistory() | GET | derivatives/api/v3/history | |
| getOrderbook() | GET | derivatives/api/v3/orderbook | |
| getTickers() | GET | derivatives/api/v3/tickers | |
| getTicker() | GET | derivatives/api/v3/tickers/{symbol} | |
| getInstruments() | GET | derivatives/api/v3/instruments | |
| getInstrumentStatusList() | GET | derivatives/api/v3/instruments/status | |
| getInstrumentStatus() | GET | derivatives/api/v3/instruments/{symbol}/status | |
| batchOrderManagement() | 🔐 | POST | derivatives/api/v3/batchorder |
| cancelAllOrders() | 🔐 | POST | derivatives/api/v3/cancelallorders |
| cancelAllOrdersAfter() | 🔐 | POST | derivatives/api/v3/cancelallordersafter |
| cancelOrder() | 🔐 | POST | derivatives/api/v3/cancelorder |
| editOrder() | 🔐 | POST | derivatives/api/v3/editorder |
| getOpenOrders() | 🔐 | GET | derivatives/api/v3/openorders |
| submitOrder() | 🔐 | POST | derivatives/api/v3/sendorder |
| getOrderStatus() | 🔐 | POST | derivatives/api/v3/orders/status |
| getPnlPreferences() | 🔐 | GET | derivatives/api/v3/pnlpreferences |
| setPnlPreference() | 🔐 | PUT | derivatives/api/v3/pnlpreferences |
| getLeverageSettings() | 🔐 | GET | derivatives/api/v3/leveragepreferences |
| setLeverageSettings() | 🔐 | PUT | derivatives/api/v3/leveragepreferences |
| getAccounts() | 🔐 | GET | derivatives/api/v3/accounts |
| getOpenPositions() | 🔐 | GET | derivatives/api/v3/openpositions |
| getPositionPercentile() | 🔐 | GET | derivatives/api/v3/unwindqueue |
| getPortfolioMarginParameters() | 🔐 | GET | derivatives/api/v3/portfolio-margining/parameters |
| simulateMarginRequirements() | 🔐 | POST | derivatives/api/v3/portfolio-margining/simulate |
| getAssignmentPrograms() | 🔐 | GET | derivatives/api/v3/assignmentprogram/current |
| addAssignmentPreference() | 🔐 | POST | derivatives/api/v3/assignmentprogram/add |
| deleteAssignmentPreference() | 🔐 | POST | derivatives/api/v3/assignmentprogram/delete |
| getAssignmentPreferencesHistory() | 🔐 | GET | derivatives/api/v3/assignmentprogram/history |
| getFeeSchedules() | GET | derivatives/api/v3/feeschedules | |
| getFeeScheduleVolumes() | 🔐 | GET | derivatives/api/v3/feeschedules/volumes |
| getNotifications() | 🔐 | GET | derivatives/api/v3/notifications |
| getFills() | 🔐 | GET | derivatives/api/v3/fills |
| getHistoricalFundingRates() | GET | derivatives/api/v3/historical-funding-rates | |
| getSelfTradeStrategy() | 🔐 | GET | derivatives/api/v3/self-trade-strategy |
| updateSelfTradeStrategy() | 🔐 | PUT | derivatives/api/v3/self-trade-strategy |
| getSubaccountTradingStatus() | 🔐 | GET | derivatives/api/v3/subaccount/{subaccountUid}/trading-enabled |
| updateSubaccountTradingStatus() | 🔐 | PUT | derivatives/api/v3/subaccount/{subaccountUid}/trading-enabled |
| getSubaccounts() | 🔐 | GET | derivatives/api/v3/subaccounts |
| submitWalletTransfer() | 🔐 | POST | derivatives/api/v3/transfer |
| submitSubaccountTransfer() | 🔐 | POST | derivatives/api/v3/transfer/subaccount |
| submitTransferToSpot() | 🔐 | POST | derivatives/api/v3/withdrawal |
| getOpenRFQs() | GET | derivatives/api/v3/rfqs | |
| getOpenRFQ() | GET | derivatives/api/v3/rfqs/{rfqUid} | |
| getRFQOpenOffers() | 🔐 | GET | derivatives/api/v3/rfqs/open-offers |
| submitRFQNewOffer() | 🔐 | POST | derivatives/api/v3/rfqs/{rfqUid}/place-offer |
| updateRFQOpenOffer() | 🔐 | PUT | derivatives/api/v3/rfqs/{rfqUid}/replace-offer |
| cancelRFQOffer() | 🔐 | DELETE | derivatives/api/v3/rfqs/{rfqUid}/cancel-offer |
| getExecutionEvents() | 🔐 | GET | api/history/v3/executions |
| getOrderEvents() | 🔐 | GET | api/history/v3/orders |
| getTriggerEvents() | 🔐 | GET | api/history/v3/triggers |
| getPositionEvents() | 🔐 | GET | api/history/v3/positions |
| getAccountLog() | 🔐 | GET | api/history/v3/account-log |
| getAccountLogCsv() | 🔐 | GET | api/history/v3/accountlogcsv |
| getPublicExecutionEvents() | GET | api/history/v3/market/{tradeable}/executions | |
| getPublicOrderEvents() | GET | api/history/v3/market/{tradeable}/orders | |
| getPublicMarkPriceEvents() | GET | api/history/v3/market/{tradeable}/price | |
| getTickTypes() | GET | api/charts/v1/ | |
| getMarketsForTickType() | GET | api/charts/v1/{tickType} | |
| getResolutions() | GET | api/charts/v1/{tickType}/{symbol} | |
| getCandles() | GET | api/charts/v1/{tickType}/{symbol}/{resolution} | |
| getLiquidityPoolStatistic() | GET | api/charts/v1/analytics/liquidity-pool | |
| getMarketAnalytics() | GET | api/charts/v1/analytics/{symbol}/{analyticsType} | |
| checkApiKeyV3() | 🔐 | GET | api/auth/v1/api-keys/v3/check |
| getAccountMarketShare() | 🔐 | GET | api/stats/v1/rebates/self-market-share |
InstitutionalClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in InstitutionalClient.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| listCustodyVaults() | 🔐 | POST | 0/private/ListCustodyVaults |
| getCustodyVaultbyId() | 🔐 | POST | 0/private/GetCustodyVault |
| getCustodyDepositMethods() | 🔐 | POST | 0/private/DepositMethods |
| getCustodyDepositAddresses() | 🔐 | POST | 0/private/DepositAddresses |
| listCustodyTransactions() | 🔐 | POST | 0/private/ListCustodyTransactions |
| getCustodyTransactionbyId() | 🔐 | POST | 0/private/GetCustodyTransaction |
| getCustodyWithdrawMethods() | 🔐 | POST | 0/private/WithdrawMethods |
| getCustodyWithdrawAddresses() | 🔐 | POST | 0/private/WithdrawAddresses |
| listCustodyTasks() | 🔐 | POST | 0/private/ListCustodyTasks |
| getCustodyTaskbyId() | 🔐 | POST | 0/private/GetCustodyTask |
| listCustodyActivities() | 🔐 | POST | 0/private/ListCustodyActivities |
| getCustodyActivitybyId() | 🔐 | POST | 0/private/GetCustodyActivity |
| createOtcQuoteRequest() | 🔐 | POST | 0/private/CreateOtcQuoteRequest |
| updateOtcQuote() | 🔐 | POST | 0/private/UpdateOtcQuote |
| getOtcPairs() | 🔐 | POST | 0/private/GetOtcPairs |
| getOtcActiveQuotes() | 🔐 | POST | 0/private/GetOtcActiveQuotes |
| getOtcHistoricalQuotes() | 🔐 | POST | 0/private/GetOtcHistoricalQuotes |
| getOtcExposures() | 🔐 | POST | 0/private/GetOtcExposures |
| checkOtcClient() | 🔐 | POST | 0/private/CheckOtcClient |
PartnerClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in PartnerClient.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| createEmbedUser() | 🔐 | POST | b2b/users |
| getEmbedUser() | 🔐 | GET | b2b/users/{user} |
| updateEmbedUser() | 🔐 | PATCH | b2b/users/{user} |
| submitEmbedVerification() | 🔐 | POST | b2b/verifications/{user} |
| listEmbedAssets() | 🔐 | GET | b2b/assets |
| getEmbedAsset() | 🔐 | GET | b2b/assets/{asset} |
| listEmbedAssetRates() | 🔐 | GET | b2b/assets/{asset}/rates |
| requestEmbedQuote() | 🔐 | POST | b2b/quotes |
| getEmbedQuote() | 🔐 | GET | b2b/quotes/{quote_id} |
| executeEmbedQuote() | 🔐 | PUT | b2b/quotes/{quote_id} |
| getEmbedQuoteLimits() | 🔐 | GET | b2b/quotes/limits |
| requestEmbedProspectiveQuote() | 🔐 | POST | b2b/quotes/prospective |
| createEmbedCustomOrder() | 🔐 | POST | b2b/custom-orders |
| listEmbedCustomOrders() | 🔐 | GET | b2b/custom-orders |
| getEmbedCustomOrder() | 🔐 | GET | b2b/custom-orders/{order_id} |
| cancelEmbedCustomOrder() | 🔐 | POST | b2b/custom-orders/{id}/cancel |
| getEmbedPortfolioSummary() | 🔐 | GET | b2b/portfolio/{user}/summary |
| getEmbedPortfolioHistory() | 🔐 | GET | b2b/portfolio/{user}/history |
| listEmbedPortfolioDetails() | 🔐 | GET | b2b/portfolio/{user}/details |
| listEmbedPortfolioTransactions() | 🔐 | GET | b2b/portfolio/{user}/transactions |
| getEmbedEarnSummary() | 🔐 | GET | b2b/earn/{user} |
| listEmbedEarnAssets() | 🔐 | GET | b2b/earn/assets |
| toggleEmbedAutoEarn() | 🔐 | PUT | b2b/earn/{user}/auto |
| withdrawEmbedFunds() | 🔐 | POST | b2b/funds/withdrawals |
| listEmbedFundingTransactions() | 🔐 | GET | b2b/funds/transactions |
| listEmbedSettlementReports() | 🔐 | GET | b2b/reports/settlement |
| getEmbedSettlementReport() | 🔐 | GET | b2b/reports/settlement/{id} |
| listRampBuyCryptoAssets() | 🔐 | GET | b2b/ramp/buy/crypto |
| listRampFiatCurrencies() | 🔐 | GET | b2b/ramp/fiat-currencies |
| listRampPaymentMethods() | 🔐 | GET | b2b/ramp/payment-methods |
| listRampCountries() | 🔐 | GET | b2b/ramp/countries |
| getRampLimits() | 🔐 | GET | b2b/ramp/limits |
| getRampProspectiveQuote() | 🔐 | GET | b2b/ramp/quotes/prospective |
| getRampCheckoutUrl() | 🔐 | GET | b2b/ramp/checkout |
WebsocketAPIClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in WebsocketAPIClient.ts.
This client provides WebSocket API endpoints which allow for faster interactions with the Kraken API via a WebSocket connection.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| submitSpotOrder() | 🔐 | WS | add_order |
| amendSpotOrder() | 🔐 | WS | amend_order |
| cancelSpotOrder() | 🔐 | WS | cancel_order |
| cancelAllSpotOrders() | 🔐 | WS | cancel_all |
| cancelAllSpotOrdersAfter() | 🔐 | WS | cancel_all_orders_after |
| batchSubmitSpotOrders() | 🔐 | WS | batch_add |
| batchCancelSpotOrders() | 🔐 | WS | batch_cancel |
| editSpotOrder() | 🔐 | WS | edit_order |
Source: View endpoint map source
Kraken JavaScript FAQ
What does the Kraken JavaScript SDK cover?
Kraken supports Spot, Futures, WebSockets, and WebSocket API workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.
How do I authenticate private Kraken API calls in JavaScript?
Install @siebly/kraken-api from npm & pass API credentials into the SDK client options, as shown in the Kraken JavaScript examples above. The SDK handles the exchange-specific signing requirements for private requests.
Does the Kraken JavaScript SDK help with WebSocket connection management?
Yes. Use the SDK WebSocket client for subscriptions, reconnect handling, and stream lifecycle management instead of building raw socket flows yourself.
When should I use the Kraken WebSocket API instead of REST?
Use REST for standard request and response workflows such as account queries and order management. Use the WebSocket API flow when you want persistent low-latency interactions over a connected session.
Direct Example Files
Open the example files below if you want the clearest general-purpose starting point for REST API, WebSocket, and authentication workflows in plain JavaScript.
- Kraken REST API example file (Kraken/Derivatives/Private/orderManagement.ts)
- Kraken WebSocket example file (Kraken/Derivatives/WebSockets/privateWs.ts)
- Kraken WebSocket API example file (Kraken/Spot/WebSockets/wsAPI.ts)