Find an API

Search public APIs with auth details & Postman guides

← All APIs

Kraken REST API

api.kraken.com · Finance

Finance API Key Free Tier Cryptocurrency Exchange Trading

Kraken cryptocurrency exchange API — real-time market data (ticker, order book, trades, OHLC), account management, and trading. Public market data requires no API key.

Authentication

API Key Public endpoints (market data) require no authentication. Private endpoints (trading, account) require API key and secret from your Kraken account.

Sample Requests

GET Get ticker

Get current BTC/USD ticker data.

https://api.kraken.com/0/public/Ticker?pair=XBTUSD

Hover any highlighted part to learn what it does

curl -X GET "https://api.kraken.com/0/public/Ticker?pair=XBTUSD"
import requests
params = {
    "pair": "XBTUSD"
}
response = requests.get(
    "https://api.kraken.com/0/public/Ticker",
    params=params,
)
print(response.json())
const url = new URL('https://api.kraken.com/0/public/Ticker');
url.searchParams.set('pair', 'XBTUSD');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.kraken.com/0/public/Ticker")
	q := baseURL.Query()
	q.Set("pair", "XBTUSD")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.kraken.com/0/public/Ticker")
uri.query = URI.encode_www_form({
  "pair" => "XBTUSD"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.kraken.com/0/public/Ticker?" . http_build_query([
    "pair" => "XBTUSD"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Get OHLC data

Get hourly OHLC candles for ETH/USD.

https://api.kraken.com/0/public/OHLC?pair=ETHUSD&interval=60

Hover any highlighted part to learn what it does

curl -X GET "https://api.kraken.com/0/public/OHLC?pair=ETHUSD&interval=60"
import requests
params = {
    "pair": "ETHUSD",
    "interval": "60"
}
response = requests.get(
    "https://api.kraken.com/0/public/OHLC",
    params=params,
)
print(response.json())
const url = new URL('https://api.kraken.com/0/public/OHLC');
url.searchParams.set('pair', 'ETHUSD');
url.searchParams.set('interval', '60');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.kraken.com/0/public/OHLC")
	q := baseURL.Query()
	q.Set("pair", "ETHUSD")
	q.Set("interval", "60")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.kraken.com/0/public/OHLC")
uri.query = URI.encode_www_form({
  "pair" => "ETHUSD",
  "interval" => "60"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.kraken.com/0/public/OHLC?" . http_build_query([
    "pair" => "ETHUSD",
    "interval" => "60"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. No key for public endpoints
  2. Try GET https://api.kraken.com/0/public/Ticker?pair=XBTUSD
  3. Get all pairs: GET /0/public/AssetPairs
  4. For trading/account endpoints create API keys at kraken.com/u/security/api

Open documentation ↗