Deprecation and Unified WebSocket
The Derivatives WebSocket (wss://futures.kraken.com/ws/v1) is being
deprecated. Existing integrations
continue to work until 1 March 2027, when the Derivatives
WebSocket will no longer be available. Migrate to the Unified WebSocket
before then.
If you are starting a new integration, use the
Unified WebSocket. It
covers Spot and Derivatives over a single connection. You choose the
market by setting asset_class to derivatives on each subscription
or order message.
Connect to the Unified WebSocket
Public channels, such asticker and book, need no authentication.
Connect to wss://uws.kraken.com/v2/public and subscribe.
Private channels and trading use a WebSocket token instead of the
signed challenge:
- Create a Kraken API key at Settings → API, with the Access WebSocket API permission and the permissions your integration needs. Derivatives API keys do not work with the Unified WebSocket. See API key permissions.
- Call the Spot REST endpoint
GetWebSocketsTokenwith that key. Tokens are short-lived, so get a fresh one for each connection. - Connect to
wss://uws.kraken.com/v2/privateand send the token inparams.tokenon each private subscription and trading request.
Endpoint
Keeping the connection alive
Send a ping request at least every 60 seconds to keep the connection open. See the sample implementation for reference.Snapshots and updates
Most feeds send a snapshot of the current state first, followed by real-time incremental updates.Authentication
Private feeds require a signed challenge. The process:- Connect to the WebSocket endpoint.
- Send a request to obtain a challenge (using your
api_key). - Sign the challenge with your
api_secret(see Sign challenge below). - Include both
original_challengeandsigned_challengein every subscribe/unsubscribe message for private feeds.
Sign challenge
Signing steps
Given achallenge string:
- Hash the challenge with SHA-256
- Base64-decode your
api_secret - Hash the result of step 1 with the result of step 2 using HMAC-SHA-512
- Base64-encode the result of step 3
signed_challenge.
Example
The challenge is a UUID string.