SDK guide
JavaScript
REST API + WebSocket

Kraken JavaScript SDK

Use @siebly/kraken-api to read Kraken market data, manage orders, and consume streams from Node.js. JavaScript and TypeScript use the same clients; request and response types are included.

Choose a client

SpotClient
Spot REST
DerivativesClient
Futures REST
WebsocketClient
Public and private streams
WebsocketAPIClient
Spot API commands

Make a first public request

In a Node.js project, install the package once. The REST and WebSocket API examples below use .mjs files so Node.js can run their imports directly.

npm install @siebly/kraken-api

REST walkthrough

Read public XBTUSD Spot data with SpotClient. These public requests require no credentials.

Save the code as rest-public.mjs and run:

node rest-public.mjs
import { SpotClient } from '@siebly/kraken-api'; const client = new SpotClient(); async function main() {  const serverTime = await client.getServerTime();  const systemStatus = await client.getSystemStatus();  const ticker = await client.getTicker({ pair: 'XBTUSD' });  const orderBook = await client.getOrderBook({ pair: 'XBTUSD', count: 10 });   console.log({    serverTime,    systemStatus,    ticker,    orderBook,  });} // Since each of the above API calls is wrapped in an awaited promise, a high level catch will detect any exceptions:main().catch(console.error);

Expected response

Market values change on each run. These are the fields to check in the logged output.

FieldExpected result
error / resultEach logged response retains the Kraken envelope. An empty error array indicates success; data is under result.
serverTimeresult.unixtime is Unix seconds; result.rfc1123 is a readable time string.
ticker / orderBookResult objects keyed by the returned pair name, such as XXBTZUSD. Book levels contain price, quantity, and timestamp.

More REST examples

Full Kraken course

Kraken API JavaScript Tutorial

A richer JavaScript guide for building Kraken Spot REST, Futures REST, public and private WebSockets, WebSocket API trading, proxy configuration, reconnect handling, and production rollout patterns with @siebly/kraken-api.

Spot and Futures clients
Public and private streams
Promise-wrapped WebSocket API trading
REST API and WebSocket proxy examples
REST API
WebSocket Streams
WebSocket API
Examples

Your app / service

bot, dashboard, worker

@siebly/kraken-api

SpotClient, DerivativesClient, WebsocketClient

Kraken APIs

Spot REST, Futures REST, WebSockets, WebSocket API

Common Kraken implementation tasks

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.

