├── README.md ├── samples └── python │ └── v3 │ ├── sample_place_bid.py │ ├── sample_get_my_open_order.py │ └── sample_get_order_info.py ├── websocket-api.md ├── restful-api-v4.md └── restful-api.md /README.md: -------------------------------------------------------------------------------- 1 | # bitkub-official-api-docs 2 | Official Documentation for Bitkub APIs 3 | 4 | * The documentation described here is official. This means the documentation is officially supported and maintained by Bitkub's own development team. 5 | * The use of any other projects is **not supported**; please make sure you are visiting **bitkub/bitkub-official-api-docs**. 6 | 7 | 8 | Name | Description 9 | ------------ | ------------ 10 | [restful-api.md](./restful-api.md) | Details on the RESTful API V3 (/api) 11 | [restful-api-v4.md](./restful-api-v4.md) | Details on the RESTful API V4 (/api) 12 | [websocket-api.md](./websocket-api.md) | Details on the Websocket API (/websocket-api) 13 | -------------------------------------------------------------------------------- /samples/python/v3/sample_place_bid.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import hmac 3 | import json 4 | import time 5 | import requests 6 | 7 | def gen_sign(api_secret, payload_string=None): 8 | return hmac.new(api_secret.encode('utf-8'), payload_string.encode('utf-8'), hashlib.sha256).hexdigest() 9 | 10 | if __name__ == '__main__': 11 | host = 'https://api.bitkub.com' 12 | path = '/api/v3/market/place-bid' 13 | api_key = 'your API key' 14 | api_secret = 'your API SECRET' 15 | 16 | ts = str(round(time.time() * 1000)) 17 | reqBody = { 18 | 'sym': 'btc_thb', # {quote}_{base} 19 | 'amt': 10, 20 | 'rat': 10, 21 | 'typ': 'limit' # limit, market 22 | } 23 | payload = [] 24 | payload.append(ts) 25 | payload.append('POST') 26 | payload.append(path) 27 | payload.append(json.dumps(reqBody)) 28 | 29 | sig = gen_sign(api_secret, ''.join(payload)) 30 | headers = { 31 | 'Accept': 'application/json', 32 | 'Content-Type': 'application/json', 33 | 'X-BTK-TIMESTAMP': ts, 34 | 'X-BTK-SIGN': sig, 35 | 'X-BTK-APIKEY': api_key 36 | } 37 | 38 | response = requests.request('POST', host + path, headers=headers, data=json.dumps(reqBody), verify=False) 39 | print(response.text) -------------------------------------------------------------------------------- /samples/python/v3/sample_get_my_open_order.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import hmac 3 | import json 4 | import time 5 | import requests 6 | 7 | def gen_sign(api_secret, payload_string=None): 8 | return hmac.new(api_secret.encode('utf-8'), payload_string.encode('utf-8'), hashlib.sha256).hexdigest() 9 | 10 | def gen_query_param(url, query_param): 11 | req = requests.PreparedRequest() 12 | req.prepare_url(url, query_param) 13 | return req.url.replace(url,"") 14 | 15 | if __name__ == '__main__': 16 | 17 | host = 'https://api.bitkub.com' 18 | path = '/api/v3/market/my-open-orders' 19 | api_key = 'your API key' 20 | api_secret = 'your API SECRET' 21 | 22 | ts = str(round(time.time() * 1000)) 23 | param = { 24 | 'sym':"btc_thb" 25 | } 26 | query_param = gen_query_param(host+path, param) 27 | 28 | payload = [] 29 | payload.append(ts) 30 | payload.append('GET') 31 | payload.append(path) 32 | payload.append(query_param) 33 | 34 | sig = gen_sign(api_secret, ''.join(payload)) 35 | headers = { 36 | 'Accept': 'application/json', 37 | 'Content-Type': 'application/json', 38 | 'X-BTK-TIMESTAMP': ts, 39 | 'X-BTK-SIGN': sig, 40 | 'X-BTK-APIKEY': api_key 41 | } 42 | 43 | response = requests.request('GET', f'{host}{path}{query_param}', headers=headers, data={}, verify=False) 44 | print(response.text) 45 | -------------------------------------------------------------------------------- /samples/python/v3/sample_get_order_info.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import hmac 3 | import json 4 | import time 5 | import requests 6 | 7 | def gen_sign(api_secret, payload_string=None): 8 | return hmac.new(api_secret.encode('utf-8'), payload_string.encode('utf-8'), hashlib.sha256).hexdigest() 9 | 10 | def gen_query_param(url, query_param): 11 | req = requests.PreparedRequest() 12 | req.prepare_url(url, query_param) 13 | return req.url.replace(url,"") 14 | 15 | if __name__ == '__main__': 16 | 17 | host = 'https://api.bitkub.com' 18 | path = '/api/v3/market/order-info' 19 | api_key = 'your API key' 20 | api_secret = 'your API SECRET' 21 | 22 | ts = str(round(time.time() * 1000)) 23 | param = { 24 | 'sym':"", # symbol in quote_base format: e.g. btc_thb 25 | 'id': "", # order id 26 | "sd": "", # side buy or sell 27 | # "hash":"", # order hash (optional) 28 | } 29 | query_param = gen_query_param(host+path, param) 30 | 31 | payload = [] 32 | payload.append(ts) 33 | payload.append('GET') 34 | payload.append(path) 35 | payload.append(query_param) 36 | 37 | sig = gen_sign(api_secret, ''.join(payload)) 38 | headers = { 39 | 'Accept': 'application/json', 40 | 'Content-Type': 'application/json', 41 | 'X-BTK-TIMESTAMP': ts, 42 | 'X-BTK-SIGN': sig, 43 | 'X-BTK-APIKEY': api_key 44 | } 45 | 46 | response = requests.request('GET', f'{host}{path}{query_param}', headers=headers, data={}, verify=False) 47 | print(response.text) 48 | -------------------------------------------------------------------------------- /websocket-api.md: -------------------------------------------------------------------------------- 1 | # Websocket API for Bitkub (2023-04-19) 2 | 3 | # Changelog 4 | * 2023-04-19 Changed the webSocket 5 | market.trade.symbol. Field ```bid, sid``` changed type from ```Integer to String```. 6 | * 2023-01-16 Update `Live Order Book`, added a new event info. 7 | * 2022-08-31 Deprecated the authentication to `Live Order Book` websocket. 8 | # Table of contents 9 | * [Websocket endpoint](#websocket-endpoint) 10 | * [Stream name](#stream-name) 11 | * [Symbols](#symbols) 12 | * [Websocket API documentation](#web-socket-api-documentation) 13 | * [Stream Demo](#stream-demo) 14 | * [Live Order Book](#live-order-book) 15 | 16 | # Websocket endpoint 17 | * The websocket endpoint is: **wss://api.bitkub.com/websocket-api/[\](#stream-name)** 18 | 19 | # Stream name 20 | Stream name requires 3 parts: **service name**, **service type**, and **symbol**, delimited by **dot (.)**, and is **case-insensitive**. 21 | 22 | #### Stream name format: 23 | ```javascript 24 | .. 25 | ``` 26 | 27 | #### Stream name example: 28 | ```javascript 29 | market.trade.thb_btc 30 | ``` 31 | Above example stream name provides real-time data from the **market** service, type **trade**, of symbol **THB_BTC**. 32 | 33 | 34 | 35 | ### Multiple streams subscription: 36 | You can combine multiple streams by using **comma (,)** as the delimeter. 37 | 38 | #### Multiple stream names format: 39 | ```javascript 40 | ,, 41 | ``` 42 | 43 | #### Multiple stream names example: 44 | ```javascript 45 | market.trade.thb_btc,market.ticker.thb_btc,market.trade.thb_eth,market.ticker.thb_eth 46 | ``` 47 | Above subscription provides real-time data from trade and ticker streams of symbols THB_BTC and THB_ETH. 48 | 49 | 50 | 51 | # Symbols 52 | Refer to [RESTful API](https://github.com/bitkub/bitkub-official-api-docs/blob/master/restful-api.md#get-apimarketsymbols) for all available symbols and symbol ids). 53 | 54 | 55 | 56 | # Websocket API documentation 57 | Refer to the following for description of each stream 58 | 59 | ### Trade stream 60 | ⚠️ After April 18th, 2023 at 18:00PM(GMT+7) 61 | 62 | * Response field ```bid, sid``` change type from ```Integer to String```. 63 | * Ref: [Announcement](#announcement) 64 | 65 | #### Name: 66 | market.trade.\ 67 | 68 | #### Description: 69 | The trade stream provides real-time data on matched orders. Each trade contains buy order id and sell order id. Order id is unique by the order side (buy/sell) and symbol. 70 | 71 | #### Response: 72 | ```javascript 73 | { 74 | "stream": "market.trade.thb_eth", // stream name 75 | "sym":"THB_ETH", // symbol 76 | "txn": "ETHSELL0000074282", // transaction id 77 | "rat": "5977.00", // rate matched 78 | "amt": 1.556539, // amount matched 79 | "bid": 2048451, // buy order id 80 | "sid": 2924729, // sell order id 81 | "ts": 1542268567 // trade timestamp 82 | } 83 | ``` 84 | 85 | ### Ticker stream 86 | #### Name: 87 | market.ticker.\ 88 | 89 | #### Description: 90 | The ticker stream provides real-time data on ticker of the specified symbol. Ticker for each symbol is re-calculated on trade order creation, cancellation, and fulfillment. 91 | 92 | #### Response: 93 | ```javascript 94 | { 95 | "stream": "market.ticker.thb_btc", 96 | "id": 1, 97 | "last": 2883194.85, 98 | "lowestAsk": 2883194.9, 99 | "lowestAskSize": 0.0070947, 100 | "highestBid": 2881000.31, 101 | "highestBidSize": 0.00470253, 102 | "change": 60622.33, 103 | "percentChange": 2.15, 104 | "baseVolume": 89.25334259, 105 | "quoteVolume": 256768588.16, 106 | "isFrozen": 0, 107 | "high24hr": 2916959.99, 108 | "low24hr": 2819009.05, 109 | "open": 2822572.52, 110 | "close": 2883194.85 111 | } 112 | ``` 113 | 114 | # Stream Demo 115 | The demo page is available [here](https://api.bitkub.com/websocket-api?streams=) for testing streams subscription. 116 | 117 | # Live Order Book 118 | #### Description: 119 | Use symbol id (numeric id) to get real-time data of order book: **wss://api.bitkub.com/websocket-api/orderbook/[\](#symbols)**. 120 | 121 | #### Message data: 122 | ```javascript 123 | { 124 | "data": (data), 125 | "event": (event type) 126 | } 127 | ``` 128 | There are 4 event types: **bidschanged**, **askschanged**, **tradeschanged**, and **global.ticker** 129 | * **bidschanged** occurs when any buy order has changed on the selected symbol (opened/closed/cancelled). Data is array of buy orders after the change (max. 30 orders). 130 | * **askschanged** occurs when any sell order has changed on the selected symbol (opened/closed/cancelled). Data is array of sell orders after the change (max. 30 orders). 131 | * **tradeschanged** occurs when buy and sell orders have been matched on the selected symbol. Data is array containing 3 arrays: array of latest trades, array of buy orders, and array of sell orders (each max. 30 orders). You get this event as the initial data upon successful subscription. 132 | * **ticker** occurs every time when either bidschanged, askschanged, or tradeschanged is fired on the selected symbol. 133 | * **global.ticker** occurs every time when either bidschanged, askschanged, or tradeschanged is fired on any symbol in the exchange. 134 | 135 | #### Example response (bidschanged or askschanged): 136 | ```javascript 137 | { 138 | "data":[ 139 | [ 140 | 121.82, // vol 141 | 112510.1, // rate 142 | 0.00108283, // amount 143 | 0, // reserved, always 0 144 | false, // is new order 145 | false // user is owner (deprecated) 146 | ] 147 | ], 148 | "event":"bidschanged", 149 | "pairing_id":1 150 | } 151 | ``` 152 | 153 | #### Example response (tradeschanged): 154 | ```javascript 155 | { 156 | "data":[ 157 | [ 158 | [ 159 | 1550320593, // timestamp 160 | 113587, // rate 161 | 0.12817027, // amount 162 | "BUY", // side 163 | 0, // reserved, always 0 164 | 0, // reserved, always 0 165 | true, // is new order 166 | false, // user is buyer (available when authenticated) 167 | false // user is seller (available when authenticated) 168 | ] 169 | ], 170 | [ 171 | [ 172 | 121.82, // vol 173 | 112510.1, // bid rate 174 | 0.00108283, // bid amount 175 | 0, // reserved, always 0 176 | false, // is new order 177 | false // user is owner (available when authenticated) 178 | ] 179 | ], 180 | [ 181 | [ 182 | 51247.13, // vol 183 | 113699, // ask rate 184 | 0.45072632, // ask amount 185 | 0, // reserved, always 0 186 | false, // is new order 187 | false // user is owner (available when authenticated) 188 | ] 189 | ] 190 | ], 191 | "event":"tradeschanged", 192 | "pairing_id":1 193 | } 194 | ``` 195 | 196 | #### Example response (ticker): 197 | ```javascript 198 | { 199 | "data":{ 200 | "baseVolume":106302.39237032, // amount of crypto 201 | "change":0.16, // difference of price compare to the latest 202 | "close":15.9, // close price 203 | "high24hr":16.72, // the highest bidding price taken in the last 24 hours 204 | "highestBid":15.81, // the highest bidding price 205 | "highestBidSize":5640.39911448, // the amount of the highest bidding order 206 | "id":139, // symbol id 207 | "isFrozen":0, // symbol trade status 208 | "last":15.9, // the latest price 209 | "low24hr":15.7, // the lowest price taken in the last 24 hours 210 | "lowestAsk":16.22, // the lowest asking price 211 | "lowestAskSize":1582, // the amount of the lowest asking order 212 | "open":15.74, // open price 213 | "percentChange":1.02, // difference of price compare to the latest in percent 214 | "quoteVolume":1715566.77, // amount of fiat 215 | "stream":"market.ticker.thb_1inch" // stream name 216 | }, 217 | "event":"global.ticker", // event name 218 | "pairing_id":1 219 | } 220 | ``` 221 | 222 | #### Example response (global.ticker): 223 | ```javascript 224 | { 225 | "data":{ 226 | "baseVolume":106302.39237032, // amount of crypto 227 | "change":0.16, // difference of price compare to the latest 228 | "close":15.9, // close price 229 | "high24hr":16.72, // the highest bidding price taken in the last 24 hours 230 | "highestBid":15.81, // the highest bidding price 231 | "highestBidSize":5640.39911448, // the amount of the highest bidding order 232 | "id":139, // symbol id 233 | "isFrozen":0, // symbol trade status 234 | "last":15.9, // the latest price 235 | "low24hr":15.7, // the lowest price taken in the last 24 hours 236 | "lowestAsk":16.22, // the lowest asking price 237 | "lowestAskSize":1582, // the amount of the lowest asking order 238 | "open":15.74, // open price 239 | "percentChange":1.02, // difference of price compare to the latest in percent 240 | "quoteVolume":1715566.77, // amount of fiat 241 | "stream":"market.ticker.thb_1inch" // stream name 242 | }, 243 | "event":"global.ticker" // event name 244 | } 245 | ``` 246 | -------------------------------------------------------------------------------- /restful-api-v4.md: -------------------------------------------------------------------------------- 1 | # RESTful API for Bitkub V4 (2025-12-03) 2 | 3 | # Announcement 4 | 5 | - Deposit history records are available for the last 90 days only for [GET /api/v4/crypto/deposits](#get-apiv4cryptodeposits). Records older than 90 days are archived. 6 | - Introducing the New Public API v4 for Crypto Endpoints 7 | 8 | # Change log 9 | 10 | - 2025-05-27 Added new Crypto endpoint [GET /api/v4/crypto/compensations](#get-apiv4cryptocompensations) and update api specification for [GET /api/v4/crypto/withdraws](#get-apiv4cryptowithdraws) and [GET /api/v4/crypto/deposits](#get-apiv4cryptodeposits) 11 | - 2025-04-08 Added new error codes: [B1016-CW] Deposit is frozen, [V1015-CW] Coin not found 12 | - 2025-04-03 Added new Crypto endpoint [GET /api/v4/crypto/coins](#get-apiv4cryptocoins) 13 | - 2025-02-03 Introducing Crypto V4 Endpoints 14 | 15 | # Table of contents 16 | 17 | - [Base URL](#base-url) 18 | - [Endpoint types](#endpoint-types) 19 | - [Constructing the request](#constructing-the-request) 20 | - [API documentation](#api-documentation) 21 | - [Error codes](#error-codes) 22 | - [Rate limits](#rate-limits) 23 | 24 | # Base URL 25 | 26 | - The base URL is: https://api.bitkub.com 27 | 28 | # Endpoint types 29 | 30 | ### Secure endpoints V4 31 | 32 | All secure endpoints require [authentication](#constructing-the-request). 33 | 34 | | Crypto V4 Endpoints | Method | Deposit | Withdraw | Trade | 35 | | ------------------------------------------------------------- | ------ | ------- | -------- | ----- | 36 | | [/api/v4/crypto/addresses](#get-apiv4cryptoaddresses) | GET | | | | 37 | | [/api/v4/crypto/addresses](#post-apiv4cryptoaddresses) | POST | ✅ | | | 38 | | [/api/v4/crypto/deposits](#get-apiv4cryptodeposits) | GET | | | | 39 | | [/api/v4/crypto/withdraws](#get-apiv4cryptowithdraws) | GET | | | | 40 | | [/api/v4/crypto/withdraws](#post-apiv4cryptowithdraws) | POST | | ✅ | | 41 | | [/api/v4/crypto/coins](#get-apiv4cryptocoins) | GET | | | | 42 | | [/api/v4/crypto/compensations](#get-apiv4cryptocompensations) | GET | | | | 43 | 44 | # Constructing the request 45 | 46 | ### GET/POST request 47 | 48 | - GET requests require parameters as **query string** in the URL (e.g. ?symbol=BTC&limit=10). 49 | - POST requests require JSON payload (application/json). 50 | 51 | ### Request headers (Secure Endpoints) 52 | 53 | Authentication requires API KEY and API SECRET. Every request to the server must contain the following in the request header: 54 | 55 | - Accept: application/json 56 | - Content-type: application/json 57 | - X-BTK-APIKEY: {YOUR API KEY} 58 | - X-BTK-TIMESTAMP: {Timestamp i.e. 1699376552354 } 59 | - X-BTK-SIGN: [Signature](#signature) 60 | 61 | ### Signature 62 | 63 | Generate the signature from the timestamp, the request method, API path, query parameter, and JSON payload using HMAC SHA-256. Use the API Secret as the secret key for generating the HMAC variant of JSON payload. The signature is in **hex** format. The user has to attach the signature via the Request Header 64 | You must get a new timestamp in millisecond from [/api/v3/servertime](restful-api.md#get-apiv3servertime). The old one is in second. 65 | 66 | #### Example string for signing a signature: 67 | 68 | ```javascript 69 | //Example for Get Method 70 | 1699381086593GET/api/v4/crypto/addresses?symbol=ATOM 71 | 72 | // Example for Post Method 73 | 1699376552354POST/api/v4/crypto/addresses{"symbol":"ATOM","network": "ATOM"} 74 | ``` 75 | 76 | #### Example cURL: 77 | 78 | ```javascript 79 | curl --location 'https://api.bitkub.com/api/v4/crypto/addresses?symbol=ATOM' \ 80 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 81 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 82 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 83 | ``` 84 | 85 | ```javascript 86 | curl --location 'https://api.bitkub.com/api/v4/crypto/addresses' \ 87 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 88 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 89 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' \ 90 | --header 'Content-Type: application/json' \ 91 | --data '{ 92 | "symbol": "ATOM", 93 | "network": "ATOM", 94 | }' 95 | ``` 96 | 97 | # API documentation 98 | 99 | Refer to the following for description of each endpoint 100 | 101 | ### GET /api/v4/crypto/addresses 102 | 103 | #### Description: 104 | 105 | List all crypto addresses (paginated). 106 | 107 | #### Path Params: - 108 | 109 | #### Query Params: 110 | 111 | | Key | Type | Required | Description | 112 | | ------- | ------ | -------- | -------------------------------- | 113 | | page | int | false | Page (default = 1) | 114 | | limit | int | false | Limit (default = 100, max = 200) | 115 | | symbol | String | false | e.g. ATOM | 116 | | network | String | false | e.g. ATOM | 117 | | memo | String | false | e.g. 107467228685 | 118 | 119 | #### Body Params: - 120 | 121 | #### Example cURL: 122 | 123 | ```javascript 124 | curl --location 'https://api.bitkub.com/api/v4/crypto/addresses?symbol=ATOM' \ 125 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 126 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 127 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 128 | ``` 129 | 130 | #### Response: 131 | 132 | ```javascript 133 | { 134 | "code": "0", 135 | "message": "success", 136 | "data": { 137 | "page": 1, 138 | "total_page": 1, 139 | "total_item": 2, 140 | "items": [ 141 | { 142 | "symbol": "ATOM", 143 | "network": "ATOM", 144 | "address": "cosmos1jcslcmz2lpsy7uq5u2ktn459qce2chqapey7gh", 145 | "memo": "107467228685", 146 | "created_at": "2022-03-18T05:41:40.199Z" 147 | }, 148 | { 149 | "symbol": "ATOM", 150 | "network": "ATOM", 151 | "address": "cosmos1jcslcmz2lpsy7uq5u2ktn459qce2chqapey7gh", 152 | "memo": "104010164476", 153 | "created_at": "2022-03-18T05:46:34.113Z" 154 | } 155 | ] 156 | } 157 | } 158 | ``` 159 | 160 | ### POST /api/v4/crypto/addresses 161 | 162 | #### Description: 163 | 164 | Generate a new crypto address (if an address exists; will return the existing address). 165 | 166 | #### Required Permission: `is_deposit` 167 | 168 | #### Path Params: - 169 | 170 | #### Query Params: - 171 | 172 | #### Body Params: 173 | 174 | | Key | Type | Required | Description | 175 | | ------- | ------ | -------- | ----------- | 176 | | symbol | String | true | e.g. ATOM | 177 | | network | String | true | e.g. ATOM | 178 | 179 | #### Example cURL: 180 | 181 | ```javascript 182 | curl --location 'https://api.bitkub.com/api/v4/crypto/addresses' \ 183 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 184 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 185 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' \ 186 | --header 'Content-Type: application/json' \ 187 | --data '{ 188 | "symbol": "ETH", 189 | "network": "ETH", 190 | }' 191 | ``` 192 | 193 | #### Response: 194 | 195 | ```javascript 196 | { 197 | "code": "0", 198 | "message": "success", 199 | "data": [ 200 | { 201 | "symbol": "ETH", 202 | "network": "ETH", 203 | "address": "0x520165471daa570ab632dd504c6af257bd36edfb", 204 | "memo": "" 205 | } 206 | ] 207 | } 208 | ``` 209 | 210 | ### GET /api/v4/crypto/deposits 211 | 212 | #### Description: 213 | 214 | List crypto deposit history. 215 | 216 | #### Note: Only deposit records within the last 90 days will be returned. 217 | 218 | #### Path Params: - 219 | 220 | #### Query Params: 221 | 222 | | Key | Type | Required | Description | 223 | | ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 224 | | page | int | false | Page (default = 1) | 225 | | limit | int | false | Limit (default = 100, max = 200) | 226 | | symbol | String | false | Coin Symbol (e.g. BTC, ETH) | 227 | | status | String | false | Transaction Deposit Status (pending, rejected, complete) | 228 | | created_start | String | false | The start of the time range for the transaction creation timestamp. Only transactions created on or after this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 229 | | created_end | String | false | The end of the time range for the transaction creation timestamp. Only transactions created on or before this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 230 | 231 | #### Body Params: - 232 | 233 | #### Example cURL: 234 | 235 | ```javascript 236 | curl --location 'https://api.bitkub.com/api/v4/crypto/deposits?limit=10' \ 237 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 238 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 239 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 240 | ``` 241 | 242 | #### Response: 243 | 244 | ```javascript 245 | { 246 | "code": "0", 247 | "message": "success", 248 | "data": { 249 | "page": 1, 250 | "total_page": 1, 251 | "total_item": 1, 252 | "items": [ 253 | { 254 | "hash": "XRPWD0000100276", 255 | "symbol": "XRP", 256 | "network": "XRP", 257 | "amount": "5.75111474", 258 | "from_address": "0xDaCd17d1E77604aaFB6e47F5Ffa1F7E35F83fDa7", 259 | "to_address": "0x2b0849d47a90e3c4784a5b1130a14305a099d828", 260 | "confirmations": 1, 261 | "status": "complete", 262 | "created_at": "2022-03-18T05:41:40.199Z", 263 | "completed_at": "2022-03-18T05:45:50.199Z" 264 | } 265 | ] 266 | } 267 | } 268 | ``` 269 | 270 | ### GET /api/v4/crypto/withdraws 271 | 272 | #### Description: 273 | 274 | List crypto withdrawal history. 275 | 276 | #### Path Params: - 277 | 278 | #### Query Params: 279 | 280 | | Key | Type | Required | Description | 281 | | ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 282 | | page | int | false | Page (default = 1) | 283 | | limit | int | false | Limit (default = 100, max = 200) | 284 | | symbol | String | false | Coin Symbol (e.g. BTC, ETH) | 285 | | status | String | false | Transaction Withdraw Status (pending, processing, reported, rejected, complete) | 286 | | created_start | String | false | The start of the time range for the transaction creation timestamp. Only transactions created on or after this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 287 | | created_end | String | false | The end of the time range for the transaction creation timestamp. Only transactions created on or before this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 288 | 289 | #### Body Params: - 290 | 291 | #### Example cURL: 292 | 293 | ```javascript 294 | curl --location 'https://api.bitkub.com/api/v4/crypto/withdraws?limit=10' \ 295 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 296 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 297 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 298 | ``` 299 | 300 | #### Response: 301 | 302 | ```javascript 303 | { 304 | "code": "0", 305 | "message": "success", 306 | "data": { 307 | "page": 1, 308 | "total_page": 1, 309 | "total_item": 2, 310 | "items": [ 311 | { 312 | "txn_id": "RDNTWD0000804050", 313 | "external_ref": "XX_1111111111", 314 | "hash": null, 315 | "symbol": "RDNT", 316 | "network": "ARB", 317 | "amount": "2.00000000", 318 | "fee": "4.36", 319 | "address": "0xDaCd17d1E77604aaFB6e47F5Ffa1F7E35F83fDa7", 320 | "memo": "", 321 | "status": "processing", 322 | "created_at": "2024-09-01T10:02:43.211Z", 323 | "completed_at": "2024-09-01T10:02:45.031Z" 324 | }, 325 | { 326 | "txn_id": "BTCWD1321312683", 327 | "external_ref": "XX_1111111112", 328 | "hash": "0x8891b79c79f0842c9a654db47745fe0291fba222b290d22cabc93f8ae4490303", 329 | "symbol": "BTC", 330 | "network": "BTC", 331 | "amount": "0.10000000", 332 | "fee": "0.0025", 333 | "address": "0xDaCd17d1E77604aaFB6e47F5Ffa1F7E35F83fDa7", 334 | "memo": "", 335 | "status": "complete", 336 | "created_at": "2024-09-01T10:02:43.211Z", 337 | "completed_at": "2024-09-01T10:02:45.031Z" 338 | } 339 | ] 340 | } 341 | } 342 | ``` 343 | 344 | ### POST /api/v4/crypto/withdraws 345 | 346 | #### Description: 347 | 348 | Make a withdrawal to a trusted address. 349 | 350 | #### Required Permission: `is_withdraw` 351 | 352 | #### Path Params: - 353 | 354 | #### Query Params: - 355 | 356 | #### Body Params: 357 | 358 | | Key | Type | Required | Description | 359 | | ------- | ------ | -------- | ------------------------------------- | 360 | | symbol | String | true | Symbol for withdrawal (e.g. BTC, ETH) | 361 | | amount | String | true | Amount to withdraw | 362 | | address | String | true | Address to withdraw | 363 | | memo | String | false | Memo or destination tag to withdraw | 364 | | network | String | true | Network to withdraw | 365 | 366 | #### Example cURL: 367 | 368 | ```javascript 369 | curl --location 'https://api.bitkub.com/api/v4/crypto/withdraws' \ 370 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 371 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 372 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' \ 373 | --header 'Content-Type: application/json' \ 374 | --data '{ 375 | "symbol": "RDNT", 376 | "amount": "2.00000000", 377 | "address": "0xDaCd17d1E77604aaFB6e47F5Ffa1F7E35F83fDa7", 378 | "network": "ARB" 379 | }' 380 | ``` 381 | 382 | #### Response: 383 | 384 | ```javascript 385 | { 386 | "code": "0", 387 | "message": "success", 388 | "data": { 389 | "txn_id": "RDNTWD0000804050", 390 | "symbol": "RDNT", 391 | "network": "ARB", 392 | "amount": "2.00000000", 393 | "fee": "4.36", 394 | "address": "0xDaCd17d1E77604aaFB6e47F5Ffa1F7E35F83fDa7", 395 | "memo": "", 396 | "created_at": "2024-09-01T10:02:43.211Z" 397 | } 398 | } 399 | ``` 400 | 401 | ### GET /api/v4/crypto/coins 402 | 403 | #### Description: 404 | 405 | Get all coins (available for deposit and withdraw). 406 | 407 | #### Path Params: - 408 | 409 | #### Query Params: 410 | 411 | | Key | Type | Required | Description | 412 | | ------- | ------ | -------- | --------------------------- | 413 | | symbol | String | false | Coin Symbol (e.g. BTC, ETH) | 414 | | network | String | false | Network | 415 | 416 | #### Body Params: - 417 | 418 | #### Example cURL: 419 | 420 | ```javascript 421 | curl --location 'https://api.bitkub.com/api/v4/crypto/coin?symbol=ATOM' \ 422 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 423 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 424 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 425 | ``` 426 | 427 | #### Response: 428 | 429 | ```javascript 430 | { 431 | "code": "0", 432 | "message": "success", 433 | "data": { 434 | "items":[ 435 | { 436 | "name": "Bitcoin", 437 | "symbol": "BTC", 438 | "networks": [ 439 | { 440 | "name": "Bitcoin", 441 | "network": "BTC", 442 | "address_regex": "^[13][a-km-zA-HJ-NP-Z1-9]{26,35}$|^(tb1)[0-9A-Za-z]{39,59}$", 443 | "memo_regex": "", 444 | "explorer": "https://www.blockchain.com/btc/tx/", 445 | "contract_address": "", 446 | "withdraw_min": "0.0002", 447 | "withdraw_fee": "0.0001", 448 | "withdraw_internal_min": "", 449 | "withdraw_internal_fee": "", 450 | "withdraw_decimal_places": 8, 451 | "min_confirm": 3, 452 | "decimal": 8, 453 | "deposit_enable": true, 454 | "withdraw_enable": true, 455 | "is_memo": false 456 | } 457 | ], 458 | "deposit_enable": true, 459 | "withdraw_enable": true 460 | } 461 | ] 462 | } 463 | } 464 | ``` 465 | 466 | ### GET /api/v4/crypto/compensations 467 | 468 | #### Description: 469 | 470 | List crypto compensations history. 471 | 472 | #### Path Params: - 473 | 474 | #### Query Params: 475 | 476 | | Key | Type | Required | Description | 477 | | ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 478 | | page | int | false | Page (default = 1) | 479 | | limit | int | false | Limit (default = 100, max = 200) | 480 | | symbol | String | false | Coin Symbol (e.g. BTC, ETH) | 481 | | type | String | false | Compensation Type (COMPENSATE,DECOMPENSATE) | 482 | | status | String | false | Transaction Compensation Status (complete) | 483 | | created_start | String | false | The start of the time range for the transaction creation timestamp. Only transactions created on or after this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 484 | | created_end | String | false | The end of the time range for the transaction creation timestamp. Only transactions created on or before this timestamp will be included. (e.g. 2025-01-11T10:00:00.000Z) | 485 | 486 | #### Body Params: - 487 | 488 | #### Example cURL: 489 | 490 | ```javascript 491 | curl --location 'https://api.bitkub.com/api/v4/crypto/compensations?symbol=ATOM' \ 492 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 493 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 494 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 495 | ``` 496 | 497 | #### Response: 498 | 499 | ```javascript 500 | { 501 | "code": "0", 502 | "message": "Success", 503 | "data": { 504 | "page": 1, 505 | "total_page": 1, 506 | "total_item": 2, 507 | "items": [ 508 | { 509 | "txn_id": "XRPCP0000001234", 510 | "symbol": "XRP", 511 | "type": "DECOMPENSATE", 512 | "amount": "-1", 513 | "status": "complete", 514 | "created_at": "2024-02-09T12:00:00Z", 515 | "completed_at": "2024-02-09T13:00:00Z", 516 | "user_id": "1234" 517 | }, 518 | { 519 | "txn_id": "BLUECP0000001234", 520 | "symbol": "BLUE", 521 | "type": "COMPENSATE", 522 | "amount": "20", 523 | "status": "complete", 524 | "created_at": "2025-04-09T18:30:04Z", 525 | "completed_at": "2025-04-09T18:30:04Z", 526 | "user_id": "1234" 527 | } 528 | ] 529 | } 530 | } 531 | ``` 532 | 533 | ## Additional 534 | 535 | For the use of coins and networks, please use coin or network symbol for any APIs request. Please be cautious of these cryptocurrency when you specified on the request.\ 536 | \ 537 | Please refer to the link below for the available coins and networks.\ 538 | https://www.bitkub.com/fee/cryptocurrency \ 539 | \ 540 | Note the following exceptions for the coin and network: 541 | 542 | | Currency / Network | Symbol | 543 | | ------------------- | ------- | 544 | | Terra Classic(LUNC) | `LUNA` | 545 | | Terra 2.0 (LUNA) | `LUNA2` | 546 | 547 | # Error codes 548 | 549 | The following is the JSON payload for the Response Error: 550 | 551 | ```javascript 552 | { 553 | "code": "V1007-CW", 554 | "message": "Symbol not found", 555 | "data": {} 556 | } 557 | ``` 558 | 559 | ## Status Codes 560 | 561 | #### 200 (OK) 562 | 563 | The request was processed as expected. 564 | 565 | #### 400 (INVALID_REQUEST) 566 | 567 | The request is not well-formed, violates schema, or has incorrect fields. 568 | 569 | #### 401 (NOT_AUTHORIZED) 570 | 571 | The API key doesn't match the signature or have the necessary permissions to perform the request. 572 | 573 | #### 403 (FORBIDDEN) 574 | 575 | The API key doesn't have the necessary permissions to complete the request. 576 | 577 | #### 404 (NOT_FOUND) 578 | 579 | The requested resource doesn't exist. 580 | 581 | #### 5XX 582 | 583 | Internal Server Error. 584 | 585 | | Code | Status | Message | 586 | | -------- | ------ | ---------------------- | 587 | | S1000-CW | 500 | Internal service error | 588 | 589 | ### Business Error 590 | 591 | | Code | Status | Message | 592 | | -------- | ------ | ------------------------------ | 593 | | B1000-CW | 400 | User account is suspended | 594 | | B1001-CW | 400 | Network is disabled | 595 | | B1002-CW | 400 | CWS Wallet not found | 596 | | B1003-CW | 400 | Insufficient balance | 597 | | B1004-CW | 400 | User mismatch condition | 598 | | B1005-CW | 400 | Duplicate key | 599 | | B1006-CW | 400 | Airdrop already transfer | 600 | | B1007-CW | 400 | Symbol required | 601 | | B1008-CW | 400 | Event Symbol mismatched | 602 | | B1009-CW | 400 | Pending withdrawal exists | 603 | | B1010-CW | 400 | User account is frozen | 604 | | B1011-CW | 400 | Withdrawal exceeds daily limit | 605 | | B1012-CW | 400 | Address is not trusted | 606 | | B1013-CW | 400 | Withdrawal is frozen | 607 | | B1014-CW | 400 | Address is not whitelisted | 608 | | B1015-CW | 400 | Request is processing | 609 | | B1016-CW | 400 | Deposit is frozen | 610 | 611 | ### Validation Error 612 | 613 | | Code | Status | Message | 614 | | -------- | ------ | ----------------------------------------- | 615 | | V1000-CW | 404 | User not found | 616 | | V1001-CW | 404 | Asset not found | 617 | | V1002-CW | 404 | Event not found | 618 | | V1003-CW | 400 | Invalid signature | 619 | | V1004-CW | 401 | Signature has expired | 620 | | V1005-CW | 404 | Transaction not found | 621 | | V1006-CW | 400 | Invalid parameter | 622 | | V1007-CW | 404 | Symbol not found | 623 | | V1008-CW | 400 | Address not yet generated for this symbol | 624 | | V1009-CW | 404 | Memo not found for this address | 625 | | V1010-CW | 404 | Address not found | 626 | | V1011-CW | 400 | Address already exists | 627 | | V1012-CW | 400 | Destination address not active | 628 | | V1015-CW | 404 | Coin not found | 629 | 630 | ### Authentication Error 631 | 632 | | Code | Status | Message | 633 | | -------- | ------ | ------------------- | 634 | | A1000-CW | 401 | Unauthorized Access | 635 | | A1001-CW | 403 | Permission denied | 636 | 637 | # Rate limits 638 | 639 | If the request rate exceeds the limit in any endpoints, the request will be blocked for 30 seconds. When blocked, HTTP response is 429 Too Many Requests. The limits apply to individual user accessing the API. **_The rate limit is applied to each endpoint regardless the API version._** 640 | 641 | | Endpoint | Rate Limit | 642 | | ----------------- | ----------------- | 643 | | /api/v4/crypto/\* | 250 req / 10 secs | 644 | -------------------------------------------------------------------------------- /restful-api.md: -------------------------------------------------------------------------------- 1 | 2 | # RESTful API for Bitkub (2025-10-10) 3 | 4 | # Announcement 5 | * The following market endpoints will be deprecated on 9 Dec 2025. Please use [v3 endpoints](#non-secure-endpoints-v3) as replacement: [GET /api/market/symbols](#get-apimarketsymbols), [GET /api/market/ticker](#get-apimarketticker), [GET /api/market/trades](#get-apimarkettrades), [GET /api/market/bids](#get-apimarketbids), [GET /api/market/asks](#get-apimarketasks), [GET /api/market/books](#get-apimarketbooks), [GET /api/market/depth](#get-apimarketdepth) 6 | * Page-based pagination will be deprecated on 8 Sep 2025 for [my-order-history](#get-apiv3marketmy-order-history). 7 | * Order history older than 90 days is archived for [my-order-history] (#get-apiv3marketmy-order-history) More details here. 8 | * order_id and txn_id formats of [my-open-orders](#get-apiv3marketmy-open-orders), [my-order-history](#get-apiv3marketmy-order-history), [my-order-info](#get-apiv3marketorder-info), [place-bid](#post-apiv3marketplace-bid), [place-ask](#post-apiv3marketplace-ask), [cancel-order](#post-apiv3marketcancel-order) may change for some symbols due to a system upgrade, See affected symbols and detail : [here](https://support.bitkub.com/en/support/solutions/articles/151000214886-announcement-trading-system-upgrade) 9 | * API Specifications for Crypto Endpoints, please refer to the documentation here: [Crypto Endpoints](restful-api-v4.md) 10 | * Deprecation of Order Hash for [my-open-orders](#get-apiv3marketmy-open-orders), [my-order-history](#get-apiv3marketmy-order-history), [my-order-info](#get-apiv3marketorder-info), [place-bid](#post-apiv3marketplace-bid), [place-ask](#post-apiv3marketplace-ask), [cancel-order](#post-apiv3marketcancel-order) on 28/02/2025 onwards, More details [here](https://support.bitkub.com/en/support/solutions/articles/151000205895-notice-deprecation-of-order-hash-from-public-api-on-28-02-2025-onwards) 11 | 12 | # Change log 13 | * 2025-09-08 Update API [my-order-history](#get-apiv3marketmy-order-history) spec 14 | * 2025-01-07 Update FIAT Withdraw error code 15 | * 2025-04-03 Deprecated Crypto Endpoint v3 and Remove from the Document. 16 | * 2024-12-20 Introducing the Enhanced Market Data Endpoint [Ticker, Depth, Bids, Asks, Trades](#non-secure-endpoints-v3) 17 | * 2024-07-25 Deprecated Secure Endpoint V1/V2 and Remove from the Document. 18 | * 2024-07-05 Update rate-limits of place-bid, place-ask, cancel-order, my-open-orders [Rate-Limits](#rate-limits) 19 | * 2024-07-05 Update rate-limits which will be apply on 17 July 2024 [Rate-Limits](#rate-limits) 20 | * 2024-06-11 Updated API request of [POST /api/v3/crypto/internal-withdraw](#post-apiv3cryptointernal-withdraw) and edited API response of [POST /api/v3/crypto/withdraw-history](#post-apiv3cryptowithdraw-history) 21 | * 2024-06-11 Added new error code 58 - Transaction Not Found 22 | * 2024-05-16 Release: Post-Only Functionality Added to [POST /api/v3/market/place-bid](#post-apiv3marketplace-bid) and [POST /api/v3/market/place-ask](#post-apiv3marketplace-ask) 23 | * 2024-03-06 Edited Request field for [POST /api/v3/crypto/withdraw](#post-apiv3cryptowithdraw) 24 | * 2024-02-15 Edited Endpoint permission [Permission Table](#secure-endpoints-v3) 25 | 26 | 27 | # Table of contents 28 | * [Base URL](#base-url) 29 | * [Endpoint types](#endpoint-types) 30 | * [Constructing the request](#constructing-the-request) 31 | * [API documentation](#api-documentation) 32 | * [Error codes](#error-codes) 33 | * [Rate limits](#rate-limits) 34 | 35 | 36 | # Base URL 37 | * The base URL is: https://api.bitkub.com 38 | 39 | # Endpoint types 40 | ### Non-secure endpoints 41 | Our existing endpoints remain available for use. However, for enhanced security and performance, we strongly recommend utilizing the new [Non-Secure Endpoint V3](#non-secure-endpoints-v3). 42 | * [GET /api/status](#get-apistatus) 43 | * [GET /api/servertime](#get-apiservertime) 44 | * [GET /tradingview/history](#get-tradingviewhistory) 45 | * [GET /api/v3/servertime](#get-apiv3servertime) 46 | 47 | ### Non-secure endpoints V3 48 | | Market Data Endpoint | Method | 49 | | --------------------------------------------------------------| ------ | 50 | | [GET /api/v3/market/symbols](#get-apiv3marketsymbols) | GET | 51 | | [GET /api/v3/market/ticker](#get-apiv3marketticker) | GET | 52 | | [GET /api/v3/market/bids](#get-apiv3marketbids) | GET | 53 | | [GET /api/v3/market/asks](#get-apiv3marketasks) | GET | 54 | | [GET /api/v3/market/depth](#get-apiv3marketdepth) | GET | 55 | | [GET /api/v3/market/trades](#get-apiv3markettrades) | GET | 56 | 57 | | Exchange Information Endpoint | Method | 58 | | --------------------------------------------------------------| ------ | 59 | | [GET /api/v3/servertime](#get-apiv3servertime) | GET | 60 | 61 | 62 | ### Secure endpoints V3 63 | All secure endpoints require [authentication](#constructing-the-request). 64 | 65 | | User Endpoint | Method | Trade | Deposit | Withdraw | 66 | | ------------------------------------------------------------------------- | ------ | ----- | ------- | -------- | 67 | | [/api/v3/user/trading-credits](#post-apiv3usertrading-credits) | POST | | | | 68 | | [/api/v3/user/limits](#post-apiv3userlimits) | POST | | | | 69 | | [/api/v3/user/coin-convert-history](#get-apiv3usercoin-convert-history) | GET | | | | 70 | 71 | | Trading Endpoint | Method | Trade | Deposit | Withdraw | 72 | | ------------------------------------------------------------------- | ------ | ----- | ------- | -------- | 73 | | [/api/v3/market/wallet](#post-apiv3marketwallet) | POST | | | | 74 | | [/api/v3/market/balances](#post-apiv3marketbalances) | POST | | | | 75 | | [/api/v3/market/place-bid](#post-apiv3marketplace-bid) | POST | ✅ | | | 76 | | [/api/v3/market/place-ask](#post-apiv3marketplace-ask) | POST | ✅ | | | 77 | | [/api/v3/market/cancel-order](#post-apiv3marketcancel-order) | POST | ✅ | | | 78 | | [/api/v3/market/wstoken](#post-apiv3marketwstoken) | POST | ✅ | | | 79 | | [/api/v3/market/my-open-orders](#get-apiv3marketmy-open-orders) | GET | | | | 80 | | [/api/v3/market/my-order-history](#get-apiv3marketmy-order-history) | GET | | | | 81 | | [/api/v3/market/order-info](#get-apiv3marketorder-info) | GET | | | | 82 | 83 | | Fiat Endpoint | Method | Trade | Deposit | Withdraw | 84 | | ---------------------------------------------------------------- | ------ | ----- | ------- | -------- | 85 | | [/api/v3/fiat/accounts](#post-apiv3fiataccounts) | POST | | | ✅ | 86 | | [/api/v3/fiat/withdraw](#post-apiv3fiatwithdraw) | POST | | | | 87 | | [/api/v3/fiat/deposit-history](#post-apiv3fiatdeposit-history) | POST | | | | 88 | | [/api/v3/fiat/withdraw-history](#post-apiv3fiatwithdraw-history) | POST | | | | 89 | 90 | # Constructing the request 91 | ### GET/POST request 92 | * GET requests require parameters as **query string** in the URL (e.g. ?sym=THB_BTC&lmt=10). 93 | * POST requests require JSON payload (application/json). 94 | 95 | ### Request headers (Secure Endpoints) 96 | Authentication requires API KEY and API SECRET. Every request to the server must contain the following in the request header: 97 | * Accept: application/json 98 | * Content-type: application/json 99 | * X-BTK-APIKEY: {YOUR API KEY} 100 | * X-BTK-TIMESTAMP: {Timestamp i.e. 1699376552354 } 101 | * X-BTK-SIGN: [Signature](#signature) 102 | 103 | ### Payload (POST) 104 | The payload is always JSON. 105 | 106 | ### Signature 107 | Generate the signature from the timestamp, the request method, API path, query parameter, and JSON payload using HMAC SHA-256. Use the API Secret as the secret key for generating the HMAC variant of JSON payload. The signature is in **hex** format. The user has to attach the signature via the Request Header 108 | You must get a new timestamp in millisecond from [/api/v3/servertime](#get-apiv3servertime). The old one is in second. 109 | 110 | #### Example string for signing a signature: 111 | ```javascript 112 | //Example for Get Method 113 | 1699381086593GET/api/v3/market/my-order-history?sym=BTC_THB 114 | 115 | // Example for Post Method 116 | 1699376552354POST/api/v3/market/place-bid{"sym":"thb_btc","amt": 1000,"rat": 10,"typ": "limit"} 117 | ``` 118 | 119 | #### Example cURL: 120 | ```javascript 121 | curl --location 'https://api.bitkub.com/api/v3/market/place-bid' \ 122 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 123 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 124 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' \ 125 | --header 'Content-Type: application/json' \ 126 | --data '{ 127 | "sym": "thb_btc", 128 | "amt": 1000, 129 | "rat": 10, 130 | "typ": "limit", 131 | }' 132 | ``` 133 | ```javascript 134 | curl --location 'https://api.bitkub.com/api/v3/market/my-open-orders?sym=BTC_THB' \ 135 | --header 'X-BTK-TIMESTAMP: 1699381086593' \ 136 | --header 'X-BTK-APIKEY: e286825bda3497ae2d03aa3a30c420d603060cb4edbdd3ec711910c86966e9ba' \ 137 | --header 'X-BTK-SIGN: f5884963865a6e868ddbd58c9fb9ea4bd013076e8a8fa51d38b86c38d707cb8a' 138 | 139 | ``` 140 | 141 | # API documentation 142 | Refer to the following for description of each endpoint 143 | 144 | ### GET /api/status 145 | 146 | #### Description: 147 | Get endpoint status. When status is not `ok`, it is highly recommended to wait until the status changes back to `ok`. 148 | 149 | #### Query: 150 | - n/a 151 | 152 | #### Response: 153 | ```javascript 154 | [ 155 | { 156 | "name": "Non-secure endpoints", 157 | "status": "ok", 158 | "message": "" 159 | }, 160 | { 161 | "name": "Secure endpoints", 162 | "status": "ok", 163 | "message": "" 164 | } 165 | ] 166 | ``` 167 | 168 | ### GET /api/servertime 169 | 170 | #### Description: 171 | Get server timestamp. This can't use with secure endpoint V3. Please use [/api/v3/servertime](#get-apiv3servertime). 172 | 173 | #### Query: 174 | - n/a 175 | 176 | #### Response: 177 | ```javascript 178 | 1707220534359 179 | ``` 180 | 181 | ### GET /api/v3/servertime 182 | 183 | #### Description: 184 | Get server timestamp. 185 | 186 | #### Query: 187 | - n/a 188 | 189 | #### Response: 190 | ```javascript 191 | 1701251212273 192 | ``` 193 | 194 | ### GET /api/v3/market/symbols 195 | 196 | #### Description: 197 | List all available symbols. 198 | 199 | #### Query: 200 | - n/a 201 | 202 | #### Response: 203 | ```javascript 204 | { 205 | "error": 0, 206 | "result": [ 207 | { 208 | "base_asset": "BTC", 209 | "base_asset_scale": 8, 210 | "buy_price_gap_as_percent": 20, 211 | "created_at": "2017-10-30T22:16:10+07:00", 212 | "description": "Thai Baht to Bitcoin", 213 | "freeze_buy": false, 214 | "freeze_cancel": false, 215 | "freeze_sell": false, 216 | "market_segment": "SPOT", 217 | "min_quote_size": 10, 218 | "modified_at": "2025-05-20T16:48:04.599+07:00", 219 | "name": "Bitcoin", 220 | "pairing_id": 1, 221 | "price_scale": 2, 222 | "price_step": "0.01", 223 | "quantity_scale": 0, 224 | "quantity_step": "1", 225 | "quote_asset": "THB", 226 | "quote_asset_scale": 2, 227 | "sell_price_gap_as_percent": 20, 228 | "status": "active", 229 | "symbol": "BTC_THB", 230 | "source": "exchange" 231 | } 232 | ] 233 | } 234 | ``` 235 | 236 | ### GET /tradingview/history 237 | #### Description: 238 | Get historical data for TradingView chart. 239 | 240 | #### Query: 241 | * `symbol` **string** The symbol (e.g. BTC_THB) 242 | * `resolution` **string** Chart resolution (1, 5, 15, 60, 240, 1D) 243 | * `from` **int** Timestamp of the starting time (e.g. 1633424427) 244 | * `to` **int** Timestamp of the ending time (e.g. 1633427427) 245 | 246 | #### Response: 247 | ```javascript 248 | { 249 | "c": [ 250 | 1685000, 251 | 1680699.95, 252 | 1688998.99, 253 | 1692222.22 254 | ], 255 | "h": [ 256 | 1685000, 257 | 1685000, 258 | 1689000, 259 | 1692222.22 260 | ], 261 | "l": [ 262 | 1680053.22, 263 | 1671000, 264 | 1680000, 265 | 1684995.07 266 | ], 267 | "o": [ 268 | 1682500, 269 | 1685000, 270 | 1680100, 271 | 1684995.07 272 | ], 273 | "s": "ok", 274 | "t": [ 275 | 1633424400, 276 | 1633425300, 277 | 1633426200, 278 | 1633427100 279 | ], 280 | "v": [ 281 | 4.604352630000001, 282 | 8.530631670000005, 283 | 4.836581560000002, 284 | 2.8510189200000022 285 | ] 286 | } 287 | ``` 288 | 289 | ## Market Data Endpoint 290 | 291 | ### GET /api/v3/market/ticker 292 | 293 | ### Description: 294 | Get ticker information. 295 | 296 | ### Query (URL): 297 | * `sym` **string** The symbol (e.g. btc_thb) 298 | 299 | ### Response: 300 | ```javascript 301 | [ 302 | { 303 | "symbol": "ADA_THB", 304 | "base_volume": "1875227.0489781", 305 | "high_24_hr": "38", 306 | "highest_bid": "37.33", 307 | "last": "37.36", 308 | "low_24_hr": "35.76", 309 | "lowest_ask": "37.39", 310 | "percent_change": "2.69", 311 | "quote_volume": "69080877.73" 312 | }, 313 | { 314 | "symbol": "CRV_THB", 315 | "base_volume": "1811348.93318162", 316 | "high_24_hr": "39", 317 | "highest_bid": "38.4", 318 | "last": "38.42", 319 | "low_24_hr": "35.51", 320 | "lowest_ask": "38.42", 321 | "percent_change": "4.52", 322 | "quote_volume": "67340316.65" 323 | } 324 | ] 325 | ``` 326 | 327 | 328 | ### GET /api/v3/market/bids 329 | #### Description: 330 | List open buy orders. 331 | 332 | #### Query: 333 | * `sym` **string** The symbol (e.g. btc_thb) 334 | * `lmt` **int** No. of limit to query open buy orders 335 | 336 | #### Response: 337 | ```javascript 338 | { 339 | "error": 0, 340 | "result": [ 341 | { 342 | "order_id": "365357265", 343 | "price": "3330100.43", 344 | "side": "buy", 345 | "size": "0.87901418", 346 | "timestamp": 1734714699000, 347 | "volume": "2927205.5" 348 | }, 349 | { 350 | "order_id": "365357190", 351 | "price": "3330100.13", 352 | "side": "buy", 353 | "size": "0.00314952", 354 | "timestamp": 1734689476000, 355 | "volume": "10488.24" 356 | } 357 | ] 358 | } 359 | 360 | ``` 361 | 362 | ### GET /api/v3/market/asks 363 | 364 | 365 | #### Description: 366 | List open sell orders. 367 | 368 | #### Query: 369 | * `sym` **string** The symbol (e.g. btc_thb) 370 | * `lmt` **int** No. of limit to query open sell orders 371 | 372 | #### Response: 373 | ```javascript 374 | { 375 | "error": 0, 376 | "result": [ 377 | { 378 | "order_id": "303536416", 379 | "price": "3334889", 380 | "side": "sell", 381 | "size": "0.01289714", 382 | "timestamp": 1734689550000, 383 | "volume": "42903" 384 | }, 385 | { 386 | "order_id": "303536239", 387 | "price": "3334889.31", 388 | "side": "sell", 389 | "size": "0.129", 390 | "timestamp": 1734714713000, 391 | "volume": "430200.72" 392 | } 393 | ] 394 | } 395 | ``` 396 | 397 | ### GET /api/v3/market/depth 398 | 399 | #### Description: 400 | Get depth information. 401 | 402 | #### Query: 403 | * `sym` **string** The symbol (e.g. btc_thb) 404 | * `lmt` **int** Depth size 405 | 406 | #### Response: 407 | ```javascript 408 | { 409 | "error": 0, 410 | "result": { 411 | "asks": [ 412 | [ 413 | 3338932.98, // price 414 | 0.00619979, //size 415 | ], 416 | [ 417 | 3341006.36, // price 418 | 0.00134854 //size 419 | ] 420 | ], 421 | "bids": [ 422 | [ 423 | 3334907.27, // price 424 | 0.00471255 //size 425 | ], 426 | [ 427 | 3334907.26, // price 428 | 0.36895805 //size 429 | ] 430 | ] 431 | } 432 | } 433 | ``` 434 | 435 | ### GET /api/v3/market/trades 436 | 437 | #### Description: 438 | List recent trades. 439 | 440 | #### Query: 441 | * `sym` **string** The symbol (e.g. btc_thb) 442 | * `lmt` **int** No. of limit to query recent trades 443 | 444 | #### Response: 445 | ```javascript 446 | { 447 | "error": 0, 448 | "result": [ 449 | [ 450 | 1734661894000, 451 | 3367353.98, 452 | 0.00148484, 453 | "BUY" 454 | ], 455 | [ 456 | 1734661893000, 457 | 3367353.98, 458 | 0.00029622, 459 | "BUY" 460 | ] 461 | ] 462 | } 463 | ``` 464 | ## Trading Endpoint V3 465 | 466 | 467 | ### POST /api/v3/market/wallet 468 | 469 | #### Description: 470 | Get user available balances (for both available and reserved balances please use [POST /api/v3/market/balances](#post-apiv3marketbalances)). 471 | 472 | #### Query: 473 | - n/a 474 | 475 | #### Response: 476 | ```javascript 477 | { 478 | "error": 0, 479 | "result": { 480 | "THB": 188379.27, 481 | "BTC": 8.90397323, 482 | "ETH": 10.1 483 | } 484 | } 485 | ``` 486 | ### POST /api/v3/user/trading-credits 487 | 488 | ### Description: 489 | Check trading credit balance. 490 | 491 | ### Query (URL): 492 | - 493 | 494 | ### Response: 495 | ```javascript 496 | { 497 | "error": 0, 498 | "result": 1000 499 | } 500 | ``` 501 | 502 | ### POST /api/v3/market/place-bid 503 | 504 | #### Description: 505 | Create a buy order. 506 | 507 | #### Body: 508 | * `sym` **string** The symbol you want to trade (e.g. btc_thb). 509 | * `amt` **float** Amount you want to spend with no trailing zero (e.g. 1000.00 is invalid, 1000 is ok) 510 | * `rat` **float** Rate you want for the order with no trailing zero (e.g. 1000.00 is invalid, 1000 is ok) 511 | * `typ` **string** Order type: limit or market (for market order, please specify rat as 0) 512 | * `client_id` **string** your id for reference ( not required ) 513 | * `post_only` **bool** Postonly flag: true or false ( not required ) 514 | 515 | #### Response: 516 | ```javascript 517 | { 518 | "error": 0, 519 | "result": { 520 | "id": "1", // order id 521 | "typ": "limit", // order type 522 | "amt": 1000, // spending amount 523 | "rat": 15000, // rate 524 | "fee": 2.5, // fee 525 | "cre": 2.5, // fee credit used 526 | "rec": 0.06666666, // amount to receive 527 | "ts": "1707220636" // timestamp 528 | "ci": "input_client_id" // input id for reference 529 | } 530 | } 531 | ``` 532 | 533 | ### POST /api/v3/market/place-ask 534 | 535 | #### Description: 536 | Create a sell order. 537 | 538 | #### Body: 539 | * `sym` **string** The symbol. The symbol you want to trade (e.g. btc_thb). 540 | * `amt` **float** Amount you want to sell with no trailing zero (e.g. 0.10000000 is invalid, 0.1 is ok) 541 | * `rat` **float** Rate you want for the order with no trailing zero (e.g. 1000.00 is invalid, 1000 is ok) 542 | * `typ` **string** Order type: limit or market (for market order, please specify rat as 0) 543 | * `client_id` **string** your id for reference ( not required ) 544 | * `post_only` **bool** Postonly flag: true or false ( not required ) 545 | 546 | 547 | #### Response: 548 | ```javascript 549 | { 550 | "error": 0, 551 | "result": { 552 | "id": "1", // order id 553 | "typ": "limit", // order type 554 | "amt": 1.00000000, // selling amount 555 | "rat": 15000, // rate 556 | "fee": 37.5, // fee 557 | "cre": 37.5, // fee credit used 558 | "rec": 15000, // amount to receive 559 | "ts": "1533834844" // timestamp 560 | "ci": "input_client_id" // input id for reference 561 | } 562 | } 563 | ``` 564 | 565 | ### POST /api/v3/market/cancel-order 566 | 567 | ### Description: 568 | Cancel an open order. 569 | 570 | ### Body: 571 | * `sym` **string** The symbol. ***Please note that the current endpoint requires the symbol thb_btc. However, it will be changed to btc_thb soon and you will need to update the configurations accordingly for uninterrupted API functionality.*** 572 | * `id` **string** Order id you wish to cancel 573 | * `sd` **string** Order side: buy or sell 574 | 575 | ### Response: 576 | ```javascript 577 | { 578 | "error": 0 579 | } 580 | ``` 581 | ### POST /api/v3/market/balances 582 | 583 | #### Description: 584 | Get balances info: this includes both available and reserved balances. 585 | 586 | #### Query: 587 | - n/a 588 | 589 | #### Response: 590 | ```javascript 591 | { 592 | "error": 0, 593 | "result": { 594 | "THB": { 595 | "available": 188379.27, 596 | "reserved": 0 597 | }, 598 | "BTC": { 599 | "available": 8.90397323, 600 | "reserved": 0 601 | }, 602 | "ETH": { 603 | "available": 10.1, 604 | "reserved": 0 605 | } 606 | } 607 | } 608 | ``` 609 | ### GET /api/v3/market/my-open-orders 610 | 611 | ### Description: 612 | List all open orders of the given symbol. 613 | 614 | ### Query: 615 | * `sym` **string** The symbol (e.g. btc_thb) 616 | 617 | ### Response: 618 | ```javascript 619 | { 620 | "error": 0, 621 | "result": [ 622 | { // Example of sell order 623 | "id": "2", // order id 624 | "side": "sell", // order side 625 | "type": "limit", // order type 626 | "rate": "15000", // rate 627 | "fee": "35.01", // fee 628 | "credit": "35.01", // credit used 629 | "amount": "0.93333334", // amount of crypto quantity 630 | "receive": "14000", // amount of THB 631 | "parent_id": "1", // parent order id 632 | "super_id": "1", // super parent order id 633 | "client_id": "client_id" // client id 634 | "ts": 1702543272000 // timestamp 635 | }, 636 | { // Example of buy order 637 | "id": "278465822", 638 | "side": "buy", 639 | "type": "limit", 640 | "rate": "10", 641 | "fee": "0.25", 642 | "credit": "0", 643 | "amount": "100", // amount of THB 644 | "receive": "9.975", // amount of crypto quantity 645 | "parent_id": "0", 646 | "super_id": "0", 647 | "client_id": "client_id", 648 | "ts": 1707220636000 649 | }, 650 | ] 651 | } 652 | ``` 653 | Note : The ```client_id``` of this API response is the input body field name ```client_id``` , was inputted by the user of APIs 654 | * [api/v3/market/place-bid](#post-apiv3marketplace-bid) 655 | * [api/v3/market/place-ask](#post-apiv3marketplace-ask) 656 | 657 | 658 | 659 | ### GET /api/v3/market/my-order-history 660 | 661 | ### Description: 662 | List all orders that have already matched. 663 | 664 | #### Query: 665 | * `sym` **string** The trading symbol (e.g. BTC_THB) 666 | * `p` **string** Page number for page-based pagination (optional) 667 | * `lmt` **string** Limit per page, default: 10, min: 1 (optional) 668 | * `cursor` **string** Base64 encoded cursor for keyset pagination (optional) 669 | * `start` **string** Start timestamp (optional) 670 | * `end` **string** End timestamp (optional) 671 | * `pagination_type` **string** Pagination type: "page" or "keyset", default: "page" (optional) 672 | 673 | #### Validation Rules: 674 | - `sym` is required and must be a valid trading symbol 675 | - `p` and `cursor` cannot be used together 676 | - `p` requires `pagination_type=page` or no pagination_type specified 677 | - `cursor` requires `pagination_type=keyset` 678 | - `lmt` must be a positive integer >= 1 679 | - `start` and `end` must be valid timestamps if provided 680 | - `start` must be less than `end` if both provided 681 | 682 | #### Response (Page-based pagination): 683 | ```json 684 | { 685 | "error": 0, 686 | "result": [ 687 | { 688 | "txn_id": "68a82566596d482000f4e4edaa05m0", 689 | "order_id": "68a82566596d482000f4e4edaa05m0", 690 | "parent_order_id": "68a82566596d482000f4e4edaa05m0", 691 | "super_order_id": "68a82566596d482000f4e4edaa05m0", 692 | "client_id": "CLIENT123", 693 | "taken_by_me": false, 694 | "is_maker": true, 695 | "side": "buy", 696 | "type": "limit", 697 | "rate": "2500000.00", 698 | "fee": "25.00", 699 | "credit": "0.00", 700 | "amount": "1000.00", 701 | "ts": 1755850086843, 702 | "order_closed_at": 1755850086843 703 | } 704 | ], 705 | "pagination": { 706 | "page": 1, 707 | "last": 10, 708 | "next": 2, 709 | "prev": null 710 | } 711 | } 712 | ``` 713 | 714 | #### Response (Keyset-based pagination): 715 | ```json 716 | { 717 | "error": 0, 718 | "result": [ 719 | { 720 | "txn_id": "68a82566596d482000f4e4edaa05m0", 721 | "order_id": "68a82566596d482000f4e4edaa05m0", 722 | "parent_order_id": "68a82566596d482000f4e4edaa05m0", 723 | "super_order_id": "68a82566596d482000f4e4edaa05m0", 724 | "client_id": "CLIENT123", 725 | "taken_by_me": false, 726 | "is_maker": true, 727 | "side": "buy", 728 | "type": "limit", 729 | "rate": "2500000.00", 730 | "fee": "25.00", 731 | "credit": "0.00", 732 | "amount": "1000.00", 733 | "ts": 1755850086843, 734 | "order_closed_at": 1755850086843 735 | } 736 | ], 737 | "pagination": { 738 | "cursor": "eyJpZCI6Ik9SRDEyMzQ1Njc4OSIsInRzIjoiMTY3MjUzMTIwMCJ9", 739 | "has_next": true 740 | } 741 | } 742 | ``` 743 | 744 | #### Response Fields: 745 | 746 | **Order Item Fields:** 747 | - `txn_id`: Transaction ID 748 | - `order_id`: Unique order identifier 749 | - `parent_order_id`: Parent order ID (for linked orders) 750 | - `super_order_id`: Super order ID (for grouped orders) 751 | - `client_id`: Client-provided order ID 752 | - `taken_by_me`: Whether the order was taken by the user 753 | - `is_maker`: Whether the order was a maker order 754 | - `side`: Order side ("buy" or "sell") 755 | - `type`: Order type ("limit" or "market") 756 | - `rate`: Order price/rate 757 | - `fee`: Fee paid in THB 758 | - `credit`: Credit used for fee payment 759 | - `amount`: Order amount (quote quantity for buy orders, base quantity for sell orders) 760 | - `ts`: Order close timestamp in millisecond 761 | - `order_closed_at`: Order closure timestamp in millisecond (nullable) 762 | 763 | **Pagination Fields (Page-based):** 764 | - `page`: Current page number 765 | - `last`: Total number of pages 766 | - `next`: Next page number (nullable) 767 | - `prev`: Previous page number (nullable) 768 | 769 | **Pagination Fields (Keyset-based):** 770 | - `cursor`: Base64 encoded cursor for next page 771 | - `has_next`: Whether there are more records 772 | 773 | #### Cursor Encoding Details: 774 | 775 | The `cursor` parameter uses Base64 encoding of a JSON object containing pagination state: 776 | 777 | **Cursor Structure:** 778 | ```json 779 | { 780 | "id": "ORDER_ID_STRING", 781 | "ts": "TIMESTAMP_DECIMAL" 782 | } 783 | ``` 784 | 785 | **Encoding Process:** 786 | 1. Create JSON object with `id` (order ID) and `ts` (timestamp as decimal) 787 | 2. Convert JSON to string 788 | 3. Encode string using Base64 standard encoding 789 | 790 | **Example:** 791 | ```json 792 | // Original cursor object 793 | { 794 | "id": "ORD123456789", 795 | "ts": "1672531200" 796 | } 797 | 798 | // JSON string 799 | '{"id":"ORD123456789","ts":"1672531200"}' 800 | 801 | // Base64 encoded 802 | "eyJpZCI6Ik9SRDEyMzQ1Njc4OSIsInRzIjoiMTY3MjUzMTIwMCJ9" 803 | ``` 804 | 805 | **Custom Cursor Creation:** 806 | Users can create custom cursors by: 807 | 1. Taking the last item's `order_id` and `ts` from previous response 808 | 2. Creating JSON: `{"id":"LAST_ORDER_ID","ts":"LAST_TIMESTAMP"}` 809 | 3. Base64 encoding the JSON string 810 | 4. Using encoded string as `cursor` parameter 811 | 812 | **Empty Cursor:** 813 | - Default empty cursor: `e30=` (Base64 of `{}`) 814 | - Used when no cursor is provided in keyset pagination 815 | 816 | ### GET /api/v3/market/order-info 817 | ### Description: 818 | Get information regarding the specified order. 819 | 820 | ### Query: 821 | * `sym` **string** The symbol (e.g. btc_thb) 822 | * `id` **string** Order id 823 | * `sd` **string** Order side: buy or sell 824 | 825 | ### Response: 826 | ```javascript 827 | { 828 | "error": 0, 829 | "result": { 830 | "id": "289", // order id 831 | "first": "289", // first order id 832 | "parent": "0", // parent order id 833 | "last": "316", // last order id 834 | "client_id": "", // your id for reference 835 | "post_only": false, // post_only: true, false 836 | "amount": "4000", // order amount THB amount if it Buy side. And Crypto Amount if it sell side 837 | "rate": 291000, // order rate 838 | "fee": 10, // order fee 839 | "credit": 10, // order fee credit used 840 | "filled": 3999.97, // filled amount 841 | "total": 4000, // total amount 842 | "status": "filled", // order status: filled, unfilled, cancelled 843 | "partial_filled": false, // true when order has been partially filled, false when not filled or fully filled 844 | "remaining": 0, // remaining amount to be executed 845 | "history": [ 846 | { 847 | "amount": 98.14848, 848 | "credit": 0.25, 849 | "fee": 0.25, 850 | "id": "289", 851 | "rate": 291000, 852 | "timestamp": 1702466375000, 853 | "txn_id": "BTCBUY0003372258" 854 | } 855 | ] 856 | } 857 | } 858 | ``` 859 | 860 | ## Fiat Endpoint 861 | 862 | ### POST /api/v3/fiat/accounts 863 | 864 | ### Description: 865 | List all approved bank accounts. 866 | 867 | ### Query (URL): 868 | * `p` **int** Page (optional) 869 | * `lmt` **int** Limit (optional) 870 | 871 | ### Response: 872 | ```javascript 873 | { 874 | "error": 0, 875 | "result": [ 876 | { 877 | "id": "7262109099", 878 | "bank": "Kasikorn Bank", 879 | "name": "Somsak", 880 | "time": 1570893867 881 | } 882 | ], 883 | "pagination": { 884 | "page": 1, 885 | "last": 1 886 | } 887 | } 888 | ``` 889 | 890 | ### POST /api/v3/fiat/withdraw 891 | 892 | ### Description: 893 | Make a withdrawal to an **approved** bank account. 894 | 895 | ### Query: 896 | * `id` **string** Bank account id 897 | * `amt` **float** Amount you want to withdraw 898 | 899 | ### Response: 900 | ```javascript 901 | { 902 | "error": 0, 903 | "result": { 904 | "txn": "THBWD0000012345", // local transaction id 905 | "acc": "7262109099", // bank account id 906 | "cur": "THB", // currency 907 | "amt": 21, // withdraw amount 908 | "fee": 20, // withdraw fee 909 | "rec": 1, // amount to receive 910 | "ts": 1569999999 // timestamp 911 | } 912 | } 913 | ``` 914 | 915 | ### POST /api/v3/fiat/deposit-history 916 | 917 | ### Description: 918 | List fiat deposit history. 919 | 920 | ### Query (URL): 921 | * `p` **int** Page (optional) 922 | * `lmt` **int** Limit (optional) 923 | 924 | ### Response: 925 | ```javascript 926 | { 927 | "error": 0, 928 | "result": [ 929 | { 930 | "txn_id": "THBDP0000012345", 931 | "currency": "THB", 932 | "amount": 5000.55, 933 | "status": "complete", 934 | "time": 1570893867 935 | } 936 | ], 937 | "pagination": { 938 | "page": 1, 939 | "last": 1 940 | } 941 | } 942 | ``` 943 | 944 | ### POST /api/v3/fiat/withdraw-history 945 | 946 | ### Description: 947 | List fiat withdrawal history. 948 | 949 | ### Query (URL): 950 | * `p` **int** Page (optional) 951 | * `lmt` **int** Limit (optional) 952 | 953 | ### Response: 954 | ```javascript 955 | { 956 | "error":0, 957 | "result": [ 958 | { 959 | "txn_id": "THBWD0000012345", 960 | "currency": "THB", 961 | "amount": "21", 962 | "fee": 20, 963 | "status": "complete", 964 | "time": 1570893493 965 | } 966 | ], 967 | "pagination": { 968 | "page": 1, 969 | "last": 1 970 | } 971 | } 972 | ``` 973 | 974 | ## User information Endpoint 975 | 976 | ### POST /api/v3/user/limits 977 | 978 | ### Description: 979 | Check deposit/withdraw limitations and usage. 980 | 981 | ### Query (URL): 982 | - 983 | 984 | ### Response: 985 | ```javascript 986 | { 987 | "error": 0, 988 | "result": { 989 | "limits": { // limitations by kyc level 990 | "crypto": { 991 | "deposit": 0.88971929, // BTC value equivalent 992 | "withdraw": 0.88971929 // BTC value equivalent 993 | }, 994 | "fiat": { 995 | "deposit": 200000, // THB value equivalent 996 | "withdraw": 200000 // THB value equivalent 997 | } 998 | }, 999 | "usage": { // today's usage 1000 | "crypto": { 1001 | "deposit": 0, // BTC value equivalent 1002 | "withdraw": 0, // BTC value equivalent 1003 | "deposit_percentage": 0, 1004 | "withdraw_percentage": 0, 1005 | "deposit_thb_equivalent": 0, // THB value equivalent 1006 | "withdraw_thb_equivalent": 0 // THB value equivalent 1007 | }, 1008 | "fiat": { 1009 | "deposit": 0, // THB value equivalent 1010 | "withdraw": 0, // THB value equivalent 1011 | "deposit_percentage": 0, 1012 | "withdraw_percentage": 0 1013 | } 1014 | }, 1015 | "rate": 224790 // current THB rate used to calculate 1016 | } 1017 | } 1018 | ``` 1019 | ### GET /api/v3/user/coin-convert-history 1020 | ### Description: 1021 | List all coin convert histories (paginated). 1022 | 1023 | ### Query (URL): 1024 | * `p` **int** Page default = 1 (optional) 1025 | * `lmt` **int** Limit default = 100 (optional) 1026 | * `sort` **int** Sort [1, -1] default = 1 (optional) 1027 | * `status` **string** Status [success, fail, all] (default = all) (optional) 1028 | * `sym` **string** The symbol (optional) 1029 | * e.g. KUB 1030 | * `start` **int** Start timestamp (optional) 1031 | * `end` **int** End timestamp (optional) 1032 | 1033 | 1034 | ### Response: 1035 | ```javascript 1036 | { 1037 | "error": 0, 1038 | "result": [ 1039 | { 1040 | "transaction_id": "67ef4ca7ddb88f34ce16a126", 1041 | "status": "success", 1042 | "amount": "0.0134066", 1043 | "from_currency": "KUB", 1044 | "trading_fee_received": "1.34", 1045 | "timestamp": 1743761171000 1046 | }, 1047 | { 1048 | "transaction_id": "6707a7426fb3370035725c03", 1049 | "status": "fail", 1050 | "amount": "0.000006", 1051 | "from_currency": "KUB", 1052 | "trading_fee_received": "0", 1053 | "timestamp": 1728580016000 1054 | } 1055 | ], 1056 | "pagination": { 1057 | "page": 1, 1058 | "last": 12, 1059 | "next": 2 1060 | } 1061 | } 1062 | ``` 1063 | 1064 | 1065 | # Error codes 1066 | Refer to the following descriptions: 1067 | 1068 | | Code | Message | Description | 1069 | | ---- | ---------------------- | ---------------------------------------------------------- | 1070 | | 0 | | No error | 1071 | | 1 | | Invalid JSON payload | 1072 | | 2 | | Missing X-BTK-APIKEY | 1073 | | 3 | | Invalid API key | 1074 | | 4 | | API pending for activation | 1075 | | 5 | | IP not allowed | 1076 | | 6 | | Missing / invalid signature | 1077 | | 7 | | Missing timestamp | 1078 | | 8 | | Invalid timestamp | 1079 | | 9 | | • Invalid user
• User not found
• Freeze withdrawal
• User is not allowed to perform this action within the last 24 hours
• User has suspicious withdraw crypto txn | 1080 | | 10 | | • Invalid parameter
• Invalid response: Code not found in response
• Validate params
• Default | 1081 | | 11 | | Invalid symbol | 1082 | | 12 | | • Invalid amount
• Withdrawal amount is below the minimum threshold | 1083 | | 13 | | Invalid rate | 1084 | | 14 | | Improper rate | 1085 | | 15 | | Amount too low | 1086 | | 16 | | Failed to get balance | 1087 | | 17 | | Wallet is empty | 1088 | | 18 | | Insufficient balance | 1089 | | 19 | | Failed to insert order into db | 1090 | | 20 | | Failed to deduct balance | 1091 | | 21 | | Invalid order for cancellation (Unable to find OrderID or Symbol.) | 1092 | | 22 | | Invalid side | 1093 | | 23 | | Failed to update order status | 1094 | | 24 | | • Invalid order for lookup
• Invalid kyc level | 1095 | | 25 | | KYC level 1 is required to proceed | 1096 | | 30 | | Limit exceeds | 1097 | | 40 | | Pending withdrawal exists | 1098 | | 41 | | Invalid currency for withdrawal | 1099 | | 42 | | Address is not in whitelist | 1100 | | 43 | | • Failed to deduct crypto
• Insufficient balance
• Deduct balance failed | 1101 | | 44 | | Failed to create withdrawal record | 1102 | | 47 | | Withdrawal amount exceeds the maximum limit | 1103 | | 48 | | • Invalid bank account
• User bank id is not found
• User bank is unavailable | 1104 | | 49 | | Bank limit exceeds | 1105 | | 50 | | • Pending withdrawal exists
• Cannot perform the action due to pending transactions | 1106 | | 51 | | Withdrawal is under maintenance | 1107 | | 52 | | Invalid permission | 1108 | | 53 | | Invalid internal address | 1109 | | 54 | | Address has been deprecated | 1110 | | 55 | | Cancel only mode | 1111 | | 56 | | User has been suspended from purchasing | 1112 | | 57 | | User has been suspended from selling | 1113 | | 58 | | ~~Transaction not found~~
User bank is not verified | 1114 | | 61 | | This endpoint doesn't support broker coins ('source' = broker). You can check 'source' of each symbol in /api/v3/market/symbols. | 1115 | | 90 | | Server error (please contact support) | 1116 | 1117 | # Rate limits 1118 | If the request rate exceeds the limit in any endpoints, the request will be blocked for 30 seconds. When blocked, HTTP response is 429 Too Many Requests. The limits apply to individual user accessing the API. ***The rate limit is applied to each endpoint regardless the API version.*** 1119 | 1120 | | Endpoint | Rate Limit | 1121 | | ---------------------------- | ---------------- | 1122 | | /api/v3/market/ticker | 100 req/sec | 1123 | | /api/v3/market/depth | 10 req/sec | 1124 | | /api/v3/market/symbols | 100 req/sec | 1125 | | /api/v3/market/trades | 100 req/sec | 1126 | | /api/v3/market/bids | 100 req/sec | 1127 | | /api/v3/market/asks | 100 req/sec | 1128 | | /api/market/order-info | 100 req/sec | 1129 | | /api/market/my-open-orders | 150 req/sec | 1130 | | /api/market/my-order-history | 100 req/sec | 1131 | | /api/market/place-bid | 150 req/sec | 1132 | | /api/market/place-ask | 150 req/sec | 1133 | | /api/market/cancel-order | 200 req/sec | 1134 | | /api/market/balances | 150 req/sec | 1135 | | /api/market/wallet | 150 req/sec | 1136 | | /api/servertime | 2,000 req/10secs | 1137 | | /api/status | 100 req/sec | 1138 | | /api/fiat/* | 20 req/sec | 1139 | | /api/user/* | 20 req/sec | 1140 | | /tradingview/* | 100 req/sec | 1141 | --------------------------------------------------------------------------------