Navbar
python node.js php javascript c#
  • Introduction
  • Authentication
  • Rate Limits
  • REST API
  • Websocket API
  • Methods
  • Introduction

    Every call to the API has a standard Response body. The json format of the response body is as following:

    {
     "success": "true or false",
     "data" : {
       "The Data as described in each method."
     }
    }
    

    The Chainrift API is designed to allow users access to all the features of the exchange. We provide our users the ability to utilize our API in order to create highly customised and advanced trading strategies. Our API contains both Public and Private endpoints.

    To help you quickly get started with our API, we've provided short code examples in a variety of different programming languages.

    Authentication

    Our extensive public API is accessible to everyone and doesn't require any authentication. For any user related requests, you will need to access our Private API.

    Generate your keys

    Chainrift uses a token-based and public-key cryptography authentication system. To generate or manage your API key, visit your API Keys page. It's important to note that your API key carries the same privileges as your user account, so be sure to keep it secret!

    On the API keys screen you can also set specific IP addresses where the API will be accessible from. You can also assign specific rights for API calls to deposits, withdrawals and trading.

    Authentication is done by sending the following HTTP headers:

    1. The APIKey (generated from our website).
      • To generate an API Key please login to your account.
      • On the user menu, select API Keys and press Generate API key.
      • Once an API key is generated, you will recieve a guid (API Key) and two private keys:
        • Pkcs1
        • Pkcs8
      • These private keys will be used to sign the APIAuthPayload below. The usage of these private keys depends on which library you decide to use. Please see the shortcode example on the right.
    2. A unique APINonce string.
    3. An APIAuthPayload string composed of: the url route (without host) + nonce
    4. An APISignature, the signed APIAuthPayload in hex format used to verify the request authenticity. It is important to note that this string needs to be SHA-256 signed using the private key (generated during the API creation) and hex encoded.

    Please see the REST API example below.

    Rate Limits

    The REST API is limited to 10 requests per second, while our Websocket API is limited to 100 requests per second within an active connection. If you exceed this limit you will receive a 429 error code and will need to wait 30 seconds before subsequent requests will succeed.

    If the current rate limits don't support your use case, we'd love to hear about it to learn more. Please contact us at here.

    REST API

    Public

    A short code example of our Public REST API:

    from datetime import datetime
    import requests
    
    def call_api(method, body = []):
      global APIUrl
      headers = {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    
      res = requests.post(APIUrl + method, headers=headers, data=body, timeout=60)
      print(method, res.text, "\n")
    
    APIUrl = "https://api.chainrift.com/"
    
    # Example public API calls
    call_api("v1/Public/GetPairs");
    call_api("v1/Public/GetPairStats", { "symbol": "ETH/BTC" });
    call_api("v1/Public/Market");
    call_api("v1/Public/GetOrderBook", { "symbol": "ETH/BTC" });
    call_api("v1/Public/GetTradeHistory", { "symbol": "ETH/BTC" });
    
    const request = require('request');
    const querystring = require('querystring');
    
    const APIUrl = "https://api.chainrift.com/";
    
    function callAPI(method, body = {}) {
        options.uri = APIUrl + method;
        options.body = querystring.stringify(body);
    
        request(options, function (error, response, body) {
            if (response.statusCode == 200) {
                console.log(method, error, body);
            } else {
                console.log(method, "failed with status code", response.statusCode, response.headers["www-authenticate"]);
            }
            console.log("");
        });
    }
    
    let options = {
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        method: "POST",
        body: ""
    };
    
    // Example public API calls
    callAPI("v1/Public/GetPairs");
    callAPI("v1/Public/GetPairStats", { symbol: "ETH/BTC" });
    callAPI("v1/Public/Market");
    callAPI("v1/Public/GetOrderBook", { symbol: "ETH/BTC" });
    callAPI("v1/Public/GetTradeHistory", { symbol: "ETH/BTC" });
    
    <?php
    $APIUrl = "https://api.chainrift.com/";
    $fopen = fopen($fname, "r");
    $content = fread($fopen, 9999999);
    fclose($fopen);
    
    function callAPI ($method, $body = []) {
      global $APIUrl;
      $url = $APIUrl . $method;
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
      $headers = [
        "Content-Type: application/x-www-form-urlencoded",
      ];
    
      if (count($body) > 0) {
        $body_data = http_build_query($body);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $body_data);
        $content_length = strlen($body_data);
      } else {
        $content_length = 0;
      }
      $headers[] = "Content-Length: " . strval($content_length);
    
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      $response = curl_exec($ch);
      curl_close($ch);
    
      echo "Response for {$method}: {$response}\n\n";
    }
    
    // Example public API calls
    callAPI("v1/Public/GetPairs");
    callAPI("v1/Public/GetPairStats", [ "symbol" => "ETH/BTC" ]);
    callAPI("v1/Public/Market");
    callAPI("v1/Public/GetOrderBook", [ "symbol" => "ETH/BTC" ]);
    callAPI("v1/Public/GetTradeHistory", [ "symbol" => "ETH/BTC" ]);
    
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Net;
    
    namespace API_CS_Example
    {
        class Program
        {
            const string APIUrl = "https://api.chainrift.com/";
            static void CallAPI(string method, Dictionary<string, object> body = null)
            {
                try
                {
                    var req = WebRequest.Create(APIUrl + method);
                    req.Method = "POST";
                    req.ContentType = "application/json";
                    req.Headers = new WebHeaderCollection()
                    {
                        "Content-Type: application/x-www-form-urlencoded"
                    };
    
                    var reqStream = req.GetRequestStream();
                    var response = req.GetResponse();
                    var resStream = new StreamReader(response.GetResponseStream());
                    var data = resStream.ReadToEnd();
                    Console.WriteLine(method + ": " + data + "\n");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception while calling {method} {ex.Message}");
                }
            }
    
            static void Main(string[] args)
            {
                // Example public API calls
                CallAPI("v1/Public/GetPairs");
                CallAPI("v1/Public/GetPairStats", new Dictionary<string, object>(){ { "symbol", "ETH/BTC" } });
                CallAPI("v1/Public/Market");
                CallAPI("v1/Public/GetOrderBook", new Dictionary<string, object>() { { "symbol", "ETH/BTC" } });
                CallAPI("v1/Public/GetTradeHistory", new Dictionary<string, object>() { { "symbol", "ETH/BTC" } });
            }
    
        }
    }
    
    
    <html>
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
    </head>
    <body>
    <script>
          var APIUrl = "https://api.chainrift.com/";
    
          // AJAX Helpers
          function callMethod(method, reqData) {
              $.ajax({
                  // Only async to executed methods sequentially while testing
                  async: false,
                  method: "POST",
                  url: APIUrl + method,
                  data: reqData,
                  success: function (data) {
                      console.log(method, data);
                  },
                  complete: function (data) {
                      if (data.status != 200) {
                          console.log(`Request response code is ${data.status}`, data);
                      }
                  }
              });
          }
    
          // Examples calls to public methods
          callMethod("v1/Public/GetPairs");
          callMethod("v1/Public/GetPairStats", { symbol: "ETH/BTC" });
          callMethod("v1/Public/Market");
          callMethod("v1/Public/GetOrderBook", { symbol: "ETH/BTC" });
          callMethod("v1/Public/GetTradeHistory", { symbol: "ETH/BTC" });
    
      </script>
    </body>
    </html>
    
    

    Here's a full list of our public methods:

    Private

    A short code example on our Private REST API:

      const crypto = require('crypto');
      const request = require('request');
      const querystring = require('querystring');
    
      let private_key = `<INSERT_YOUR_PRIVATE_KEY_HERE>`
    
      const APIUrl = "https://api.chainrift.com/";
      const apiKey = '<INSERT_YOUR_API_KEY_HERE>'
    
      function callAPI(method, body = {}) {
          options.uri = APIUrl + method;
          let nonce = new Date().getTime();
          let authPayload = method + nonce
          const signer = crypto.createSign('sha256');
          signer.update(authPayload);
          signer.end();
          let signature = signer.sign(private_key).toString('hex');
          options.headers["APIKey"] = apiKey;
          options.headers["APINonce"] = nonce;
          options.headers["APISignature"] = signature;
          options.headers["APIAuthPayload"] = authPayload;
    
    
          options.body = querystring.stringify(body);
    
          request(options, function (error, response, body) {
              if (response.statusCode == 200) {
                  console.log(method, error, body);
              } else {
                  console.log(method, "failed with status code", response.statusCode, response.headers["www-authenticate"]);
              }
              console.log("");
          });
      }
    
      let options = {
          headers: {
              "Content-Type": "application/x-www-form-urlencoded"
          },
          method: "POST",
          body: ""
      };
    
      # Example private API calls
      callAPI("v1/Private/GetBalances");
      callAPI("v1/Private/GetDetailedBalances");
      callAPI("v1/Private/GetDepositAddresses");
      callAPI("v1/Private/GenerateDepositAddress");
      callAPI("v1/Private/GetWithdrawAddresses");
      callAPI("v1/Private/GetDeposits");
      callAPI("v1/Private/GetWithdrawals");
      callAPI("v1/Private/GetOpenOrders");
      callAPI("v1/Private/GetTradeHistory");
      call_api("v1/Private/PlaceOrders", { price: 0.01184862, quantity: 1, type: "buy", symbol: "ETH/BTC" });
      call_api("v1/Private/MoveOrders", { orderId: "efaebd52-d627-4bb4-a932-55c2577be756", price: 0.02184862 });
      callAPI("v1/Private/CancelOrder", { orderId: "efaebd52-d627-4bb4-a932-55c2577be756" });
      callAPI("v1/Private/CancelAllOrders");
      callAPI("v1/Private/CreateWithdrawal", { coin: "BTC", quantity: 0.1, address: "mhyMHUfApEUugEWGV8Bk7JGKaFwiZaP1tT" });
    
    
      from datetime import datetime
      import requests
      import rsa
    
      def call_api(method, body = []):
        global APIUrl
        headers = {
          "Content-Type": "application/x-www-form-urlencoded"
        }
        nonce = int(datetime.now().timestamp() * 1000)
        auth_payload = method + str(nonce)
        signature = rsa.sign(auth_payload.encode(), key, "SHA-256").hex()
        headers["APIKey"] = "<INSERT_YOUR_API_KEY_HERE>"
        headers["APINonce"] = str(nonce)
        headers["APISignature"] = signature
        headers["APIAuthPayload"] = auth_payload
    
        res = requests.post(APIUrl + method, headers=headers, data=body, timeout=60)
        print(method, res.text, "\n")
    
      APIUrl = "https://api.chainrift.com/"
      pkcs1 = "<INSERT_YOUR_PRIVATE_KEY_HERE>"
      key = rsa.PrivateKey.load_pkcs1(pkcs1)
    
      // Example private API calls
      call_api("v1/Private/GetBalances");
      call_api("v1/Private/GetDetailedBalances");
      call_api("v1/Private/GetDepositAddresses");
      call_api("v1/Private/GenerateDepositAddress");
      call_api("v1/Private/GetWithdrawAddresses");
      call_api("v1/Private/GetDeposits");
      call_api("v1/Private/GetWithdrawals");
      call_api("v1/Private/GetOpenOrders");
      call_api("v1/Private/GetTradeHistory");
      call_api("v1/Private/PlaceOrders", { "price": 0.01184862, "quantity": 1, "type": "buy", "symbol": "ETH/BTC" });
      call_api("v1/Private/MoveOrders", { "orderId": "efaebd52-d627-4bb4-a932-55c2577be756", "price": 0.02184862 });
      call_api("v1/Private/CancelOrder", { "orderId": "efaebd52-d627-4bb4-a932-55c2577be756" });
      call_api("v1/Private/CancelAllOrders");
      call_api("v1/Private/CreateWithdrawal", { "coin": "BTC", "quantity": 0.1, "address": "mhyMHUfApEUugEWGV8Bk7JGKaFwiZaP1tT" });
    
    <?php
    $APIUrl = "https://api.chainrift.com/";
    $fname = "9c642eae-d876-443c-af60-076b517b9509_pkcs1.pem";
    $fopen = fopen($fname, "r");
    $content = fread($fopen, 9999999);
    fclose($fopen);
    
    $cert = openssl_pkey_get_private($content);
    
    function callAPI ($method, $body = []) {
      global $APIUrl, $cert;
      $url = $APIUrl . $method;
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
      $headers = [
        "Content-Type: application/x-www-form-urlencoded",
      ];
    
      if (count($body) > 0) {
        $body_data = http_build_query($body);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $body_data);
        $content_length = strlen($body_data);
      } else {
        $content_length = 0;
      }
      $headers[] = "Content-Length: " . strval($content_length);
    
      if (strpos("Private", $method) >= 0) {
        $nonce = time(true);
        $authPayload = $method . strval($nonce);
        $sign = openssl_sign($authPayload, $signature, $cert, OPENSSL_ALGO_SHA256);
        $hexsignature = bin2hex($signature);
        $headers[] = "APIKey: 9c642eae-d876-443c-af60-076b517b9509";
        $headers[] = "APINonce: {$nonce}";
        $headers[] = "APISignature: {$hexsignature}";
        $headers[] = "APIAuthPayload: {$authPayload}";
      }
    
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      $response = curl_exec($ch);
      curl_close($ch);
    
      echo "Response for {$method}: {$response}\n\n";
    }
    
    // Example private API calls
    callAPI("v1/Private/GetBalances");
    callAPI("v1/Private/GetDetailedBalances");
    callAPI("v1/Private/GetDepositAddresses");
    callAPI("v1/Private/GenerateDepositAddress");
    callAPI("v1/Private/GetWithdrawAddresses");
    callAPI("v1/Private/GetDeposits");
    callAPI("v1/Private/GetWithdrawals");
    callAPI("v1/Private/GetOpenOrders");
    callAPI("v1/Private/GetTradeHistory");
    callAPI("v1/Private/PlaceOrders", [ "price" => 0.01184862, "quantity" => 1, "type" => "buy", "symbol" => "ETH/BTC" ]);
    callAPI("v1/Private/MoveOrders", [ "orderId" => "efaebd52-d627-4bb4-a932-55c2577be756", "price" => 0.02184862 ]);
    callAPI("v1/Private/CancelOrder", [ "orderId" => "efaebd52-d627-4bb4-a932-55c2577be756" ]);
    callAPI("v1/Private/CancelAllOrders");
    callAPI("v1/Private/CreateWithdrawal", [ "coin" => "BTC", "quantity" => 0.1, "address" => "mhyMHUfApEUugEWGV8Bk7JGKaFwiZaP1tT" ]);
    
    using Org.BouncyCastle.Crypto;
    using Org.BouncyCastle.Crypto.Parameters;
    using Org.BouncyCastle.OpenSsl;
    using Org.BouncyCastle.Security;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Net;
    using System.Security.Cryptography;
    using System.Text;
    
    namespace API_CS_Example
    {
        class Program
        {
            const string APIUrl = "https://api.chainrift.com/v1";
            static void CallAPI(string method, Dictionary<string, object> body = null)
            {
                try
                {
                    var req = WebRequest.Create(APIUrl + method);
                    req.Method = "POST";
                    req.ContentType = "application/json";
                    req.Headers = new WebHeaderCollection()
                    {
                        "Content-Type: application/x-www-form-urlencoded"
                    };
    
                    if (method.Contains("Private"))
                    {
                        var pemstring = @"<INSERT_YOUR_PRIVATE_KEY_HERE";
                        var privateKey = GetRSAProviderFromPem(pemstring);
                        var nonce = 10;
                        var authPayload = method + nonce.ToString();
                        var hexsignature = BitConverter.ToString(privateKey.SignData(Encoding.ASCII.GetBytes(authPayload), "SHA256")).Replace("-", "");
                        req.Headers.Add($"APIKey: <INSERT_YOUR_API_KEY_HERE>");
                        req.Headers.Add($"APINonce: {nonce}");
                        req.Headers.Add($"APISignature: {hexsignature}");
                        req.Headers.Add($"APIAuthPayload: {authPayload}");
                    }
    
                    var reqStream = req.GetRequestStream();
                    var response = req.GetResponse();
                    var resStream = new StreamReader(response.GetResponseStream());
                    var data = resStream.ReadToEnd();
                    Console.WriteLine(method + ": " + data + "\n");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Exception while calling {method} {ex.Message}");
                }
            }
    
            static void Main(string[] args)
            {
                // Example public API calls
                CallAPI("v1/Private/GetBalances");
                CallAPI("v1/Private/GetDetailedBalances");
                CallAPI("v1/Private/GetDepositAddresses");
                CallAPI("v1/Private/GenerateDepositAddress");
                CallAPI("v1/Private/GetWithdrawAddresses");
                CallAPI("v1/Private/GetDeposits");
                CallAPI("v1/Private/GetWithdrawals");
                CallAPI("v1/Private/GetOpenOrders");
                CallAPI("v1/Private/GetTradeHistory");
                CallAPI("v1/Private/PlaceOrders", new Dictionary<string, object>() { { "price", 0.01184862 }, { "quantity", 1 }, { "type", "buy" }, { "symbol", "ETH/BTC" } });
                CallAPI("v1/Private/MoveOrders", new Dictionary<string, object>() { { "orderId", "efaebd52-d627-4bb4-a932-55c2577be756" }, { "price", 0.02184862 } });
                CallAPI("v1/Private/CancelOrder", new Dictionary<string, object>() { { "orderId", "efaebd52-d627-4bb4-a932-55c2577be756" } });
                CallAPI("v1/Private/CancelAllOrders");
                CallAPI("v1/Private/CreateWithdrawal", new Dictionary<string, object>() { { "coin", "BTC" }, { "quantity", 0.1 }, { "address", "mhyMHUfApEUugEWGV8Bk7JGKaFwiZaP1tT" } });
            }
    
            public static RSACryptoServiceProvider GetRSAProviderFromPem(String pemstr, string type = "Private")
            {
                CspParameters cspParameters = new CspParameters();
                RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider(cspParameters);
    
                Func<RSACryptoServiceProvider, RsaKeyParameters, RSACryptoServiceProvider> MakePublicRCSP = (RSACryptoServiceProvider rcsp, RsaKeyParameters rkp) =>
                {
                    RSAParameters rsaParameters = DotNetUtilities.ToRSAParameters(rkp);
                    rcsp.ImportParameters(rsaParameters);
                    return rsaKey;
                };
    
                Func<RSACryptoServiceProvider, RsaPrivateCrtKeyParameters, RSACryptoServiceProvider> MakePrivateRCSP = (RSACryptoServiceProvider rcsp, RsaPrivateCrtKeyParameters rkp) =>
                {
                    RSAParameters rsaParameters = DotNetUtilities.ToRSAParameters(rkp);
                    rcsp.ImportParameters(rsaParameters);
                    return rsaKey;
                };
    
                PemReader reader = new PemReader(new StringReader(pemstr));
                object kp = reader.ReadObject();
    
                // If object has Private/Public property, we have a Private PEM
                if (type == "Private")
                    return (kp.GetType().GetProperty(type) != null) ? MakePrivateRCSP(rsaKey, (RsaPrivateCrtKeyParameters)(((AsymmetricCipherKeyPair)kp).Private)) : MakePublicRCSP(rsaKey, (RsaKeyParameters)kp);
                return MakePublicRCSP(rsaKey, (RsaKeyParameters)((AsymmetricCipherKeyPair)kp).Public);
            }
        }
    }
    
    
    <html>
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
    </head>
    <body>
    <textarea id="txtClear" cols="80" rows="3">Private/GetBalances</textarea>
    <br/>
    <textarea id="apiKey" cols="80" rows="3">INSERT_API_KEY_HERE</textarea>
    <br/>
    <textarea id="prikey" cols="80" rows="10">INSERT_PRIVATE_KEY_HERE
    </textarea>
    <br/>
    <script>
        var crypto = window.crypto || window.msCrypto;
        var nonce;
        var APIUrl = "https://api.chainrift.com/";
        var signAlgorithm = {
            name: "RSASSA-PKCS1-v1_5",
            hash: {
                name: "SHA-256"
            },
        };
    
        // Helper methods
        function arrayBufferToBase64String(arrayBuffer) {
            var byteArray = new Uint8Array(arrayBuffer)
            var byteString = '';
            for (var i=0; i<byteArray.byteLength; i++) {
                byteString += String.fromCharCode(byteArray[i]);
            }
            return btoa(byteString);
        }
    
        function base64StringToArrayBuffer(b64str) {
            var byteStr = atob(b64str);
            var bytes = new Uint8Array(byteStr.length);
            for (var i = 0; i < byteStr.length; i++) {
                bytes[i] = byteStr.charCodeAt(i);
            }
            return bytes.buffer;
        }
    
        function textToArrayBuffer(str) {
            var buf = unescape(encodeURIComponent(str));
            var bufView = new Uint8Array(buf.length);
            for (var i=0; i < buf.length; i++) {
                bufView[i] = buf.charCodeAt(i);
            }
            return bufView;
        }
    
        function convertPemToBinary(pem) {
            var lines = pem.split('\n');
            var encoded = '';
            for(var i = 0;i < lines.length;i++){
                if (lines[i].trim().length > 0 &&
                    lines[i].indexOf('-BEGIN PRIVATE KEY-') < 0 &&
                    lines[i].indexOf('-END PRIVATE KEY-') < 0) {
                    encoded += lines[i].trim();
                }
            }
            return base64StringToArrayBuffer(encoded);
        }
    
        function importPrivateKey(pemKey) {
            return new Promise(function(resolve) {
            var importer = crypto.subtle.importKey("pkcs8", convertPemToBinary(pemKey), signAlgorithm, false, ["sign"]);
                importer.then(function(key) { 
                    resolve(key);
                })
                .catch (function (ex) {
                    console.log("An error occurred while importing private key:", ex);
                });
            });
        }
    
        function setHeaders(jqXHR, nonce, ajaxSignature, ajaxPayload) {
            jqXHR.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            jqXHR.setRequestHeader("APINonce", nonce);
            jqXHR.setRequestHeader("APIKey", $("#apiKey").val());
            jqXHR.setRequestHeader("APISignature", ajaxSignature);
            jqXHR.setRequestHeader("APIAuthPayload", ajaxPayload);
        }
    
        // AJAX Helpers
        function callAPI(method, reqData, nonce, signature, payload) {
            $.ajax({
                // Only async to executed methods sequentially while testing
                async: false,
                method: "POST",
                url: APIUrl + method,
                data: reqData,
                beforeSend: function (jqXHR, settings) {
                    if (method.indexOf("Private") >= 0) {
                        setHeaders(jqXHR, nonce, signature, payload);
                    }
                },
                success: function (data) {
                    console.log(method, data);
                },
                complete: function (data) {
                    if (data.status != 200) {
                        console.log(`Request response code is ${data.status}`, data);
                    }
                }
            });
        }
    
        function callMethod(method, reqData = {}) {
            if (method.indexOf("Private") >= 0) {
                let nonce = new Date().getTime();
                let ajaxPayload = method + nonce;
                crypto.subtle.sign(signAlgorithm, pkey, textToArrayBuffer(ajaxPayload)).then(function (cipheredData) {
                    ajaxSignature = Array.from(new Uint8Array(cipheredData), function (byte) { return ('0' + (byte & 0xFF).toString(16)).slice(-2); }).join("");
                    callAPI(method, reqData, nonce, ajaxSignature, ajaxPayload);
                });
            } else {
                callAPI(method, reqData);
            }
        }
    
        // Examples calls to private methods
        var pkey;
        if (crypto.subtle) {
            importPrivateKey($('#prikey').val()).then(function (key) {
                pkey = key;
                callMethod("v1/Private/GetBalances");
                callMethod("v1/Private/GetDetailedBalances");
                callMethod("v1/Private/GetDepositAddresses");
                callMethod("v1/Private/GenerateDepositAddress");
                callMethod("v1/Private/GetWithdrawAddresses");
                callMethod("v1/Private/GetDeposits");
                callMethod("v1/Private/GetWithdrawals");
                callMethod("v1/Private/GetOpenOrders");
                callMethod("v1/Private/GetTradeHistory");
                call_api("v1/Private/PlaceOrders", { price: 0.01184862, quantity: 1, type: "buy", symbol: "ETH/BTC" });
                call_api("v1/Private/MoveOrders", { orderId: "efaebd52-d627-4bb4-a932-55c2577be756", price: 0.02184862 });
                callMethod("v1/Private/CancelOrder", { orderId: "efaebd52-d627-4bb4-a932-55c2577be756" });
                callMethod("v1/Private/CancelAllOrders");
                callMethod("v1/Private/CreateWithdrawal", { coin: "BTC", quantity: 0.1, address: "mhyMHUfApEUugEWGV8Bk7JGKaFwiZaP1tT" });
          });
        }
    </script>
    </html>
    
    

    Here's a full list of our private methods:

    Websocket API

    Note: Our Websocket API is currently in beta.

    Getting Started

    Connect your websocket client to: wss://ws.chainrift.com/v1

    In addition to our standard public/private API methods, Chainrift allows subscribing to real-time data via our Public and Private Channels.

    Hearbeating

    Response:

    { 
      "success": true,
      "data": "20181027 21:55:11",
      "method": "heartbeat"
    }
    

    To check whether your client is still connected, the Websocket server will send a heartbeat message every 30 seconds in the following format.

    Public

    Channels

    Order Book

    Example request object:

    {
        "name":"SubscribeOrderBook",
        "data":"DCRBTC",
    }
    

    Provides real-time order book data of the specified coin pair.

    Parameter Required Type Description
    name Yes string SubscribeOrderBook
    data Yes object Coin Pair

    To unsubscribe to this channel, simply pass UnSubscribeOrderBook in the name parameter.

    Trades

    Example request object:

    {
        "name":"SubscribeTrades",
        "data":"DCRBTC",
    }
    

    Provides real-time tradedata of the specified coin pair.

    Parameter Required Type Description
    name Yes string SubscribeTrades
    data Yes object Coin Pair

    To unsubscribe to this channel, simply pass UnSubscribeTrades in the name parameter.

    Ticker

    Example request object:

    {
        "name":"SubscribeTicker",
        "data":"DCRBTC",
    }
    

    Provides real-time ticker data of the specified coin pair.

    Parameter Required Type Description
    name Yes string SubscribeTicker
    data Yes object Coin Pair

    To unsubscribe to this channel, simply pass UnSubscribeTicker in the name parameter.

    Methods

    To send a public request, send a JSON message with the following properties:

    Example request object:

    {
        "name": "GetOrderBook",
        "data": {
            "symbol": "DCRBTC"    
        },
    }
    
    Parameter Required Type Description
    name Yes string The public method's name (ex. GetPairs).
    data No object Additional parameters. For more details please see the specific method's additional parameters.

    Here's a full list of our public methods:

    Private

    Authentication

    To access our Websocket API's private channels and methods, you must first login by sending the following JSON object:

    Example login request object:

    {
        "name": "Login",
        "data": {
            "apikey": "152bcca9-082e-4c90-8210-3df3960e0e7b",
            "apisignature": "5aa4891e1fe2353230553fe299f8a294e1f13dce387009c78a887ff7e9b6a90bc590c8af07a6559ab977c72f6ca270b3f8da2ae9b510e36d40fd0f9aceb7efd9",
            "apiauthpayload": "Login1541009122583"
        },
        "apinonce": 1541009122583
    }
    
    Parameter Required Type Description
    name Yes string Login
    data Yes object Pass the apikey, apisignature, apiauthpayload. It is important to prepend Login to the apiauthpayload string (see the example on the right). For more details on how to get these values visit our section on authentication.
    apinonce Yes int API Nonce

    Failed authentication error message:

    {
        "nonce": 1541011472464,
        "success": false,
        "data": "You have to login in order to access GetBalances",
        "method": "GetBalances",
        "errorcode": "401"
    }
    

    If authentication fails, or you've tried accessing a private channel/method, you will recieve the following error message.

    Channels

    My Balance Changes

    Example request object:

    {
        "name": "SubscribeMyBalanceChanges",
        "data": ""   
    }
    

    Provides real-time data of any changes in the authenticated user's balance.

    Parameter Required Type Description
    name Yes string Channel name: SubscribeMyBalanceChanges
    data Yes string Pass an empty string here

    To unsubscribe to this channel, simply pass UnSubscribeMyBalanceChanges in the name parameter.

    My Orders

    Example request object:

    {
        "name": "SubscribeMyOrders",
        "data": {},
    }
    

    Provides real-time data of the authenticated user's orders.

    Parameter Required Type Description
    name Yes string SubscribeMyOrders
    data Yes object Pass an empty object here

    To unsubscribe to this channel, simply pass UnSubscribeMyOrders in the name parameter.

    My Trades

    Example request object:

    {
        "name": "SubscribeMyTrades",
        "data": {},
    }
    

    Provides real-time data of the authenticated user's trades.

    Parameter Required Type Description
    name Yes string SubscribeMyTrades
    data Yes object Pass an empty object here

    To unsubscribe to this channel, simply pass UnSubscribeMyTrades in the name parameter.

    Methods

    Example request object:

    {
        "name": "GetWithdrawals",
        "data": {
            "symbol": "DCRBTC",
            "datefrom": "20180101 00:00:00",
            "dateto": "20180102 00:00:00"
        },
    }
    

    To send a private request, send a JSON message with the following properties:

    Parameter Required Type Description
    name Yes string The public method's name (ex. GetPairs).
    data No object Additional parameters. For more details please see the specific method's additional parameters.
    apinonce Yes int API Nonce

    Here's a full list of our private methods:

    Dead Man Switch

    Example Dead Man Switch request object:

    {
        "name": "DeadManSwitch",
        "data": "10000", 
    }
    

    To disable an active Dead Man Switch:

    {
        "name": "DeadManSwitch",
        "data": "0", 
    }
    

    ChainRift offers "Dead Man Switch” or auto-cancel functionality to help prevent unexpected losses from network malfunctions.

    Send the dead man switch request to set a timer (in milliseconds) for when all your orders will automatically cancel. To disable the dead man switch, send another request with a time of 0 miliseconds. If you fail to send another request to extend the time or disable the dead man switch, all of your orders will be cancelled when the timer runs out.

    Parameter Required Type Description
    name Yes string Enter DeadManSwitch
    data Yes integer Time limit. Enter 0 to disable the dead man switch.

    Methods

    Public Methods

    GetPairs

    Response:

    {
      "success": true,
      "data": [
        {"symbol": "BEAM/BTC",
          "buymakerfee": 0.00000000,
          "sellmakerfee": 0.00000000,
          "buytakerfee": 0.00200000,
          "selltakerfee": 0.00020000,
          "mintradevalue": 0.00010000,
          "decimals":
            {
                "price": 8,
                "amount": 8
            }
        },
        {
            "symbol": "BTC/USD",
            "buymakerfee": 0.00150000,
            "sellmakerfee": 0.00150000,
            "buytakerfee": 0.00250000,
            "selltakerfee": 0.00250000,
            "mintradevalue": 10.00000000,
            "decimals":
            {
                "price": 2,
                "amount": 8
            }
        },
        {
    
            "symbol":"EOS/BTC",
            "buymakerfee": 0.00000000,
            "sellmakerfee": 0.00000000,
            "buytakerfee": 0.00250000,
            "selltakerfee": 0.00250000,
            "mintradevalue": 0.00000100,
            "decimals":
            {
                "price": 8,
                "amount": 4
            }
        },
        ...
      ],
      "method": "Public/GetPairs"
    }
    
    

    Returns a list of active coin pairs.

    HTTP Request

    GET https://api.chainrift.com/v1/Public/GetPairs

    Returns

    Key Type Description
    symbol string The symbol for the coin pair (ex. BTC/USD).
    buymakerfee decimal The maker buying fee.
    buytakerfee decimal The taker buying fee.
    sellmakerfee decimal The maker selling fee.
    selltakerfee decimal The taker selling fee.
    mintradevalue decimal The minimum trade amount.
    decimals object The decimal precision for the price and amount. Click here for more information.

    GetPairStats

    Response:

    {
      "success": true,
      "data": [
        {
          "symbol": "BTC/USD",
          "lastprice": 7967.43759665,
          "high": 8615.65061449,
          "low": 7350.5912898,
          "volume": 454.90918703,
          "buytotal": 307986.66972244,
          "selltotal": 6364.26247791
        }
      ],
      "method": "Public/GetPairStats"
    }
    

    Returns information about the coin pairs.

    HTTP Request

    GET http://api.chainrift.com/v1/Public/GetPairStats?

    Parameter Required Type Description
    symbol No string This indicates coin pair (ex. BTC/USD).

    Returns

    Key Type Description
    symbol string The symbol for the coin pair (ex. BTC/USD)
    lastPrice decimal The market's last price.
    high decimal The 24 hour high market price.
    low decimal The 24 hour low market price.
    volume decimal The market's 24 hour volume.
    buytotal decimal The total of the the buy order book.
    selltotal decimal The total of the the sell order book.

    Market

    Response:

    {
      "success": true,
      "data": [
        {
          "symbol": "BTC/USD",
          "last": 7967.43759665,
          "change": 0.0636,
          "volume": 454.90918703,
          "high": 8615.65061449,
          "low": 7350.5912898,
          "bid": 7873.47249356,
          "ask": 7967.43759665,
          "timestamp": "2018-05-09T14:34:10.991",
          "openbuyorders": 2550,
          "opensellorders": 375114,
          "prevday": 7429.72650473,
          "created": "2018-03-05T12:47:08.000"
        }
      ],
      "method": "Public/Market"
    }
    

    Returns a list of ticker items for an active market or for all active markets.

    HTTP Request

    GET https://api.chainrift.com/v1/Public/Market?

    Parameter Required Type Description
    symbol No string This indicates the coin pair (ex. BTC/USD).

    Returns

    Key Type Description
    symbol string This string represents the market's symbol (ex. BTC/USD).
    last decimal The market's last price.
    change decimal The market's 24h change.
    volume decimal The market's 24 hour volume. (1st Coin in the pair)
    high decimal The 24 hour high market price.
    low decimal The 24 hour low market price.
    bid decimal The market's largest buyer price.
    ask decimal The market's lowest seller price.
    timestamp string The date the market data was updated.
    openbuyorders int The number of open buy orders
    opensellorders int The number of open sell orders.
    prevday decimal The previous day's buying price.
    created string The date the market was added.
    Errors
    You must provide a valid pair.

    GetOrderBook

    Response:

    {
      "success":true,
      "pair": "LTC/BTC",
      "data":[
        {
          "quantity":0.10585438,
          "price":0.20345334,
          "type":"Buy"
        },
        ...
      ],
      "method": "Public/GetOrderBook"
    }
    

    Returns a list of order items for a specified active coin pair. We allow a stop parameter to indicate how many entries in orderbook we shall return (for each order type buy/sell). The hardcoded limit is 250 entries - at the moment we will not return more than 250 rows for both buy/sell orders.

    HTTP Request

    GET https://api.chainrift.com/v1/Public/GetOrderBook?symbol=<symbol>

    Parameter Required Type Description
    symbol yes string The symbol for the coin pair (ex. BTC/USD).
    stop no integer The number of order book entries to return. (250 max)

    Returns

    Array of:

    Key Type Description
    quantity decimal The quantity of the order book.
    price decimal The last price.
    type string The transaction type “Buy” or “Sell”.
    Errors
    You must provide a valid symbol

    GetTradeHistory

    Response:

    {
      "success":true,
      "data":[
        {
          "date" : "2017-08-01T00:00:00.000",
          "type" : "Buy",
          "rate" : 0.003453342,
          "amount" : 5.09843672
        },
        ...
      ],
      "method":"Public/GetTradeHistory"
    }
    

    Returns the list of trades ordered by creation date.

    HTTP Request

    GET https://api.chainrift.com/v1/Public/GetTradeHistory?symbol=<symbol>&start=<start>&stop=<stop>

    Parameter Required Type Description
    symbol no string The symbol for the coin pair (ex. BTC/USD).
    start no string This indicates the row number to start from.
    stop no string This indicates the row number to stop.

    Returns

    Array of:

    Key Type Description
    date string The date the trade was created.
    type string The transaction type “Buy” or “Sell”
    rate decimal The trade price.
    amount decimal The trade amount.
    Errors
    You must provide a valid symbol

    Private Methods

    GetBalances

    Response:

    {
       "success":true,
       "data":[
          {
             "coin":"ETH",
             "quantity":199.9990
          },
          {
            "coin":"USDT Meta",
            "quantity":15200.15257599,
            "availableforwithdrawal":[
               {
                  "coin":"USDT ERC20",
                  "quantity":15200.15257599
               },
               {
                  "coin":"USDT Omni",
                  "quantity":0.0
               }
            ]
          },
          ...
       ],
       "method":"Private/GetBalances"
    }
    

    Returns the user's total balance.

    For coins with multiple implementations, an array of objects is returned with the available balance for each different implementation. In the example on the left, you will see that 'USDT Meta' is a coin that supports both OMNI and ERC 20 USDT implementations.

    HTTP Request

    POST https://api.chainrift.com/v1/Private/GetBalances

    Returns

    Key Type Description
    coin string The coin name.
    quantity decimal The user's balance for the coin specified.
    availableforwithdrawal array The available withdrawal amount for each particular coin implementation

    GetDetailedBalances

    Response:

    {
       "success":true,
       "data":[
            {
               "coin":"LTC",
               "availablebalance":4.0319169021100000,
               "pendingdeposits":0.0000000000000000,
               "pendingwithdrawals":0.0000000000000000,"heldfororders":3.0000000000000000
            },
            {
                "coin":"BTC",
                "availablebalance":1.8883150258066379,
                "pendingdeposits":0.0000000000000000,
                "pendingwithdrawals":0.0000000000000000,
                "heldfororders":0.0000000000000000
            },
            {
                "coin":"DASH",
                "availablebalance":2.003200000000000,
                "pendingdeposits":0.0000000000000000,
                "pendingwithdrawals":0.0000000000000000,
                "heldfororders":0.0000000000000000
            },
            {
                "coin":"DCR",
                "availablebalance":1.0000000000000000,
                "pendingdeposits":0.3200000000000000,
                "pendingwithdrawals":0.0000000000000000,
                "heldfororders":0.0000000000000000
            },
           ...
        ],
        "method":"Private/GetDetailedBalances"}
    }
    

    Returns the user's entire balance including each coin's available balance, pending deposits, pending withdrawals, and amount held for active orders.

    HTTP Request

    POST https://api.chainrift.com/v1/Private/GetDetailedBalances

    Returns

    Key Type Description
    coin string The coin name.
    availablebalance decimal The user's available balance for withdrawal and trading.
    pendingdeposits decimal The user's incoming deposits.
    pendingwithdrawals decimal The user's pending withdrawal amount.
    heldfororders decimal The user's balance held for active orders.

    GetDepositAddresses

    Response:

    {
        "success": true,
        "data": [
            {
                "coin": "LTC",
                "addresses": [
                    {
                        "address": "mvgnWjX78aAuT65YPAzJJnvw7vTFkRh9jF",
                        "id": ""
                    }
                ]
            },
            {
                "coin": "XRP",
                "addresses": [
                    {
                        "address": "rMvT6j5m5Q9jpzx9AWPHAapQmpmxiSKBy8",
                        "id": "123"
                    },
                    {
                        "address": "rpkd8PLVYBdr45XWNnphZtneppKtNoZP5R",
                        "id": "3478338959"
                    },
                    {
                        "address": "rMYRD3d6K6PHj1Lgj4xfjASN7ZkzGoBpUr",
                        "id": "3478338959"
                    }
                ]
            }
        ],
        "method":"Private/GetDepositAddresses"
    }
    

    Returns a list of deposit addresses for each coin for the current user.

    HTTP Request

    POST https://api.chainrift.com/v1/Private/GetDepositAddresses

    Returns

    Key Type Description
    coin string The coin name.
    addresses string array This string array contains the coin's addresses and identifiers (if available). If this is a Monero(XMR) based address, then this represents the address' payment ID (if available). If this is a Ripple(XRP) based address, then this represents the address' destination tag (if available).

    GenerateDepositAddress

    Response:

    {
       "success":true,
       "data":"n4VQ5YdHf7hLQ2gWQYYrcxoE5B7nWuDFNF",
       "method":"Private/GenerateDepositAddress"
    }
    

    Generates a deposit address, up to a maximum of 10 visible, for the current user. You can generate up to 3 addresses per day.

    HTTP Request

    POST https://api.chainrift.com/v1/Private/GenerateDepositAddress

    Parameter Required Type Description
    coin yes string Coin Name

    Returns

    Key Type Description
    data string The deposit address created.
    Errors
    You have already assigned the maximum number of addresses for the selected coin type.
    The coin type you provided is not supported.
    You need to provide a coin type for address generation.
    You have reached the maximum daily limit of 1 deposit addresses for coin.
    You can not generate a new deposit address until you use the last generated deposit address.
    The coin you provided is not supported.
    Sorry, we can not generate an address at the moment.

    GetWithdrawAddresses

    Response:

    {
        "success": true,
        "data": [
            {
                "coin": "LTC",
                "addresses": [
                    {
                        "address": "mvgnWjX78aAuT65YPAzJJnvw7vTFkRh9jF",
                        "id": ""
                    }
                ]
            },
            {
                "coin": "XRP",
                "addresses": [
                    {
                        "address": "rMvT6j5m5Q9jpzx9AWPHAapQmpmxiSKBy8",
                        "id": "123"
                    },
                    {
                        "address": "rpkd8PLVYBdr45XWNnphZtneppKtNoZP5R",
                        "id": "3478338959"
                    },
                    {
                        "address": "rMYRD3d6K6PHj1Lgj4xfjASN7ZkzGoBpUr",
                        "id": "3478338959"
                    }
                ]
            }
        ],
        "method":"Private/GetWithdrawAddresses"
    }
    

    Returns active coins and withdrawal addresses for each coin for the current user.

    HTTP Request

    POST https://api.chainrift.com/v1/Private/GetWithdrawAddresses

    Returns

    Array of:

    Key Type Description
    coin string The coin name.
    addresses string array This string array contains the coin's addresses and identifiers (if available). If this is a Monero(XMR) based address, then this represents the address' payment ID (if available). If this is a Ripple(XRP) based address, then this represents the address' destination tag (if available).

    GetDeposits

    Response:

    {
       "success":true,
       "data":[
          {
             "coin":"BTC",
             "address":"muAY1orcwyx2xu28HZChqQSguqsR58HDQh",
             "id":"",
             "quantity":1.1000,
             "confirmations":6,
             "txid":"7fbf0168f5f961a471b9e8854851ee4a7542333db0b90df4909149d7d5ea8615",
             "timestamp":"2017-10-06T18:24:49.807075",
             "status":"Complete"
          }
       ],
       "method":"Private/GetDeposits"
    }
    

    Returns deposits from a start date to an end with a default pagination of 10 records for the current user.

    HTTP Request

    GET https://api.chainrift.com/v1/Private/GetDeposits

    Parameter Required Type Description
    start no string This indicates start date with the following format: "YYYY-MM-DD HH:mm:ss".
    end no string This indicates end date with the following format: "YYYY-MM-DD HH:mm:ss".
    coin no string The coin name.
    pageindex no integer This indicates the page number.
    pagesize no integer This indicates the number of records to display.

    Returns

    Array of:

    Key Type Description
    coin string The coin name.
    address string The deposit address.
    quantity decimal The deposit quantity.
    confirmations int The number of confirmations required.
    txid string This is the transaction identifier. A hyphenated value, represents a deposit from another account on our exchange.
    timestamp string The date the deposit was created.
    status string The transaction status of the deposit.
    Errors
    You need to provide start and end parameters as "YYYY-MM-DD HH:mm:ss" timestamp.
    The coin you provided is not supported.

    GetWithdrawals

    Response:

    {
       "success":true,
       "data":[
          {
             "coin":"BTC",
             "address":"muAY1orcwyx2xu28HZChqQSguqsR58HDQh",
             "id":"",
             "quantity":1.1000,
             "confirmations":6,
             "txid":"7fbf0168f5f961a471b9e8854851ee4a7542333db0b90df4909149d7d5ea8615",
             "timestamp":"2017-10-06T18:24:49.807075",
             "status":"Complete"
          }
       ],
       "method":"Private/GetWithdrawals"
    }
    
    

    Returns Withdrawals from a start date to an end with a default pagination of 10 records for the current user.

    HTTP Request

    GET https://api.chainrift.com/v1/Private/GetWithdrawals

    Parameter Required Type Description
    start yes string Start date with the following format: "YYYY-MM-DD HH:mm:ss".
    end yes string End date with the following format: "YYYY-MM-DD HH:mm:ss".
    coin no string Coin Name
    pageindex yes integer Page number
    pagesize yes integer Number of records to display

    Returns

    Array of:

    Key Type Description
    coin string The coin name.
    address string The withdrawal Address.
    id string id
    quantity decimal The withdrawal quantity.
    confirmations int The number of confirmations required.
    txid string This is the transaction ID. A hyphenated value, represents a withdrawal from another account on our exchange.
    timestamp string The date the widthrawal was created.
    status string The transaction Status of the withdrawal.
    Errors
    You need to provide start and end parameters as "YYYY-MM-DD HH:mm:ss" timestamp.
    The coin you provided is not supported.

    GetOpenOrders

    Response:

    {
       "success":true,
       "data":[
          {
             "orderid":"fe6ecaae-3c7c-4258-83ce-7519d091780c",
             "quantity":5.0,
             "price":0.00002400,
             "type":"Buy",
             "symbol":"ETH/BTC",
             "leaveqty":"4.3"
          }
       ],
       "method":"Private/GetOpenOrders"
    }
    

    Returns open orders for the current user.

    GET https://api.chainrift.com/v1/Private/GetOpenOrders

    Parameter Required Type Description
    symbol no string The symbol for the coin pair (ex. BTC/USD)
    orderids no array The order IDs of the specific open orders you wish to fetch.

    Returns

    Array of:

    Key Type Description
    orderid string The order identifier.
    quantity decimal The order quantity.
    price decimal The order price.
    type string The transaction type “Buy” or “Sell”.
    symbol string The symbol for the coin pair (ex. BTC/USD).
    leaveqty decimal The un-filled order quantity.

    GetOrders

    Response:

    {
       "success":true,
       "data":[
          {
             "orderid":"fe6ecaae-3c7c-4258-83ce-7519d091780c",
             "quantity":5.0,
             "price":0.00002400,
             "type":"Buy",
             "symbol":"ETH/BTC",
             "leaveqty": 0  
          }
          {
             "orderid":"fe9fraae-3c7c-4658-97ce-7529d091780c",
             "quantity":10.34567324,
             "price":0.01400,
             "type":"Buy",
             "symbol":"LTC/BTC",
             "leaveqty": 5.34567324  
          }
       ],
       "method":"Private/GetOrders"
    }
    

    Returns open orders and completed orders for the current user.

    GET https://api.chainrift.com/v1/Private/GetOrders

    Parameter Required Type Description
    symbol no string The symbol for the coin pair (ex. BTC/USD)
    orderids no array The order IDs of the specific open orders you wish to fetch.

    Returns

    Array of:

    Key Type Description
    orderid string The order identifier.
    quantity decimal The order quantity.
    price decimal The order price.
    type string The transaction type “Buy” or “Sell”.
    symbol string The symbol for the coin pair (ex. BTC/USD).
    leaveqty decimal The un-filled order quantity.

    GetTradeHistory

    Response:

    {
       "success":true,
       "data":[
          {
             "date":"2017-09-22T05:04:49.703423",
             "type":"Buy",
             "rate":1.0,
             "amount":1.0,
             "symbol":"ETH/BTC",
             "orderid":"af4a8ba1-9600-4a70-a92b-9cfcbdd44074"
          }
       ],
       "method":"Private/GetTradeHistory"
    }
    

    Returns a user's trade history.

    GET https://api.chainrift.com/v1/Private/GetTradeHistory

    Parameter Required Type Description
    start no string Start date with the following format: "YYYY-MM-DD HH:mm:ss"
    end no string End date with the following format: "YYYY-MM-DD HH:mm:ss"
    coin no string Coin Name
    pageindex no integer Page number
    pagesize no integer Number of records to display

    Returns

    Array of:

    Key Type Description
    date string The date the trade was created.
    type string The transaction type “Buy” or “Sell”.
    rate decimal The trade price.
    amount decimal The trade amount.
    symbol string The market symbol.
    orderid string The trade's order identifier.
    Errors
    The coin you provided is not supported.

    PlaceOrders

    Response:

    {
      "orderids" : [
        {
          "tempid":1,
          "id": "df6d8ba1-9600-4a70-a92b-9cfcbdd44074"
        },
        {
          "tempid":2,
          "id": "af4a8ba1-9600-4a70-a92b-9cfcbdd44074"
        }
      ], 
      "errors" : [
        { 
          "tempid":3,
          "error":"You do not have enough balance to complete this operation"
        }
      ]
    }
    

    Places one or multiple orders for the current user.

    POST https://api.chainrift.com/v1/Private/PlaceOrders

    This method accepts a JSON array named orders with the following object:

    Parameter Required Type Description
    tempid yes string An order identifier set by the user. This could be any string.
    price yes decimal The price* for the order being placed.
    quantity yes decimal This indicates the order quantity*.
    type yes string The transaction type “Buy” or “Sell”.
    symbol yes string The market symbol (ex. BTC/USD) in which to place the order.

    * There are decimal limits for the order quantity and price for each coin pair (symbol). Trying to place an order with more decimal places than allowed will result in an error and the order will not be created. Click here to see the decimal limits.

    Returns

    An object with an array of order with the tempid, and id; and any errors associated with the orders placed.

    MoveOrders

    Response:

        {
            "success":true,
            "data":{
                "orderids":[],
                "errors":[]
            },
            "method":"Private/MoveOrders"
        }
    

    Updates the price of one or multiple open orders for the current user.

    POST https://api.chainrift.com/v1/Private/MoveOrders

    This method accepts a JSON array named orders with the following object:

    Parameter Required Type Description
    orderId yes string The order identifier.
    price yes decimal The new price* for the order.

    * There are decimal limits for the order quantity and price for each coin pair (symbol). Trying to place an order with more decimal places than allowed will result in an error and the order will not be created. Click here to see the decimal limits.

    CancelOrder

    Response:

    {
      "success":true,
      "data":"57a580b7-5292-4996-a4b6-ad8d68e90f40",
      "method":"Private/CancelOrder"
    }
    
    

    Cancels an order for the current user.

    POST https://api.chainrift.com/v1/Private/CancelOrder

    Parameter Required Type Description
    orderid Yes String The order identifier.
    Errors
    No orders with matching ID found on your account.
    You must provide order Id.

    CancelAllOrders

    Response:

    {
      "success":true,
      "data":"23 Orders removed",
      "method":"Private/CancelAllOrders"
    }
    
    

    If sent without parameters it will cancel ALL users orders for ALL coin pairs. An optional "symbol" parameter (e.g. XMR/BTC, ETH/BTC) can be passed to cancel all orders for the selected coin pair.

    POST https://api.chainrift.com/v1/Private/CancelAllOrders

    Parameter Required Type Description
    symbol No String The symbol for the coin pair (ex. BTC/USD) you wish to cancel orders for.
    orderids No Array The order IDs of the specific orders you wish to cancel.

    Returns

    Number of Orders cancelled.

    Errors
    No orders with matching Id found on your account.
    You must provide order Id.

    CreateWithdrawal

    Response:

    {
      "success":true,
      "data": "57a580b7-5292-4996-a4b6-ad8d68e90f40",
      "method":"Private/CreateWithdrawal"
    }
    

    Creates a withdrawal from a withdrawal address for the current user.

    POST https://api.chainrift.com/v1/Private/CreateWithdrawal

    Parameter Required Type Description
    coin yes string The coin name.
    quantity yes decimal The quantity you wish to withdraw. Please note that each coin has a decimal limitation. Trying to create a withdrawal request with more decimal places than allowed will result in an error and the withdrawal will not be created. Click here to see the decimal limits.
    address yes decimal The withdrawal address unless the coin is EUR,USD etc
    id no string This an optional parameter available for Monero(XMR) and Ripple(XRP) based coins. If this is a Monero(XMR) based address, then this represents the payment ID. If this is a Ripple(XRP) based address, then this represents the destination tag.

    Returns

    Ledger ID

    Errors
    Please Provide Coin for Withdrawal.
    Please Provide Withdrawal Quantity.
    Please Provide Withdrawal Address.
    The coin you provided is not supported.
    Please verify your previous transaction before requesting a new withdrawal.
    There is already a withdrawal pending email confirmation
    The entered amount is below the minimum withdrawal amount.
    have insufficient balance to proceed with this withdrawal.
    The Withdrawal Address does not exist.
    Withdrawals Disabled Due to Password Change (for 24hrs)
    Withdrawals Disabled Due to Username Change (for 24hrs)
    Withdrawals Disabled Due to Admin 2FA Disabling (for 24hrs)