FunctionAUTHHTTP MethodEndpoint
getSystemStatus()GET0/public/SystemStatus
getMaintenanceSchedule()GET0/public/MaintenanceSchedule
getAssetInfo()GET0/public/Assets
getAssetPairs()GET0/public/AssetPairs
getTicker()GET0/public/Ticker
getCandles()GET0/public/OHLC
getOrderBook()GET0/public/Depth
getGroupedBook()GET0/public/GroupedBook
getLevel3OrderBook()🔐POST0/private/Level3
getRecentTrades()GET0/public/Trades
getRecentSpreads()GET0/public/Spread
getAccountBalance()🔐POST0/private/Balance
getApiKeyInfo()🔐POST0/private/GetApiKeyInfo
getWalletAccounts()🔐POST0/private/ListWalletAccounts
getExtendedBalance()🔐POST0/private/BalanceEx
getCreditLines()🔐POST0/private/CreditLines
getTradeBalance()🔐POST0/private/TradeBalance
getOpenOrders()🔐POST0/private/OpenOrders
getClosedOrders()🔐POST0/private/ClosedOrders
getOrders()🔐POST0/private/QueryOrders
getOrderAmends()🔐POST0/private/OrderAmends
getTradesHistory()🔐POST0/private/TradesHistory
getTrades()🔐POST0/private/QueryTrades
getOpenPositions()🔐POST0/private/OpenPositions
getLedgersInfo()🔐POST0/private/Ledgers
getLedgers()🔐POST0/private/QueryLedgers
getTradingVolume()🔐POST0/private/TradeVolume
requestLedgersExport()🔐POST0/private/AddExport
getLedgersExportStatus()🔐POST0/private/ExportStatus
getLedgersExport()🔐POST0/private/RetrieveExport
deleteLedgersExport()🔐POST0/private/RemoveExport
submitOrder()🔐POST0/private/AddOrder
amendOrder()🔐POST0/private/AmendOrder
cancelOrder()🔐POST0/private/CancelOrder
cancelAllOrders()🔐POST0/private/CancelAll
cancelAllOrdersAfter()🔐POST0/private/CancelAllOrdersAfter
getWebSocketsToken()🔐POST0/private/GetWebSocketsToken
submitBatchOrders()🔐POST0/private/AddOrderBatch
cancelBatchOrders()🔐POST0/private/CancelOrderBatch
getDepositMethods()🔐POST0/private/DepositMethods
getDepositAddresses()🔐POST0/private/DepositAddresses
getDepositsStatus()🔐POST0/private/DepositStatus
getWithdrawalMethods()🔐POST0/private/WithdrawMethods
getWithdrawalAddresses()🔐POST0/private/WithdrawAddresses
getWithdrawalInfo()🔐POST0/private/WithdrawInfo
submitWithdrawal()🔐POST0/private/Withdraw
getWithdrawalsStatus()🔐POST0/private/WithdrawStatus
cancelWithdrawal()🔐POST0/private/WithdrawCancel
submitTransferToFutures()🔐POST0/private/WalletTransfer
createSubaccount()🔐POST0/private/CreateSubaccount
submitSubaccountTransfer()🔐POST0/private/AccountTransfer
allocateEarnFunds()🔐POST0/private/Earn/Allocate
deallocateEarnFunds()🔐POST0/private/Earn/Deallocate
getEarnAllocationStatus()🔐POST0/private/Earn/AllocateStatus
getEarnDeallocationStatus()🔐POST0/private/Earn/DeallocateStatus
getEarnStrategies()🔐POST0/private/Earn/Strategies
getEarnAllocations()🔐POST0/private/Earn/Allocations
getPreTradeData()GET0/public/PreTrade
getPostTradeData()GET0/public/PostTrade
getOAuthAccessToken()POSToauth/token
getOAuthUserInfo()🔐GEToauth/userinfo
createOAuthFastApiKey()🔐POSToauth/fast-api-key
deleteOAuthFastApiKey()🔐DELETEoauth/fast-api-key
updateOAuthFastApiKey()🔐PUToauth/fast-api-key
listOAuthFastApiKeys()🔐GEToauth/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.

