TheDocumentation 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.
@siebly/kraken-api SDK handles all request signing and WebSocket authentication automatically. You only need to provide your API key and secret when constructing a client — the SDK takes care of generating the correct HMAC signature for each Spot REST call, and the challenge-response token for Futures REST and private WebSocket connections. This page explains where to create keys, what permissions to request, and how to pass credentials to each client type.
Spot API keys
Spot API keys are managed at https://www.kraken.com/u/security/api. When creating a key, Kraken lets you configure which permissions it carries. Request only the permissions your integration actually needs:| Use case | Permissions required |
|---|---|
| Market data and analytics only | No key needed (public endpoints) |
| Read account balances and order history | Query Funds, Query Open Orders & Trades, Query Closed Orders & Trades |
| Spot trading | Query Funds, Query Open Orders & Trades, Create & Modify Orders |
| Withdrawals | Withdraw Funds (only if your integration genuinely requires it) |
Futures API keys
Futures API keys are managed at https://futures.kraken.com/settings/api. These keys are completely separate from Spot keys and are issued by Kraken’s Derivatives platform. A key created on the Futures platform will not work with the Spot REST API, and vice versa. Kraken also provides a Futures demo environment (https://demo-futures.kraken.com) for testing without real funds. When using the demo environment, create your test keys through the Futures demo platform, not the live one.
Using credentials
SpotClient with API keys
PassapiKey and apiSecret as constructor options. The SDK will automatically sign all private Spot REST requests using your credentials.
DerivativesClient with API keys
TheDerivativesClient accepts the same apiKey and apiSecret options, but expects Futures credentials from futures.kraken.com.
DerivativesClient with testnet
Settestnet: true to route all Derivatives REST calls to Kraken’s demo environment. This is useful for validating your integration against live API behaviour without risking real funds. Note that only DerivativesClient supports the testnet option — it is not available for SpotClient.
WebsocketClient with credentials for private streams
Pass credentials toWebsocketClient to access private account streams such as executions and balances. The SDK handles WebSocket authentication automatically after the connection is established.
Environment variables
The recommended approach is to load credentials from environment variables at runtime. This keeps secrets out of your source code and makes it straightforward to use different credentials per environment (development, staging, production)..env file and load it with Node.js’s built-in --env-file flag (Node.js 20.6+), process.loadEnvFile(), or a library like dotenv. Make sure .env is listed in your .gitignore.
Public vs private endpoints
Many Kraken API endpoints are public and do not require authentication. You can create aSpotClient or DerivativesClient with no arguments at all and immediately start querying market data.
apiKey and apiSecret.
RestClientOptions reference
The following options are accepted bySpotClient, DerivativesClient, InstitutionalClient, and PartnerClient:
| Option | Type | Description |
|---|---|---|
apiKey | string | Your Kraken API key |
apiSecret | string | Your Kraken API secret |
apiAccessToken | string | Use a pre-obtained access token instead of HMAC signing. When provided, the SDK skips signature generation and uses the token directly. |
testnet | boolean | Route requests to Kraken’s demo environment. Currently only supported by DerivativesClient. |
baseUrl | string | Override the API base URL entirely (e.g. for proxying) |
strictParamValidation | boolean | If true, throws an error when any request parameter is undefined. Default: false. |
parseExceptions | boolean | Whether to post-process and re-throw request exceptions. Default: true. |
keepAlive | boolean | Enable HTTP keep-alive for REST requests via axios. |
keepAliveMsecs | number | Interval (ms) for TCP keep-alive packets when keepAlive is true. Default: 1000. |
customTimestampFn | () => number | Override the timestamp function used when generating request signatures. Returns a Unix timestamp in milliseconds. |
customSignMessageFn | (message: string, secret: string) => Promise<string> | Provide a custom HMAC signing function (e.g. Node’s createHmac for better performance). |