Complete API Docs and Developer Guide
The official API docs provide comprehensive technical specifications, authentication protocols, and interactive code examples for integrating with our exchange. This developer guide is designed to help software engineers rapidly deploy robust applications, from simple portfolio trackers to high-frequency trading bots.
Navigate through our detailed endpoints covering RESTful public market data, private account management, and high-speed WebSocket streams. Whether you are building custom mobile interfaces or managing institutional liquidity on Kraken Pro, these API docs contain everything you need to build securely and scale efficiently.
Start the Quickstart Guide Kraken Login to Get Keys
Getting Started: The Developer Guide Quickstart
The Quickstart developer guide outlines the fundamental steps required to establish a secure connection with our servers. By completing the initial authentication handshake, developers can verify their cryptographic signatures and begin executing programmatic trades within minutes of generating their keys.
Step 1: Generate Your API Credentials
Before making any private requests, you must complete your Kraken login, navigate to the Security tab, and select API. Click "Generate New Key" and carefully select the minimum required permissions for your application. You will be provided with an API Key and a Private Key. Never share your Private Key or commit it to version control.
Step 2: Understand the Nonce Requirement
Every private API request requires a strictly increasing 64-bit integer called a "nonce" (number used once). This security mechanism prevents replay attacks. Most developers use the current Unix timestamp in milliseconds as their nonce. If you send a request with a nonce lower than or equal to a previously used nonce, the API will return an EAPI:Invalid nonce error.
Step 3: Construct the Cryptographic Signature
Your request must include an API-Sign header. This signature is an HMAC-SHA512 hash created using your Private Key. The message to be hashed is a combination of the URI path, the SHA256 hash of the nonce, and the POST data. This complex hashing process ensures that your payload cannot be intercepted and modified in transit.
Step 4: Execute Your First Authenticated Request
Send an HTTP POST request to the /0/private/Balance endpoint. Include your API Key in the API-Key header and your generated hash in the API-Sign header. A successful response will return a JSON object containing your current Kraken crypto account balances.
Public vs. Private Endpoint Categories
Endpoint categories are divided into Public Data, which requires no authentication, and Private User Data, which mandates strict cryptographic signing. Understanding this distinction is critical for optimizing rate limits, as public requests draw from a separate, more permissive quota than private account actions.
Public Market Data
Public endpoints provide access to the core market data that drives the Kraken crypto ecosystem. These endpoints do not require API keys or authentication headers. You can query server time, retrieve a list of tradable asset pairs, fetch current order book depth, and download historical OHLC (Open, High, Low, Close) candlestick data.
Because these endpoints are heavily cached, they are highly performant. However, strict IP-based rate limiting still applies to prevent network abuse. We recommend polling public endpoints no more than once per second to avoid triggering automated firewall blocks.
Private User Data
Private User Data endpoints allow you to query the state of your specific account. This includes fetching current fiat and cryptocurrency balances, retrieving open orders, reviewing historical trade executions, and auditing your account ledger. All requests to these endpoints must be fully authenticated.
These endpoints are essential for building portfolio management dashboards and tax reconciliation software. Because these queries require direct database access, they consume more of your dynamic rate limit budget than simple public market data queries.
Private Trading Execution
The Trading Execution endpoints are the engine of your algorithmic trading bot. Through these interfaces, you can create market orders, place complex limit orders with conditional triggers, cancel existing orders, and manage margin positions on the Kraken Pro platform.
Given the financial risk associated with these endpoints, they require the highest level of API key permissions. We strongly advise implementing robust error handling and pre-trade risk checks within your application before submitting live orders to the matching engine.
WebSocket Stream Integration
WebSocket streams deliver real-time, bidirectional data feeds that push market updates directly to your application without the need for constant HTTP polling. Subscribing to these streams reduces data latency by up to 60%, making it the industry standard for Kraken Pro algorithmic traders.
Connecting to the Public Feed
Establish a secure WebSocket connection to wss://ws.kraken.com. Once connected, send a JSON payload specifying your desired subscription channel. Popular public channels include ticker for real-time price updates, trade for a live feed of executed market orders, and book for instantaneous order book modifications.
The WebSocket server will respond with a confirmation message, followed by an continuous stream of JSON arrays containing the requested data. Your application must be capable of parsing these arrays asynchronously to prevent memory buffer overflows during periods of high market volatility.
Authenticating the Private Feed
To access private WebSocket streams (such as live updates to your open orders or account balances), you must first request a WebSocket Authentication Token via the REST API /0/private/GetWebSocketsToken endpoint. This temporary token is valid for 15 minutes.
Once you have the token, connect to wss://ws-auth.kraken.com and include the token in your subscription payload. This hybrid authentication approach ensures maximum security while maintaining the high-speed, low-latency benefits of persistent WebSocket connections.
Rate Limit Optimization Strategies
Rate Limit Optimization Strategies involve caching public data locally, batching private requests, and utilizing WebSocket streams to minimize the total number of HTTP calls. Developers implementing these strategies significantly reduce their risk of triggering automated IP bans while maximizing their effective trading throughput.
Understanding the Counter System
The API docs detail a specific call counter mechanism. Different endpoints increment your API counter by varying amounts. For example, a simple public ticker request might cost 1 point, while placing a complex margin order on Kraken Pro might cost 2 points. Your account verification tier determines your maximum point allowance per minute and the rate at which points decay over time.
To optimize your connection, always monitor the RateLimit-Remaining header returned in every HTTP response. If this number drops below 10% of your total allowance, your application should automatically pause execution and wait for the counter to decay.
Batching and Caching
Whenever possible, request data for multiple asset pairs in a single REST call rather than making individual requests in a loop. For instance, the /0/public/Ticker endpoint accepts a comma-separated list of pairs, allowing you to fetch the entire market state for a fraction of the rate limit cost.
Additionally, cache static data locally. The list of tradable asset pairs and their respective decimal precision (available via /0/public/AssetPairs) rarely changes. Fetch this data once upon application startup and store it in memory, rather than querying it repeatedly before every trade execution.
Common Error Codes and Troubleshooting
API error codes are standardized JSON responses that indicate malformed requests, authentication failures, or rate limit violations. Properly parsing these error codes allows your application to implement automated retry logic and maintain a stable connection to the Kraken crypto network.
EAPI:Invalid key
This error occurs when the API key provided in the header does not exist, has been deleted, or has expired. Verify that you have copied the key exactly as it appears in your account settings, with no leading or trailing spaces. If the issue persists, perform a fresh Kraken login and generate a completely new set of API credentials.
EAPI:Invalid signature
The most common authentication error. It means the HMAC-SHA512 hash you sent does not match the hash calculated by our servers. Double-check your hashing algorithm. Ensure you are hashing the SHA256 of the nonce + POST data, and that you are using the correct URI path (e.g., /0/private/Balance) in the message string.
EOrder:Insufficient funds
Your account does not have the required balance to execute the requested trade. Remember to account for trading fees when calculating your order size. If you are trading on margin via Kraken Pro, ensure you have sufficient collateral in your account to cover the initial margin requirement for the position.
EAPI:Rate limit exceeded
You have sent too many requests within your allotted time window. Your application must immediately halt all outbound requests and implement an exponential backoff strategy. Continuing to send requests while rate-limited will result in a temporary IP ban to protect the exchange's infrastructure.
Developer Guide FAQ
Answers to the most frequently asked technical questions regarding our API docs and integration strategies.
Are the API docs updated regularly?
Yes, our API docs are maintained in real-time by our core engineering team. Any changes to rate limits, new endpoint additions, or deprecation notices are immediately reflected in the documentation. We also publish major updates to our dedicated developer changelog and announce them via our official developer mailing list.
Do you provide a sandbox or testnet environment?
Currently, we do not offer a public sandbox environment. We recommend testing your integrations using micro-transactions on live markets with highly liquid pairs (such as BTC/USD). Ensure your code thoroughly tests the parsing of public market data before you ever attach a private API key with trading permissions.
How do I handle WebSocket connection drops?
WebSocket connections can occasionally drop due to network instability or routine server maintenance. Your application must implement automatic reconnection logic. Upon reconnecting, you should briefly query the REST API to reconcile your local state (e.g., fetch open orders) to ensure you didn't miss any critical execution messages during the downtime.
What is the difference between standard and Kraken Pro endpoints?
While the core REST API supports both standard spot trading and Kraken Pro margin trading, certain advanced features—such as portfolio margin, complex conditional order routing, and high-leverage futures contracts—are accessed via dedicated Kraken Pro specific endpoints. Consult the specific sections in the API docs for detailed payload structures.
Where can I get technical support for my integration?
If you encounter issues not covered in this developer guide, you can reach out to our dedicated API support team by submitting a ticket through the main support portal. Be sure to include the exact endpoint you are calling, the complete JSON response containing the error, and a snippet of your request payload (excluding your private key).
Join the Developer Community
Connect with other engineers, share your open-source projects, and stay up-to-date with the latest API releases and feature enhancements.