FunctionAUTHHTTP MethodEndpoint
getTradeHistory()GETderivatives/api/v3/history
getOrderbook()GETderivatives/api/v3/orderbook
getTickers()GETderivatives/api/v3/tickers
getTicker()GETderivatives/api/v3/tickers/{symbol}
getInstruments()GETderivatives/api/v3/instruments
getTradingInstruments()🔐GETderivatives/api/v3/trading/instruments
getInstrumentStatusList()GETderivatives/api/v3/instruments/status
getInstrumentStatus()GETderivatives/api/v3/instruments/{symbol}/status
batchOrderManagement()🔐POSTderivatives/api/v3/batchorder
cancelAllOrders()🔐POSTderivatives/api/v3/cancelallorders
cancelAllOrdersAfter()🔐POSTderivatives/api/v3/cancelallordersafter
cancelOrder()🔐POSTderivatives/api/v3/cancelorder
editOrder()🔐POSTderivatives/api/v3/editorder
getOpenOrders()🔐GETderivatives/api/v3/openorders
submitOrder()🔐POSTderivatives/api/v3/sendorder
getOrderStatus()🔐POSTderivatives/api/v3/orders/status
getPnlPreferences()🔐GETderivatives/api/v3/pnlpreferences
setPnlPreference()🔐PUTderivatives/api/v3/pnlpreferences
getLeverageSettings()🔐GETderivatives/api/v3/leveragepreferences
setLeverageSettings()🔐PUTderivatives/api/v3/leveragepreferences
getRfqAssignmentMaxLeverage()🔐GETderivatives/api/v3/rfq-assignment/max-leverage
setRfqAssignmentMaxLeverage()🔐PUTderivatives/api/v3/rfq-assignment/max-leverage
deleteRfqAssignmentMaxLeverage()🔐DELETEderivatives/api/v3/rfq-assignment/max-leverage
getAccounts()🔐GETderivatives/api/v3/accounts
getOpenPositions()🔐GETderivatives/api/v3/openpositions
getPositionPercentile()🔐GETderivatives/api/v3/unwindqueue
getPortfolioMarginParameters()🔐GETderivatives/api/v3/portfolio-margining/parameters
simulateMarginRequirements()🔐POSTderivatives/api/v3/portfolio-margining/simulate
getAssignmentPrograms()🔐GETderivatives/api/v3/assignmentprogram/current
addAssignmentPreference()🔐POSTderivatives/api/v3/assignmentprogram/add
deleteAssignmentPreference()🔐POSTderivatives/api/v3/assignmentprogram/delete
getAssignmentPreferencesHistory()🔐GETderivatives/api/v3/assignmentprogram/history
getFeeSchedules()GETderivatives/api/v3/feeschedules
getFeeScheduleVolumes()🔐GETderivatives/api/v3/feeschedules/volumes
getNotifications()🔐GETderivatives/api/v3/notifications
getFills()🔐GETderivatives/api/v3/fills
getHistoricalFundingRates()GETderivatives/api/v3/historical-funding-rates
getSelfTradeStrategy()🔐GETderivatives/api/v3/self-trade-strategy
updateSelfTradeStrategy()🔐PUTderivatives/api/v3/self-trade-strategy
getSubaccountTradingStatus()🔐GETderivatives/api/v3/subaccount/{subaccountUid}/trading-enabled
updateSubaccountTradingStatus()🔐PUTderivatives/api/v3/subaccount/{subaccountUid}/trading-enabled
getSubaccounts()🔐GETderivatives/api/v3/subaccounts
submitWalletTransfer()🔐POSTderivatives/api/v3/transfer
submitSubaccountTransfer()🔐POSTderivatives/api/v3/transfer/subaccount
submitTransferToSpot()🔐POSTderivatives/api/v3/withdrawal
getOpenRFQs()GETderivatives/api/v3/rfqs
getOpenRFQ()GETderivatives/api/v3/rfqs/{rfqUid}
getRFQOpenOffers()🔐GETderivatives/api/v3/rfqs/open-offers
submitRFQNewOffer()🔐POSTderivatives/api/v3/rfqs/{rfqUid}/place-offer
updateRFQOpenOffer()🔐PUTderivatives/api/v3/rfqs/{rfqUid}/replace-offer
cancelRFQOffer()🔐DELETEderivatives/api/v3/rfqs/{rfqUid}/cancel-offer
getExecutionEvents()🔐GETapi/history/v3/executions
getOrderEvents()🔐GETapi/history/v3/orders
getTriggerEvents()🔐GETapi/history/v3/triggers
getPositionEvents()🔐GETapi/history/v3/positions
getAccountLog()🔐GETapi/history/v3/account-log
getAccountLogCsv()🔐GETapi/history/v3/accountlogcsv
getPublicExecutionEvents()GETapi/history/v3/market/{tradeable}/executions
getPublicOrderEvents()GETapi/history/v3/market/{tradeable}/orders
getPublicMarkPriceEvents()GETapi/history/v3/market/{tradeable}/price
getTickTypes()GETapi/charts/v1/
getMarketsForTickType()GETapi/charts/v1/{tickType}
getResolutions()GETapi/charts/v1/{tickType}/{symbol}
getCandles()GETapi/charts/v1/{tickType}/{symbol}/{resolution}
getLiquidityPoolStatistic()GETapi/charts/v1/analytics/liquidity-pool
getMarketAnalytics()GETapi/charts/v1/analytics/{symbol}/{analyticsType}
checkApiKeyV3()🔐GETapi/auth/v1/api-keys/v3/check
getAccountMarketShare()🔐GETapi/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.

FunctionAUTHHTTP MethodEndpoint
listCustodyVaults()🔐POST0/private/ListCustodyVaults
getCustodyVaultbyId()🔐POST0/private/GetCustodyVault
getCustodyDepositMethods()🔐POST0/private/DepositMethods
getCustodyDepositAddresses()🔐POST0/private/DepositAddresses
listCustodyTransactions()🔐POST0/private/ListCustodyTransactions
getCustodyTransactionbyId()🔐POST0/private/GetCustodyTransaction
getCustodyWithdrawMethods()🔐POST0/private/WithdrawMethods
getCustodyWithdrawAddresses()🔐POST0/private/WithdrawAddresses
listCustodyTasks()🔐POST0/private/ListCustodyTasks
getCustodyTaskbyId()🔐POST0/private/GetCustodyTask
listCustodyActivities()🔐POST0/private/ListCustodyActivities
getCustodyActivitybyId()🔐POST0/private/GetCustodyActivity
createOtcQuoteRequest()🔐POST0/private/CreateOtcQuoteRequest
updateOtcQuote()🔐POST0/private/UpdateOtcQuote
getOtcPairs()🔐POST0/private/GetOtcPairs
getOtcActiveQuotes()🔐POST0/private/GetOtcActiveQuotes
getOtcHistoricalQuotes()🔐POST0/private/GetOtcHistoricalQuotes
getOtcExposures()🔐POST0/private/GetOtcExposures
checkOtcClient()🔐POST0/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.

