Auth
You can generate API-keys in you account settings.
For each request you will need API-Signature:
- Calculate signatureText = publicKey + requestUrl + requestBodyString (no separator symbols in-between)
- publicKey - example: b2H9TlfRu6MOgG4m9wvrf9maSUiPsQJEui0JrB
- requestUrl - full url of request, example: https://data./api/orders
- requestBodyString - json request body as a 1-line string, example: {"isBid":true,"currencyPairCode":"ETH_BTC","amount":0.01,"price":0.02}. For GET methods it will be an empty string.
- signatureText = b2H9TlfRu6MOgG4m9wvrf9maSUiPsQJEui0JrBhttps://data./api/orders{"isBid":true,"currencyPairCode":"ETH_BTC","amount":0.01,"price":0.02}
- signatureText for GET method = b2H9TlfRu6MOgG4m9wvrf9maSUiPsQJEui0JrBhttps://data./api/orders
Convert signatureText as UTF8-string to bytes
Compute HMACSHA256 hash from signatureText-bytes
Convert hash-bytes to HEX-string
Example in JS code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(publicKey + requestUrl + requestBodyString, privateKey));
Example in C# code:
string signature = new HMACSHA256(Encoding.UTF8.GetBytes(privateKey))
.ComputeHash(Encoding.UTF8.GetBytes(publicKey + requestUrl + requestBodyString))
.Aggregate(new StringBuilder(), (sb, b) => sb.AppendFormat("{0:x2}", b), (sb) => sb.ToString());
API-Signature should look like this: b7238692e0537d3a7fd13faff266d315e3185247e1644c1155f60e6d4e4e445d
- Add headers to each request: "API-Signature" - your signature "API-PublicKey" - your public key