{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"caacdab6-f42e-4545-ad79-cecf490827ee","name":"REST API","description":"BuyUcoin - A Multi crypto currency exchange and wallet service.\nThis documentation contains both Public APIs that do not require any authorisation. Authenticated APIs need authentication headers.\n\nBase Api Endpoint: <a href=\"https://api.buyucoin.com\" title=\"https://api.buyucoin.com\">https://api.buyucoin.com</a>\n\nBase WebSocket Endpoint: <a href=\"wss://ws.buyucoin.com\" title=\"wss://ws.buyucoin.com\">wss://ws.buyucoin.com</a>\n\nTo generate the API Keys and manage IP whitelisting or permissions for apis. Visit <a href=\"https://trade.buyucoin.com/account#apiview\" title=\"https://trade.buyucoin.com/account#apiview\">https://trade.buyucoin.com/account#apiview</a>\n\n<h4>Request Headers</h4>\n\n<table>\n    <tr>\n        <td><b>Parameter<b></td>\n        <td><b>Type<b></td>\n        <td><b>Required<b></td>\n        <td><b>Description<b></td>\n    </tr>\n    <tr>\n        <td>Content-Type</td>\n        <td>String</td>\n        <td>Mandatory</td>\n        <td>application/json</td>\n    </tr>\n    <tr>\n        <td>buc-nonce</td>\n        <td>String</td>\n        <td>Mandatory</td>\n        <td>This is an integer (not a float and not an alphabetical letter) which should be passed as a string value in the header.It should always be greater than the previously sent nonce. This is used to make sure that no two same consecutive requests are processed.</td>\n    </tr>\n    <tr>\n        <td>buc-apikey</td>\n        <td>String</td>\n        <td>Optional</td>\n        <td>Public api key provided by the platform to the merchant.</td>\n    </tr>\n    <tr>\n        <td>buc-signature</td>\n        <td>String</td>\n        <td>Mandatory</td>\n        <td>Signature is created by the secret key provided by the platform to the merchant. We use HMAC SHA-256 for creating signatures</td>\n    </tr>\n</table>\n\n<h4>Response Parameters</h4>\n\n<table>\n    <tr>\n        <td><b>Parameter<b></td>\n        <td><b>Type<b></td>\n        <td><b>Value<b></td>\n        <td><b>Description<b></td>\n    </tr>\n    <tr>\n        <td>Status</td>\n        <td>String</td>\n        <td>success; error</td>\n        <td>The status of the api requested</td>\n    </tr>\n    <tr>\n        <td>sub_status</td>\n        <td>String</td>\n        <td></td>\n        <td>Used for internal purposes only</td>\n        <td></td>\n    </tr>\n    <tr>\n        <td>data</td>\n        <td>Object</td>\n        <td></td>\n        <td>Contains the body of the action produced by the API</td>\n    </tr>\n</table>\n\n<h4>Signature Generation</h4>\n\nWe are generating signature using these three details, body of the post request, nonce passed in the header, secret Key of the merchant\n\n<ul>\n    <li>Add the nonce key as a string in the request body, sort the new body alphabetically and then covert the body Object into string.</li>\n    <li>Encode the received string with UTF-8</li>\n    <li>Use the new string to create a HMAC signature by SHA-256 algorithm. Use the secret key provided by the platform as the secret key for the HMAC algorithm.</li>\n    <li>The output after doing the above steps will be used as the signature in the header</li>\n</ul>\n\n<h6>NodeJs Example:</h6>\n<pre><code>\nfunction sortObject(object) {\n    var sortedObj = {},\n        keys = Object.keys(object);\n    keys.sort(function (key1, key2) {\n        key1 = key1.toLowerCase();\n        key2 = key2.toLowerCase();\n        if (key1 < key2) return -1;\n        if (key1 > key2) return 1;\n        return 0;\n    });\n    for (var index in keys) {\n        var key = keys[index];\n        if (typeof object[key] == 'object' && !(object[key] instanceof Array)) {\n            sortedObj[key] = sortObject(object[key]);\n        } else {\n            sortedObj[key] = object[key];\n        }\n    }\n    return sortedObj;\n}\n</code></pre>\n<pre><code>\nfunction sortObjectAndHash(object, secret, nonce) {\n    object[\"nonce\"] = nonce\n    const checksum = generateChecksum(JSON.stringify(sortObject(object)), secret)\n    delete object.nonce\n    return checksum\n}\n</code></pre>\n<pre><code>\nfunction generateChecksum(str, secret) {\n    return crypto.createHmac('sha256', secret).update(str, \"utf-8\").digest('hex')\n}\n</code></pre>\n<pre><code>\nvar createOrder = async function (market, type, qty, price, category) {\n    let headers = {}\n    let nonce = parseInt(Date.now().toString())\n    let payload = {\n        \"marketName\": market,\n        \"type\": type,\n        \"qty\": qty,\n        \"price\": price,\n        \"category\": category\n    }\n    headers['buc-nonce'] = nonce\n    headers['buc-apikey'] = apiKey\n    headers['buc-signature'] = sortObjectAndHash(payload, secretKey, nonce)\n    let resp = await postRequest(baseUrl + '/api/orders/v1.0/createUserOrder', payload, headers)\n    return resp\n\n}\n</pre></code>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"2739249","team":2007805,"collectionId":"caacdab6-f42e-4545-ad79-cecf490827ee","publishedId":"Szme5eNF","public":true,"publicUrl":"https://apidocs.buyucoin.com","privateUrl":"https://go.postman.co/documentation/2739249-caacdab6-f42e-4545-ad79-cecf490827ee","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"28ABE3"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.1","publishDate":"2021-06-09T08:17:03.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/e9f8b2e141ed854a3df42d023b960dbf8c318a6cc3cd91de602ea5eba389be34","favicon":"https://buyucoin.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://apidocs.buyucoin.com/view/metadata/Szme5eNF"}