FunctionAUTHHTTP MethodEndpoint
createEmbedUser()🔐POSTb2b/users
getEmbedUser()🔐GETb2b/users/{user}
updateEmbedUser()🔐PATCHb2b/users/{user}
submitEmbedVerification()🔐POSTb2b/verifications/{user}
listEmbedAssets()🔐GETb2b/assets
getEmbedAsset()🔐GETb2b/assets/{asset}
listEmbedAssetRates()🔐GETb2b/assets/{asset}/rates
requestEmbedQuote()🔐POSTb2b/quotes
getEmbedQuote()🔐GETb2b/quotes/{quote_id}
executeEmbedQuote()🔐PUTb2b/quotes/{quote_id}
getEmbedQuoteLimits()🔐GETb2b/quotes/limits
requestEmbedProspectiveQuote()🔐POSTb2b/quotes/prospective
createEmbedCustomOrder()🔐POSTb2b/custom-orders
listEmbedCustomOrders()🔐GETb2b/custom-orders
getEmbedCustomOrder()🔐GETb2b/custom-orders/{order_id}
cancelEmbedCustomOrder()🔐POSTb2b/custom-orders/{id}/cancel
getEmbedPortfolioSummary()🔐GETb2b/portfolio/{user}/summary
getEmbedPortfolioHistory()🔐GETb2b/portfolio/{user}/history
listEmbedPortfolioDetails()🔐GETb2b/portfolio/{user}/details
listEmbedPortfolioTransactions()🔐GETb2b/portfolio/{user}/transactions
getEmbedEarnSummary()🔐GETb2b/earn/{user}
listEmbedEarnAssets()🔐GETb2b/earn/assets
toggleEmbedAutoEarn()🔐PUTb2b/earn/{user}/auto
withdrawEmbedFunds()🔐POSTb2b/funds/withdrawals
listEmbedFundingTransactions()🔐GETb2b/funds/transactions
listEmbedSettlementReports()🔐GETb2b/reports/settlement
getEmbedSettlementReport()🔐GETb2b/reports/settlement/{id}
listRampBuyCryptoAssets()🔐GETb2b/ramp/buy/crypto
listRampFiatCurrencies()🔐GETb2b/ramp/fiat-currencies
listRampPaymentMethods()🔐GETb2b/ramp/payment-methods
listRampCountries()🔐GETb2b/ramp/countries
getRampLimits()🔐GETb2b/ramp/limits
getRampProspectiveQuote()🔐GETb2b/ramp/quotes/prospective
getRampCheckoutUrl()🔐GETb2b/ramp/checkout

AffiliateClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in AffiliateClient.ts.

FunctionAUTHHTTP MethodEndpoint
getCpaProgress()🔐GETaffiliate/v1/cpa-progress
getPayoutHistory()🔐GETaffiliate/v1/payout-history
getDailyActivity()🔐GETaffiliate/v1/daily-activity

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.

FunctionAUTHHTTP MethodEndpoint
submitSpotOrder()🔐WSadd_order
amendSpotOrder()🔐WSamend_order
cancelSpotOrder()🔐WScancel_order
cancelAllSpotOrders()🔐WScancel_all
cancelAllSpotOrdersAfter()🔐WScancel_all_orders_after
batchSubmitSpotOrders()🔐WSbatch_add
batchCancelSpotOrders()🔐WSbatch_cancel
editSpotOrder()🔐WSedit_order
View endpoint map sourceShowing the available endpoint reference map.

Kraken JavaScript FAQ

What does the Kraken JavaScript SDK cover?

Kraken supports Spot, Futures, Margin, 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?

The public REST example above needs no credentials. For private calls, follow the authentication setup for @siebly/kraken-api in the full tutorial, including the credentials or signer required by your exchange.

Kraken authentication and setup

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

Continue with implementation resources

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.