Get Websockets Token
curl --request POST \
--url https://api.kraken.com/0/private/GetWebSocketsToken \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828436
}
'import requests
url = "https://api.kraken.com/0/private/GetWebSocketsToken"
payload = { "nonce": 1695828436 }
headers = {
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({nonce: 1695828436})
};
fetch('https://api.kraken.com/0/private/GetWebSocketsToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kraken.com/0/private/GetWebSocketsToken"
payload := strings.NewReader("{\n \"nonce\": 1695828436\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": [],
"result": {
"token": "1Dwc4lzSwNWOAwkMdqhssNNFhs1ed606d1WcF3XfEMw",
"expires": 900
}
}Trading
Get Websockets Token
An authentication token must be requested via this REST API endpoint in order to connect to and authenticate with our Websockets API. The token should be used within 15 minutes of creation, but it does not expire once a successful Websockets connection and private subscription has been made and is maintained.
API Key Permissions Required: WebSocket interface - On
POST
/
private
/
GetWebSocketsToken
Get Websockets Token
curl --request POST \
--url https://api.kraken.com/0/private/GetWebSocketsToken \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 1695828436
}
'import requests
url = "https://api.kraken.com/0/private/GetWebSocketsToken"
payload = { "nonce": 1695828436 }
headers = {
"API-Key": "<api-key>",
"API-Sign": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'API-Key': '<api-key>',
'API-Sign': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({nonce: 1695828436})
};
fetch('https://api.kraken.com/0/private/GetWebSocketsToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kraken.com/0/private/GetWebSocketsToken"
payload := strings.NewReader("{\n \"nonce\": 1695828436\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
req.Header.Add("API-Sign", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": [],
"result": {
"token": "1Dwc4lzSwNWOAwkMdqhssNNFhs1ed606d1WcF3XfEMw",
"expires": 900
}
}Authorizations
The "API-Key" header should contain your API key.
Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path.
Body
application/json
Nonce used in construction of API-Sign header
Was this page helpful?